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

Commit3e439a4

Browse files
authored
Merge pull request#18070 from dstansby/rc-depr-remove
Remove rcsetup deprecations
2 parents23ec51a +6321e94 commit3e439a4

File tree

3 files changed

+29
-83
lines changed

3 files changed

+29
-83
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
`.rcsetup` removals
2+
~~~~~~~~~~~~~~~~~~~
3+
The following functions in `matplotlib.rcsetup` have been removed:
4+
5+
- ``validate_path_exists`` - use `os.path.exists` instead.
6+
- ``update_savefig_format`` - this just replaced ``'auto'`` with ``'png'``.
7+
- ``validate_animation_writer_path``.
8+
9+
Changes to valid rcParams
10+
~~~~~~~~~~~~~~~~~~~~~~~~~
11+
The following rcParam values are no longer valid:
12+
13+
- Setting:rc:`savefig.format` to ``"auto"`` - use ``"png"`` instead.
14+
- Seeting:rc:`boxplot.whiskers` to ``"range"`` - set it to ``0, 100`` instead.
15+
- Setting:rc:`text.hinting` to `False` or `True` - set it to ``"auto"`` or ``"none"`` respectively.

‎doc/api/prev_api_changes/api_changes_3.2.0/behavior.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ Exception changes
293293
Various APIs that raised a `ValueError` for incorrectly typed inputs now raise
294294
`TypeError` instead: `.backend_bases.GraphicsContextBase.set_clip_path`,
295295
`.blocking_input.BlockingInput.__call__`, `.cm.register_cmap`, `.dviread.DviFont`,
296-
`.rcsetup.validate_hatch`, `.rcsetup.validate_animation_writer_path`, `.spines.Spine`,
296+
`.rcsetup.validate_hatch`, ``.rcsetup.validate_animation_writer_path``, `.spines.Spine`,
297297
many classes in the:mod:`matplotlib.transforms` module and:mod:`matplotlib.tri`
298298
package, and Axes methods that take a ``norm`` parameter.
299299

‎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-
defvalidate_path_exists(s):
141-
"""If s is a path, return s, else False"""
142-
ifsisNone:
143-
returnNone
144-
ifos.path.exists(s):
145-
returns
146-
else:
147-
raiseRuntimeError('"%s" should be a path but it does not exist'%s)
148-
149-
150139
defvalidate_bool(b):
151140
"""Convert b to ``bool`` or raise."""
152141
ifisinstance(b,str):
@@ -506,49 +495,14 @@ def _validate_mathtext_fallback(s):
506495

507496

508497
defvalidate_whiskers(s):
509-
ifs=='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-
returnfloat(s)
521-
exceptValueErrorase:
522-
raiseValueError("Not a valid whisker value ['range', float, "
523-
"(float, float)]")frome
524-
525-
526-
@cbook.deprecated("3.2")
527-
defupdate_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-
ifvalue=='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-
returnvalue
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-
ifvalue=='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-
returnvalue
502+
returnfloat(s)
503+
exceptValueErrorase:
504+
raiseValueError("Not a valid whisker value ['range', float, "
505+
"(float, float)]")frome
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-
ifsin (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-
returns
729-
returnValidateInStrings(
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-
defvalidate_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-
fromsysimportmodules
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"inmodules:
1040-
modules["matplotlib.animation"].writers.set_dirty()
1041-
returnp
1042-
1043-
1044975
@cbook.deprecated("3.3")
1045976
defvalidate_webagg_address(s):
1046977
ifsisnotNone:
@@ -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)

[8]ページ先頭

©2009-2025 Movatter.jp