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 db685c7

Browse filesBrowse files
authored
Merge pull request #7723 from QuLogic/mplDeprecation
MNT: Use mplDeprecation class for all deprecations.
2 parents 159f36e + cbded72 commit db685c7
Copy full SHA for db685c7

File tree

Expand file treeCollapse file tree

2 files changed

+34
-16
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+34
-16
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+16-8Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -898,17 +898,21 @@ def __setitem__(self, key, val):
898898
try:
899899
if key in _deprecated_map:
900900
alt_key, alt_val, inverse_alt = _deprecated_map[key]
901-
warnings.warn(self.msg_depr % (key, alt_key))
901+
warnings.warn(self.msg_depr % (key, alt_key),
902+
mplDeprecation)
902903
key = alt_key
903904
val = alt_val(val)
904905
elif key in _deprecated_set and val is not None:
905-
warnings.warn(self.msg_depr_set % key)
906+
warnings.warn(self.msg_depr_set % key,
907+
mplDeprecation)
906908
elif key in _deprecated_ignore_map:
907909
alt = _deprecated_ignore_map[key]
908-
warnings.warn(self.msg_depr_ignore % (key, alt))
910+
warnings.warn(self.msg_depr_ignore % (key, alt),
911+
mplDeprecation)
909912
return
910913
elif key in _obsolete_set:
911-
warnings.warn(self.msg_obsolete % (key,))
914+
warnings.warn(self.msg_obsolete % (key, ),
915+
mplDeprecation)
912916
return
913917
try:
914918
cval = self.validate[key](val)
@@ -924,16 +928,19 @@ def __getitem__(self, key):
924928
inverse_alt = None
925929
if key in _deprecated_map:
926930
alt_key, alt_val, inverse_alt = _deprecated_map[key]
927-
warnings.warn(self.msg_depr % (key, alt_key))
931+
warnings.warn(self.msg_depr % (key, alt_key),
932+
mplDeprecation)
928933
key = alt_key
929934

930935
elif key in _deprecated_ignore_map:
931936
alt = _deprecated_ignore_map[key]
932-
warnings.warn(self.msg_depr_ignore % (key, alt))
937+
warnings.warn(self.msg_depr_ignore % (key, alt),
938+
mplDeprecation)
933939
key = alt
934940

935941
elif key in _obsolete_set:
936-
warnings.warn(self.msg_obsolete % (key,))
942+
warnings.warn(self.msg_obsolete % (key, ),
943+
mplDeprecation)
937944
return None
938945

939946
val = dict.__getitem__(self, key)
@@ -1092,7 +1099,8 @@ def _rc_params_in_file(fname, fail_on_error=False):
10921099
(val, error_details, msg))
10931100
elif key in _deprecated_ignore_map:
10941101
warnings.warn('%s is deprecated. Update your matplotlibrc to use '
1095-
'%s instead.' % (key, _deprecated_ignore_map[key]))
1102+
'%s instead.' % (key, _deprecated_ignore_map[key]),
1103+
mplDeprecation)
10961104

10971105
else:
10981106
print("""

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+18-8Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
except ImportError:
3030
# python 2
3131
import collections as abc
32+
33+
from matplotlib.cbook import mplDeprecation
3234
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
3335
from matplotlib.colors import is_color_like
3436

@@ -149,7 +151,8 @@ def deprecate_axes_hold(value):
149151
if value is None:
150152
return None # converted to True where accessed in figure.py,
151153
# axes/_base.py
152-
warnings.warn("axes.hold is deprecated, will be removed in 3.0")
154+
warnings.warn("axes.hold is deprecated, will be removed in 3.0",
155+
mplDeprecation)
153156
return validate_bool(value)
154157

155158

@@ -284,7 +287,8 @@ def validate_maskedarray(v):
284287
except ValueError:
285288
pass
286289
warnings.warn('rcParams key "maskedarray" is obsolete and has no effect;\n'
287-
' please delete it from your matplotlibrc file')
290+
' please delete it from your matplotlibrc file',
291+
mplDeprecation)
288292

289293

290294
_seq_err_msg = ('You must supply exactly {n} values, you provided {num} '
@@ -405,7 +409,8 @@ def validate_color(s):
405409

406410
def deprecate_axes_colorcycle(value):
407411
warnings.warn("axes.color_cycle is deprecated. Use axes.prop_cycle "
408-
"instead. Will be removed in 2.1.0")
412+
"instead. Will be removed in 2.1.0",
413+
mplDeprecation)
409414
return validate_colorlist(value)
410415

411416

@@ -480,7 +485,8 @@ def validate_whiskers(s):
480485

481486
def deprecate_savefig_extension(value):
482487
warnings.warn("savefig.extension is deprecated. Use savefig.format "
483-
"instead. Will be removed in 1.4.x")
488+
"instead. Will be removed in 1.4.x",
489+
mplDeprecation)
484490
return value
485491

486492

@@ -541,7 +547,8 @@ def validate_negative_linestyle_legacy(s):
541547
except ValueError:
542548
dashes = validate_nseq_float(2)(s)
543549
warnings.warn("Deprecated negative_linestyle specification; use "
544-
"'solid' or 'dashed'")
550+
"'solid' or 'dashed'",
551+
mplDeprecation)
545552
return (0, dashes) # (offset, (solid, blank))
546553

547554

@@ -554,7 +561,8 @@ def validate_corner_mask(s):
554561

555562
def validate_tkpythoninspect(s):
556563
# Introduced 2010/07/05
557-
warnings.warn("tk.pythoninspect is obsolete, and has no effect")
564+
warnings.warn("tk.pythoninspect is obsolete, and has no effect",
565+
mplDeprecation)
558566
return validate_bool(s)
559567

560568
validate_legend_loc = ValidateInStrings(
@@ -574,12 +582,14 @@ def validate_tkpythoninspect(s):
574582

575583
def deprecate_svg_image_noscale(value):
576584
warnings.warn("svg.image_noscale is deprecated. Set "
577-
"image.interpolation to 'none' instead.")
585+
"image.interpolation to 'none' instead.",
586+
mplDeprecation)
578587

579588

580589
def deprecate_svg_embed_char_paths(value):
581590
warnings.warn("svg.embed_char_paths is deprecated. Use "
582-
"svg.fonttype instead.")
591+
"svg.fonttype instead.",
592+
mplDeprecation)
583593

584594

585595
validate_svg_fonttype = ValidateInStrings('svg.fonttype',

0 commit comments

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