Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove the deprecated rcParams["datapath"].#19340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:masterfromanntzer:udp
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionsdoc/api/next_api_changes/removals/XXXXX-AL.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
The "datapath" rcParam has been removed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use `matplotlib.get_data_path` instead.
63 changes: 3 additions & 60 deletionslib/matplotlib/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -469,56 +469,9 @@ def get_cachedir():


@_logged_cached('matplotlib data path: %s')
def get_data_path(*, _from_rc=None):
def get_data_path():
"""Return the path to Matplotlib data."""
if _from_rc is not None:
_api.warn_deprecated(
"3.2",
message=("Setting the datapath via matplotlibrc is deprecated "
"%(since)s and will be removed %(removal)s."),
removal='3.4')
path = Path(_from_rc)
if path.is_dir():
return str(path)
else:
warnings.warn(f"You passed datapath: {_from_rc!r} in your "
f"matplotribrc file ({matplotlib_fname()}). "
"However this path does not exist, falling back "
"to standard paths.")

return _get_data_path()


@_logged_cached('(private) matplotlib data path: %s')
def _get_data_path():
path = Path(__file__).with_name("mpl-data")
if path.is_dir():
return str(path)

_api.warn_deprecated(
"3.2", message="Matplotlib installs where the data is not in the "
"mpl-data subdirectory of the package are deprecated since %(since)s "
"and support for them will be removed %(removal)s.")

def get_candidate_paths():
# setuptools' namespace_packages may hijack this init file
# so need to try something known to be in Matplotlib, not basemap.
import matplotlib.afm
yield Path(matplotlib.afm.__file__).with_name('mpl-data')
# py2exe zips pure python, so still need special check.
if getattr(sys, 'frozen', None):
yield Path(sys.executable).with_name('mpl-data')
# Try again assuming we need to step up one more directory.
yield Path(sys.executable).parent.with_name('mpl-data')
# Try again assuming sys.path[0] is a dir not a exe.
yield Path(sys.path[0]) / 'mpl-data'

for path in get_candidate_paths():
if path.is_dir():
defaultParams['datapath'][0] = str(path)
return str(path)

raise RuntimeError('Could not find the matplotlib data files')
return str(Path(__file__).with_name("mpl-data"))


def matplotlib_fname():
Expand DownExpand Up@@ -552,7 +505,7 @@ def gen_candidates():
yield matplotlibrc
yield os.path.join(matplotlibrc, 'matplotlibrc')
yield os.path.join(get_configdir(), 'matplotlibrc')
yield os.path.join(_get_data_path(), 'matplotlibrc')
yield os.path.join(get_data_path(), 'matplotlibrc')

for fname in gen_candidates():
if os.path.exists(fname) and not os.path.isdir(fname):
Expand All@@ -576,7 +529,6 @@ def gen_candidates():
# listed in the rcParams (not included in _all_deprecated).
# Values are tuples of (version,)
_deprecated_remain_as_none = {
'datapath': ('3.2.1',),
'animation.avconv_path': ('3.3',),
'animation.avconv_args': ('3.3',),
'animation.html_args': ('3.3',),
Expand DownExpand Up@@ -662,9 +614,6 @@ def __getitem__(self, key):
from matplotlib import pyplot as plt
plt.switch_backend(rcsetup._auto_backend_sentinel)

elif key == "datapath":
return get_data_path()

return dict.__getitem__(self, key)

def __repr__(self):
Expand DownExpand Up@@ -848,12 +797,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
with _api.suppress_matplotlib_deprecation_warning():
config = RcParams({**rcParamsDefault, **config_from_file})

with _api.suppress_matplotlib_deprecation_warning():
if config['datapath'] is None:
config['datapath'] = _get_data_path()
else:
config['datapath'] = get_data_path(_from_rc=config['datapath'])

if "".join(config['text.latex.preamble']):
_log.info("""
*****************************************************************
Expand Down
1 change: 0 additions & 1 deletionlib/matplotlib/rcsetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1015,7 +1015,6 @@ def _convert_validator_spec(key, conv):
"backend": validate_backend,
"backend_fallback": validate_bool,
"toolbar": _ignorecase(["none", "toolbar2", "toolmanager"]),
"datapath": validate_any, # see _get_data_path_cached
"interactive": validate_bool,
"timezone": validate_string,

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp