-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ENH: Check labels arg when kwargs passed in Axis.set_ticks() #24334
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
Conversation
36011e8
to
86c94c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not fully clear why we need to be checking that the kwargs are only Text properties here... the end result if you pass something that is not is an AttributeError
being raised anyway.
I suppose you could make an argument that you want to avoid setting the locations if you cannot also set the labels (preserving it as an atomic operation) but I'm not fully convinced that is needed here.
If that is the goal, I think we could come up with many more places that would require similar checks, and even additional checks on this method (e.g. insuring that the length of the labels is equal to the length of the provided locations... this is already checked deeper in the call stack, and even mentions set_ticks
in the error message already)
Even if atomic operation is desirable here, I might advocate for a "forgiveness" approach, where we try to do everything, catch it, reset to original positions and reraise.
Do other maintainers have opinions here?
I am all for erroring out rather than silently dropping kwargs if labels are not provided, though.
Simplifying the changes to only checking if |
c6741c4
to
97058fc
Compare
97058fc
to
d9cd5cd
Compare
Hi, is this PR ready for merging? |
Thanks @j1642 ! |
PR Summary
Axis.set_ticks()
allows kwargs to pass without using them iflabels=None
.With these changes,
Axis.set_ticks()
now raises an exception whenlabels=None
and kwargs are passed.Does this change need API doc updates?
Resolves #24273.
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
Release Notes
.. versionadded::
directive in the docstring and documented indoc/users/next_whats_new/
.. versionchanged::
directive in the docstring and documented indoc/api/next_api_changes/
next_whats_new/README.rst
ornext_api_changes/README.rst