Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Deprecate case-insensitive properties. #16987

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
Apr 8, 2020
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 7 doc/api/api_changes_3.3/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -426,3 +426,10 @@ future.
*minor* kwarg to `.Axis.get_ticklocs` will become keyword-only
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Passing this argument positionally is deprecated.

Case-insensitive properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Normalization of upper or mixed-case property names to lowercase in
`.Artist.set` and `.Artist.update` is deprecated. In the future, property
names will be passed as is, allowing one to pass names such as *patchA* or
*UVC*.
7 changes: 6 additions & 1 deletion 7 lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,12 @@ def update(self, props):
ret = []
with cbook._setattr_cm(self, eventson=False):
for k, v in props.items():
k = k.lower()
if k != k.lower():
Copy link
Member

@timhoffm timhoffm Apr 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will allow arrow.set(patchA=foo) which failed so far?

Yes, that will work, but give a confusing warning "Case-insensitive properties were deprecated ...", which you can silence with using arrow.set(patcha=foo), which in turn will break after the deprecation.

can we make this

# excluding mixed case parameters from the deprecation as it does not apply
mixed_case_parameters = ['UVC', 'patchA', 'patchB']
if k != k.lower() and k not in mixed_case_parameters:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But set(patcha=foo) didn't actually work before (and still fails with this patch). The only difference is that set(patchA=...) used to fail and now will fail with a slightly more confusing error message, but will work after the deprecation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well ok, While I think there must be a better solution, likely nobody will notice if this has been broken currently.

cbook.warn_deprecated(
"3.3", message="Case-insensitive properties were "
"deprecated in %(since)s and support will be removed "
"%(removal)s")
k = k.lower()
# White list attributes we want to be able to update through
# art.update, art.set, setp.
if k == "axes":
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.