Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6636090

Browse files
committed
Remove rcsetup deprecations
1 parent 4b179b9 commit 6636090

File tree

1 file changed

+13
-82
lines changed

1 file changed

+13
-82
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 13 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,6 @@ def _validate_date(s):
136136
f'{s!r} should be a string that can be parsed by numpy.datetime64')
137137

138138

139-
@cbook.deprecated("3.2", alternative="os.path.exists")
140-
def validate_path_exists(s):
141-
"""If s is a path, return s, else False"""
142-
if s is None:
143-
return None
144-
if os.path.exists(s):
145-
return s
146-
else:
147-
raise RuntimeError('"%s" should be a path but it does not exist' % s)
148-
149-
150139
def validate_bool(b):
151140
"""Convert b to ``bool`` or raise."""
152141
if isinstance(b, str):
@@ -506,49 +495,14 @@ def _validate_mathtext_fallback(s):
506495

507496

508497
def validate_whiskers(s):
509-
if s == 'range':
510-
cbook.warn_deprecated(
511-
"3.2", message="Support for setting the boxplot.whiskers rcParam "
512-
"to 'range' is deprecated since %(since)s and will be removed "
513-
"%(removal)s; set it to 0, 100 instead.")
514-
return 'range'
515-
else:
498+
try:
499+
return _listify_validator(validate_float, n=2)(s)
500+
except (TypeError, ValueError):
516501
try:
517-
return _listify_validator(validate_float, n=2)(s)
518-
except (TypeError, ValueError):
519-
try:
520-
return float(s)
521-
except ValueError as e:
522-
raise ValueError("Not a valid whisker value ['range', float, "
523-
"(float, float)]") from e
524-
525-
526-
@cbook.deprecated("3.2")
527-
def update_savefig_format(value):
528-
# The old savefig.extension could also have a value of "auto", but
529-
# the new savefig.format does not. We need to fix this here.
530-
value = validate_string(value)
531-
if value == 'auto':
532-
cbook.warn_deprecated(
533-
"3.2", message="Support for setting the 'savefig.format' rcParam "
534-
"to 'auto' is deprecated since %(since)s and will be removed "
535-
"%(removal)s; set it to 'png' instead.")
536-
value = 'png'
537-
return value
538-
539-
540-
# Replace by validate_string once deprecation period passes.
541-
def _update_savefig_format(value):
542-
# The old savefig.extension could also have a value of "auto", but
543-
# the new savefig.format does not. We need to fix this here.
544-
value = validate_string(value)
545-
if value == 'auto':
546-
cbook.warn_deprecated(
547-
"3.2", message="Support for setting the 'savefig.format' rcParam "
548-
"to 'auto' is deprecated since %(since)s and will be removed "
549-
"%(removal)s; set it to 'png' instead.")
550-
value = 'png'
551-
return value
502+
return float(s)
503+
except ValueError as e:
504+
raise ValueError("Not a valid whisker value ['range', float, "
505+
"(float, float)]") from e
552506

553507

554508
validate_ps_papersize = ValidateInStrings(
@@ -719,18 +673,11 @@ def validate_hinting(s):
719673

720674

721675
# Replace by plain list in _prop_validators after deprecation period.
722-
def _validate_hinting(s):
723-
if s in (True, False):
724-
cbook.warn_deprecated(
725-
"3.2", message="Support for setting the text.hinting rcParam to "
726-
"True or False is deprecated since %(since)s and will be removed "
727-
"%(removal)s; set it to its synonyms 'auto' or 'none' instead.")
728-
return s
729-
return ValidateInStrings(
730-
'text.hinting',
731-
['default', 'no_autohint', 'force_autohint', 'no_hinting',
732-
'auto', 'native', 'either', 'none'],
733-
ignorecase=True)(s)
676+
_validate_hinting = ValidateInStrings(
677+
'text.hinting',
678+
['default', 'no_autohint', 'force_autohint', 'no_hinting',
679+
'auto', 'native', 'either', 'none'],
680+
ignorecase=True)
734681

735682

736683
validate_pgf_texsystem = ValidateInStrings(
@@ -1025,22 +972,6 @@ def validate_hist_bins(s):
1025972
" a sequence of floats".format(valid_strs))
1026973

1027974

1028-
@cbook.deprecated("3.2")
1029-
def validate_animation_writer_path(p):
1030-
# Make sure it's a string and then figure out if the animations
1031-
# are already loaded and reset the writers (which will validate
1032-
# the path on next call)
1033-
cbook._check_isinstance(str, path=p)
1034-
from sys import modules
1035-
# set dirty, so that the next call to the registry will re-evaluate
1036-
# the state.
1037-
# only set dirty if already loaded. If not loaded, the load will
1038-
# trigger the checks.
1039-
if "matplotlib.animation" in modules:
1040-
modules["matplotlib.animation"].writers.set_dirty()
1041-
return p
1042-
1043-
1044975
@cbook.deprecated("3.3")
1045976
def validate_webagg_address(s):
1046977
if s is not None:
@@ -1426,7 +1357,7 @@ def _convert_validator_spec(key, conv):
14261357
'savefig.edgecolor': validate_color_or_auto,
14271358
'savefig.orientation': ['landscape', 'portrait'],
14281359
'savefig.jpeg_quality': validate_int,
1429-
"savefig.format": _update_savefig_format,
1360+
"savefig.format": validate_string,
14301361
"savefig.bbox": validate_bbox, # "tight", or "standard" (= None)
14311362
"savefig.pad_inches": validate_float,
14321363
# default directory in savefig dialog box

0 commit comments

Comments
 (0)