@@ -166,42 +166,13 @@ def _validate_date_int_mult(s):
166166 mdates ._rcParam_helper .set_int_mult (s )
167167
168168
169- def _validate_tex_preamble (s ):
170- if s is None or s == 'None' :
171- _api .warn_deprecated (
172- "3.3" , message = "Support for setting the 'text.latex.preamble' or "
173- "'pgf.preamble' rcParam to None is deprecated since %(since)s and "
174- "will be removed %(removal)s; set it to an empty string instead." )
175- return ""
176- try :
177- if isinstance (s , str ):
178- return s
179- elif np .iterable (s ):
180- _api .warn_deprecated (
181- "3.3" , message = "Support for setting the 'text.latex.preamble' "
182- "or 'pgf.preamble' rcParam to a list of strings is deprecated "
183- "since %(since)s and will be removed %(removal)s; set it to a "
184- "single string instead." )
185- return '\n ' .join (s )
186- else :
187- raise TypeError
188- except TypeError as e :
189- raise ValueError ('Could not convert "%s" to string' % s ) from e
190-
191-
192169def validate_axisbelow (s ):
193170 try :
194171 return validate_bool (s )
195172 except ValueError :
196173 if isinstance (s , str ):
197174 if s == 'line' :
198175 return 'line'
199- if s .lower ().startswith ('line' ):
200- _api .warn_deprecated (
201- "3.3" , message = f"Support for setting axes.axisbelow to "
202- f"{ s !r} to mean 'line' is deprecated since %(since)s and "
203- f"will be removed %(removal)s; set it to 'line' instead." )
204- return 'line'
205176 raise ValueError ('%s cannot be interpreted as'
206177 ' True, False, or "line"' % s )
207178
@@ -466,25 +437,20 @@ def _is_iterable_not_string_like(x):
466437 # nonsensically interpreted as sequences of numbers (codepoints).
467438 return np .iterable (x ) and not isinstance (x , (str , bytes , bytearray ))
468439
469- # (offset, (on, off, on, off, ...))
470- if (_is_iterable_not_string_like (ls )
471- and len (ls ) == 2
472- and isinstance (ls [0 ], (type (None ), Number ))
473- and _is_iterable_not_string_like (ls [1 ])
474- and len (ls [1 ]) % 2 == 0
475- and all (isinstance (elem , Number ) for elem in ls [1 ])):
476- if ls [0 ] is None :
477- _api .warn_deprecated (
478- "3.3" , message = "Passing the dash offset as None is deprecated "
479- "since %(since)s and support for it will be removed "
480- "%(removal)s; pass it as zero instead." )
481- ls = (0 , ls [1 ])
482- return ls
483- # For backcompat: (on, off, on, off, ...); the offset is implicitly None.
484- if (_is_iterable_not_string_like (ls )
485- and len (ls ) % 2 == 0
486- and all (isinstance (elem , Number ) for elem in ls )):
487- return (0 , ls )
440+ if _is_iterable_not_string_like (ls ):
441+ if len (ls ) == 2 and _is_iterable_not_string_like (ls [1 ]):
442+ # (offset, (on, off, on, off, ...))
443+ offset , onoff = ls
444+ else :
445+ # For backcompat: (on, off, on, off, ...); the offset is implicit.
446+ offset = 0
447+ onoff = ls
448+
449+ if (isinstance (offset , Number )
450+ and len (onoff ) % 2 == 0
451+ and all (isinstance (elem , Number ) for elem in onoff )):
452+ return (offset , onoff )
453+
488454 raise ValueError (f"linestyle { ls !r} is not a valid on-off ink sequence." )
489455
490456
@@ -927,7 +893,7 @@ def _convert_validator_spec(key, conv):
927893 # text props
928894 "text.color" : validate_color ,
929895 "text.usetex" : validate_bool ,
930- "text.latex.preamble" : _validate_tex_preamble ,
896+ "text.latex.preamble" : validate_string ,
931897 "text.hinting" : ["default" , "no_autohint" , "force_autohint" ,
932898 "no_hinting" , "auto" , "native" , "either" , "none" ],
933899 "text.hinting_factor" : validate_int ,
@@ -1187,7 +1153,7 @@ def _convert_validator_spec(key, conv):
11871153
11881154 "pgf.texsystem" : ["xelatex" , "lualatex" , "pdflatex" ], # latex variant used
11891155 "pgf.rcfonts" : validate_bool , # use mpl's rc settings for font config
1190- "pgf.preamble" : _validate_tex_preamble , # custom LaTeX preamble
1156+ "pgf.preamble" : validate_string , # custom LaTeX preamble
11911157
11921158 # write raster image data into the svg file
11931159 "svg.image_inline" : validate_bool ,
0 commit comments