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

Skip to content

Make error message explicit in legend.py #17488

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

Closed
wants to merge 4 commits into from

Conversation

ClementWalter
Copy link
Contributor

PR Summary

Update the error message when label is a string and starts with _ so as to make it clearer to the user.

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

Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

Please try to give your commits meaningful messages.

@story645 story645 self-requested a review May 22, 2020 22:00
@tacaswell tacaswell added this to the v3.4.0 milestone May 25, 2020
@tacaswell
Copy link
Member

@ClementWalter Would you be willing to add a test for this?

@ClementWalter
Copy link
Contributor Author

ok i will try to dit in the next few days

@QuLogic
Copy link
Member

QuLogic commented Sep 23, 2020

Ping?

@jklymak
Copy link
Member

jklymak commented Jan 27, 2021

This needs a rebase. Prob doesn't desperately need a test, thought it would be nice to up our code coverage.

@ClementWalter
Copy link
Contributor Author

ClementWalter commented Jan 28, 2021 via email

Comment on lines +407 to +409
cbook._warn_external('The label {!r} of handle {!r} cannot be '
'a string starting with '
'"_"'.format(label, handle))
Copy link
Member

Choose a reason for hiding this comment

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

The merge conflict comes from internal changes cbook._warn_external -> _api.warn_external.
While you're at it, using f-strings makes this more readable.

Suggested change
cbook._warn_external('The label {!r} of handle {!r} cannot be '
'a string starting with '
'"_"'.format(label, handle))
_api.warn_external(f'The label {label!r} of handle {handle!r} '
'cannot be a string starting with "_"')

@QuLogic QuLogic modified the milestones: v3.4.1, v3.5.0 Mar 30, 2021
@jklymak jklymak marked this pull request as draft April 23, 2021 17:00
@QuLogic QuLogic modified the milestones: v3.5.0, v3.6.0 Aug 18, 2021
timhoffm added a commit to timhoffm/matplotlib that referenced this pull request Feb 9, 2022
timhoffm added a commit to timhoffm/matplotlib that referenced this pull request Feb 10, 2022
timhoffm added a commit to timhoffm/matplotlib that referenced this pull request Feb 10, 2022
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.

6 participants