Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MNT: Deprecate other capitalization than "None" in matplotlibrc #29529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/api/next_api_changes/deprecations/ 29529-TH.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Capitalization of None in matplotlibrc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In :file:`matplotlibrc` config files every capitalization of None was
accepted for denoting the Python constant `None`. This is deprecated. The
only accepted capitalization is now None, i.e. starting with a capital letter
and all other letters in lowercase.
8 changes: 8 additions & 0 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@
def validator(s):
if (allow_none and
(s is None or cbook._str_lower_equal(s, "none"))):
if cbook._str_lower_equal(s, "none") and s != "None":
_api.warn_deprecated(

Check warning on line 195 in lib/matplotlib/rcsetup.py

View check run for this annotation

Codecov / codecov/patch

lib/matplotlib/rcsetup.py#L195

Added line #L195 was not covered by tests
"3.11",
message=f"Using the capitalization {s!r} in matplotlibrc for "
"*None* is deprecated in %(removal)s and will lead to an "
"error from version 3.13 onward. Please use 'None' "
"instead."
)
return None
if cls is str and not isinstance(s, str):
raise ValueError(f'Could not convert {s!r} to str')
Expand Down
Loading