MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / validator

Function validator

lib/matplotlib/rcsetup.py:219–237  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

217 """
218
219 def validator(s):
220 if (allow_none and
221 (s is None or cbook._str_lower_equal(s, "none"))):
222 if cbook._str_lower_equal(s, "none") and s != "None":
223 _api.warn_deprecated(
224 "3.11",
225 message=f"Using the capitalization {s!r} in matplotlibrc for "
226 "*None* is deprecated in %(removal)s and will lead to an "
227 "error from version 3.13 onward. Please use 'None' "
228 "instead."
229 )
230 return None
231 if cls is str and not isinstance(s, str):
232 raise ValueError(f'Could not convert {s!r} to str')
233 try:
234 return cls(s)
235 except (TypeError, ValueError) as e:
236 raise ValueError(
237 f'Could not convert {s!r} to {cls.__name__}') from e
238
239 validator.__name__ = f"validate_{cls.__name__}"
240 if allow_none:

Callers 3

cyclerFunction · 0.85
test_validator_validFunction · 0.85
test_validator_invalidFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_validator_validFunction · 0.68
test_validator_invalidFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…