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

Skip to content

Fix ArtistInspector.get_aliases. #12037

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
Sep 10, 2018
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 6, 2018

The docstring parsing in get_aliases was brittle and didn't handle the
final dot that cbook._define_aliases added to the docstring, so as of
master it would return the keys with an additional dot. Instead, use a
regex which will loudly error out if the format is incorrect.

Also replace {key: None, ...} mapping simulating a set to, well, a set.
(The use of sets instead of lists was added in ed9c2b5 apparently to
handle the case where the same alias is added twice.)

(Yes, the whole alias machinery could now be simplified e.g. by adding
an is_mpl_alias attribute on the aliases instead.)

At least the parsing fix should be considered RC as the issue came in in
#9475.

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 the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Sep 6, 2018
@anntzer anntzer added this to the v3.0 milestone Sep 6, 2018
The docstring parsing in get_aliases was brittle and didn't handle the
final dot that cbook._define_aliases added to the docstring, so as of
master it would return the keys with an additional dot.  Instead, use a
regex which will loudly error out if the format is incorrect.

Also replace {key: None, ...} mapping simulating a set to, well, a set.
(The use of sets instead of lists was added in ed9c2b5 apparently to
handle the case where the same alias is added twice.)

(Yes, the whole alias machinery could now be simplified e.g. by adding
an `is_mpl_alias` attribute on the aliases instead.)
Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Seems fine to me. I guess get_aliases is almost internal API that we don't need to worry about the API change too much?

@anntzer
Copy link
Contributor Author

anntzer commented Sep 10, 2018

If you consider get_aliases to be public API, then the exact format of the alias docstrings also becomes public API, which sounds... awkward.

@jklymak jklymak merged commit 46eb9b6 into matplotlib:master Sep 10, 2018
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 10, 2018
@anntzer anntzer deleted the artistinspector branch September 10, 2018 17:29
tacaswell added a commit that referenced this pull request Sep 10, 2018
…037-on-v3.0.x

Backport PR #12037 on branch v3.0.x (Fix ArtistInspector.get_aliases.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants