Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

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

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 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

@anntzeranntzer added this to thev3.3.0 milestoneMar 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 ofk 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
ContributorAuthor

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 ultimatelyimprove the situation for them as it will allowarrow.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

@timhoffmtimhoffmApr 1, 2020
edited
Loading

Choose a reason for hiding this comment

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

it will allowarrow.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 usingarrow.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 applymixed_case_parameters = ['UVC', 'patchA', 'patchB']if k != k.lower() and k not in mixed_case_parameters:

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Butset(patcha=foo) didn't actually work before (and still fails with this patch). The only difference is thatset(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.

@anntzeranntzerforce-pushed thecase-insensitive-props branch from7515f4f tobd6fe5cCompareApril 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.

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

Copy link
ContributorAuthor

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
ContributorAuthor

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?

@anntzeranntzerforce-pushed thecase-insensitive-props branch frombd6fe5c tof3a2cffCompareApril 3, 2020 07:03
As a real case, incorrectly passing "axA" instead of "axesA" toConnectionPatch currently triggers a slightly confusing warningregarding the non-existence of the "axa" property.
@anntzer
Copy link
ContributorAuthor

rebased

@timhoffmtimhoffm merged commite46906d intomatplotlib:masterApr 8, 2020
@anntzeranntzer deleted the case-insensitive-props branchApril 8, 2020 06:48
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic left review comments

@efiringefiringefiring approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.3.0
Development

Successfully merging this pull request may close these issues.

5 participants
@anntzer@terencehonles@timhoffm@efiring@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp