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

Appearance settings

Commit aae55fc

Browse filesBrowse files
authored
Merge pull request #11240 from anntzer/deprecate-examples-directory
Deprecate the examples.directory rcParam.
2 parents 300e4c9 + 63f53e3 commit aae55fc
Copy full SHA for aae55fc

File tree

Expand file treeCollapse file tree

5 files changed

+15
-6
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+15
-6
lines changed

‎doc/api/next_api_changes/2018-02-15-AL-deprecations.rst

Copy file name to clipboardExpand all lines: doc/api/next_api_changes/2018-02-15-AL-deprecations.rst
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The following classes, methods, functions, and attributes are deprecated:
4242
- ``text.Annotation.arrow``,
4343

4444
The following rcParams are deprecated:
45+
- ``examples.directory`` (use ``datapath`` instead),
4546
- ``pgf.debug`` (the pgf backend relies on logging),
4647

4748
The following keyword arguments are deprecated:

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,10 @@ def __setitem__(self, key, val):
894894
cbook.warn_deprecated(
895895
version, key, obj_type="rcparam", alternative=alt_key)
896896
return
897+
elif key == 'examples.directory':
898+
cbook.warn_deprecated(
899+
"3.0", "{} is deprecated; in the future, examples will be "
900+
"found relative to the 'datapath' directory.".format(key))
897901
try:
898902
cval = self.validate[key](val)
899903
except ValueError as ve:
@@ -917,6 +921,11 @@ def __getitem__(self, key):
917921
version, key, obj_type, alternative=alt_key)
918922
return dict.__getitem__(self, alt_key) if alt_key else None
919923

924+
elif key == 'examples.directory':
925+
cbook.warn_deprecated(
926+
"3.0", "{} is deprecated; in the future, examples will be "
927+
"found relative to the 'datapath' directory.".format(key))
928+
920929
return dict.__getitem__(self, key)
921930

922931
def __repr__(self):
@@ -1116,7 +1125,8 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
11161125
# this is the instance used by the matplotlib classes
11171126
rcParams = rc_params()
11181127

1119-
if rcParams['examples.directory']:
1128+
# Don't trigger deprecation warning when just fetching.
1129+
if dict.__getitem__(rcParams, 'examples.directory'):
11201130
# paths that are intended to be relative to matplotlib_fname()
11211131
# are allowed for the examples.directory parameter.
11221132
# However, we will need to fully qualify the path because

‎lib/matplotlib/cbook/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,8 @@ def get_sample_data(fname, asfileobj=True):
522522
523523
If the filename ends in .gz, the file is implicitly ungzipped.
524524
"""
525-
if matplotlib.rcParams['examples.directory']:
525+
# Don't trigger deprecation warning when just fetching.
526+
if dict.__getitem__(matplotlib.rcParams, 'examples.directory'):
526527
root = matplotlib.rcParams['examples.directory']
527528
else:
528529
root = os.path.join(matplotlib._get_data_path(), 'sample_data')

‎lib/matplotlib/tests/test_rcparams.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_rcparams.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def test_if_rctemplate_is_up_to_date():
463463
continue
464464
if k in deprecated:
465465
continue
466-
if "verbose" in k:
466+
if k.startswith(("verbose.", "examples.directory")):
467467
continue
468468
found = False
469469
for line in rclines:

‎matplotlibrc.template

Copy file name to clipboardExpand all lines: matplotlibrc.template
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,6 @@ backend : $TEMPLATE_BACKEND
594594
#keymap.all_axes : a ## enable all axes
595595
#keymap.copy : ctrl+c, cmd+c ## Copy figure to clipboard
596596

597-
## Control location of examples data files
598-
#examples.directory : ## directory to look in for custom installation
599-
600597
###ANIMATION settings
601598
#animation.html : none ## How to display the animation as HTML in
602599
## the IPython notebook. 'html5' uses

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.