(s)
| 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: |
no outgoing calls
searching dependent graphs…