2121
2222import numpy as np
2323
24- from matplotlib import _api , animation , cbook
24+ from matplotlib import _api , cbook
2525from matplotlib .cbook import ls_mapper
2626from matplotlib .colors import Colormap , is_color_like
2727from matplotlib .fontconfig_pattern import parse_fontconfig_pattern
@@ -146,21 +146,6 @@ def validate_bool(b):
146146 raise ValueError ('Could not convert "%s" to bool' % b )
147147
148148
149- @_api .deprecated ("3.3" )
150- def validate_bool_maybe_none (b ):
151- """Convert b to ``bool`` or raise, passing through *None*."""
152- if isinstance (b , str ):
153- b = b .lower ()
154- if b is None or b == 'none' :
155- return None
156- if b in ('t' , 'y' , 'yes' , 'on' , 'true' , '1' , 1 , True ):
157- return True
158- elif b in ('f' , 'n' , 'no' , 'off' , 'false' , '0' , 0 , False ):
159- return False
160- else :
161- raise ValueError ('Could not convert "%s" to bool' % b )
162-
163-
164149def _validate_date_converter (s ):
165150 if s is None :
166151 return
@@ -303,11 +288,6 @@ def validate_backend(s):
303288 return backend
304289
305290
306- validate_toolbar = ValidateInStrings (
307- 'toolbar' , ['None' , 'toolbar2' , 'toolmanager' ], ignorecase = True ,
308- _deprecated_since = "3.3" )
309-
310-
311291def _validate_toolbar (s ):
312292 s = ValidateInStrings (
313293 'toolbar' , ['None' , 'toolbar2' , 'toolmanager' ], ignorecase = True )(s )
@@ -318,42 +298,6 @@ def _validate_toolbar(s):
318298 return s
319299
320300
321- @_api .deprecated ("3.3" )
322- def _make_nseq_validator (cls , n = None , allow_none = False ):
323-
324- def validator (s ):
325- """Convert *n* objects using ``cls``, or raise."""
326- if isinstance (s , str ):
327- s = [x .strip () for x in s .split (',' )]
328- if n is not None and len (s ) != n :
329- raise ValueError (
330- f'Expected exactly { n } comma-separated values, '
331- f'but got { len (s )} comma-separated values: { s } ' )
332- else :
333- if n is not None and len (s ) != n :
334- raise ValueError (
335- f'Expected exactly { n } values, '
336- f'but got { len (s )} values: { s } ' )
337- try :
338- return [cls (val ) if not allow_none or val is not None else val
339- for val in s ]
340- except ValueError as e :
341- raise ValueError (
342- f'Could not convert all entries to { cls .__name__ } s' ) from e
343-
344- return validator
345-
346-
347- @_api .deprecated ("3.3" )
348- def validate_nseq_float (n ):
349- return _make_nseq_validator (float , n )
350-
351-
352- @_api .deprecated ("3.3" )
353- def validate_nseq_int (n ):
354- return _make_nseq_validator (int , n )
355-
356-
357301def validate_color_or_inherit (s ):
358302 """Return a valid color arg."""
359303 if cbook ._str_equal (s , 'inherit' ):
@@ -408,10 +352,6 @@ def _validate_cmap(s):
408352 return s
409353
410354
411- validate_orientation = ValidateInStrings (
412- 'orientation' , ['landscape' , 'portrait' ], _deprecated_since = "3.3" )
413-
414-
415355def validate_aspect (s ):
416356 if s in ('auto' , 'equal' ):
417357 return s
@@ -478,19 +418,6 @@ def _validate_mathtext_fallback(s):
478418 "fallback off." )
479419
480420
481- validate_fontset = ValidateInStrings (
482- 'fontset' ,
483- ['dejavusans' , 'dejavuserif' , 'cm' , 'stix' , 'stixsans' , 'custom' ],
484- _deprecated_since = "3.3" )
485- validate_mathtext_default = ValidateInStrings (
486- 'default' , "rm cal it tt sf bf default bb frak scr regular" .split (),
487- _deprecated_since = "3.3" )
488- _validate_alignment = ValidateInStrings (
489- 'alignment' ,
490- ['center' , 'top' , 'bottom' , 'baseline' , 'center_baseline' ],
491- _deprecated_since = "3.3" )
492-
493-
494421def validate_whiskers (s ):
495422 try :
496423 return _listify_validator (validate_float , n = 2 )(s )
@@ -502,14 +429,6 @@ def validate_whiskers(s):
502429 "(float, float)]" ) from e
503430
504431
505- validate_ps_papersize = ValidateInStrings (
506- 'ps_papersize' ,
507- ['auto' , 'letter' , 'legal' , 'ledger' ,
508- 'a0' , 'a1' , 'a2' , 'a3' , 'a4' , 'a5' , 'a6' , 'a7' , 'a8' , 'a9' , 'a10' ,
509- 'b0' , 'b1' , 'b2' , 'b3' , 'b4' , 'b5' , 'b6' , 'b7' , 'b8' , 'b9' , 'b10' ,
510- ], ignorecase = True , _deprecated_since = "3.3" )
511-
512-
513432def validate_ps_distiller (s ):
514433 if isinstance (s , str ):
515434 s = s .lower ()
@@ -615,62 +534,6 @@ def validate_markevery(s):
615534
616535validate_markeverylist = _listify_validator (validate_markevery )
617536
618- validate_legend_loc = ValidateInStrings (
619- 'legend_loc' ,
620- ['best' ,
621- 'upper right' ,
622- 'upper left' ,
623- 'lower left' ,
624- 'lower right' ,
625- 'right' ,
626- 'center left' ,
627- 'center right' ,
628- 'lower center' ,
629- 'upper center' ,
630- 'center' ], ignorecase = True , _deprecated_since = "3.3" )
631-
632- validate_svg_fonttype = ValidateInStrings (
633- 'svg.fonttype' , ['none' , 'path' ], _deprecated_since = "3.3" )
634-
635-
636- @_api .deprecated ("3.3" )
637- def validate_hinting (s ):
638- return _validate_hinting (s )
639-
640-
641- # Replace by plain list in _prop_validators after deprecation period.
642- _validate_hinting = ValidateInStrings (
643- 'text.hinting' ,
644- ['default' , 'no_autohint' , 'force_autohint' , 'no_hinting' ,
645- 'auto' , 'native' , 'either' , 'none' ],
646- ignorecase = True )
647-
648-
649- validate_pgf_texsystem = ValidateInStrings (
650- 'pgf.texsystem' , ['xelatex' , 'lualatex' , 'pdflatex' ],
651- _deprecated_since = "3.3" )
652-
653-
654- @_api .deprecated ("3.3" )
655- def validate_movie_writer (s ):
656- # writers.list() would only list actually available writers, but
657- # FFMpeg.isAvailable is slow and not worth paying for at every import.
658- if s in animation .writers ._registered :
659- return s
660- else :
661- raise ValueError (f"Supported animation writers are "
662- f"{ sorted (animation .writers ._registered )} " )
663-
664-
665- validate_movie_frame_fmt = ValidateInStrings (
666- 'animation.frame_format' , ['png' , 'jpeg' , 'tiff' , 'raw' , 'rgba' , 'ppm' ,
667- 'sgi' , 'bmp' , 'pbm' , 'svg' ],
668- _deprecated_since = "3.3" )
669- validate_axis_locator = ValidateInStrings (
670- 'major' , ['minor' , 'both' , 'major' ], _deprecated_since = "3.3" )
671- validate_movie_html_fmt = ValidateInStrings (
672- 'animation.html' , ['html5' , 'jshtml' , 'none' ], _deprecated_since = "3.3" )
673-
674537
675538def validate_bbox (s ):
676539 if isinstance (s , str ):
@@ -719,10 +582,6 @@ def _validate_greaterequal0_lessequal1(s):
719582}
720583
721584
722- validate_grid_axis = ValidateInStrings (
723- 'axes.grid.axis' , ['x' , 'y' , 'both' ], _deprecated_since = "3.3" )
724-
725-
726585def validate_hatch (s ):
727586 r"""
728587 Validate a hatch pattern.
@@ -938,23 +797,6 @@ def validate_hist_bins(s):
938797 " a sequence of floats" .format (valid_strs ))
939798
940799
941- @_api .deprecated ("3.3" )
942- def validate_webagg_address (s ):
943- if s is not None :
944- import socket
945- try :
946- socket .inet_aton (s )
947- except socket .error as e :
948- raise ValueError (
949- "'webagg.address' is not a valid IP address" ) from e
950- return s
951- raise ValueError ("'webagg.address' is not a valid IP address" )
952-
953-
954- validate_axes_titlelocation = ValidateInStrings (
955- 'axes.titlelocation' , ['left' , 'center' , 'right' ], _deprecated_since = "3.3" )
956-
957-
958800class _ignorecase (list ):
959801 """A marker class indicating that a list-of-str is case-insensitive."""
960802
@@ -1086,7 +928,8 @@ def _convert_validator_spec(key, conv):
1086928 "text.color" : validate_color ,
1087929 "text.usetex" : validate_bool ,
1088930 "text.latex.preamble" : _validate_tex_preamble ,
1089- "text.hinting" : _validate_hinting ,
931+ "text.hinting" : ["default" , "no_autohint" , "force_autohint" ,
932+ "no_hinting" , "auto" , "native" , "either" , "none" ],
1090933 "text.hinting_factor" : validate_int ,
1091934 "text.kerning_factor" : validate_int ,
1092935 "text.antialiased" : validate_bool ,
0 commit comments