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

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Mar 31, 2020

As a real case, incorrectly passing "axA" instead of "axesA" to
ConnectionPatch currently triggers a slightly confusing warning
regarding the non-existence of the "axa" property.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.3.0 milestone Mar 31, 2020
@terencehonles
Copy link
Contributor

As a real case, incorrectly passing "axA" instead of "axesA" to
ConnectionPatch currently triggers a slightly confusing warning
regarding the non-existence of the "axa" property.

I'm not going to argue against case sensitivity, but the warning could also be made more clear by keeping a copy of k before lowercasing it.

@timhoffm
Copy link
Member

Do we have any non-lowercase properties? If so that would pose a consistency problem. Otherwise, I agree with the proposednchange.

@anntzer
Copy link
Contributor Author

anntzer commented Apr 1, 2020

Do we have any non-lowercase properties?

Grepping shows there's FancyArrowPatch's patchA/patchB and Quiver's UVC: I guess if anything this PR will ultimately improve the situation for them as it will allow arrow.set(patchA=foo) which failed so far?

@@ -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.

@anntzer anntzer force-pushed the case-insensitive-props branch from 7515f4f to bd6fe5c Compare April 2, 2020 21:54

Case-insensitive properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for upper or mixed-case property names in `.Artist.set` and
Copy link
Member

Choose a reason for hiding this comment

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

If patchA is now accepted, then this statement is incorrect now, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not accepted now (and wasn't before) (as it was and is still wrongly normalized to patcha), but will be 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.

Right, but this writeup says the opposite (even it didn't work before.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, the wording was bad, pushed a different one, how does that look?

@anntzer anntzer force-pushed the case-insensitive-props branch from bd6fe5c to f3a2cff Compare April 3, 2020 07:03
As a real case, incorrectly passing "axA" instead of "axesA" to
ConnectionPatch currently triggers a slightly confusing warning
regarding the non-existence of the "axa" property.
@anntzer
Copy link
Contributor Author

anntzer commented Apr 8, 2020

rebased

@timhoffm timhoffm merged commit e46906d into matplotlib:master Apr 8, 2020
@anntzer anntzer deleted the case-insensitive-props branch April 8, 2020 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.