-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Write all ACCEPTS markers in docstrings as comments. #15074
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
clipping box to the corresponding rectangle and set the clipping path | ||
to ``None``. | ||
|
||
For technical reasons (support of ``setp``), a tuple |
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 assume that's the reason. Don't know about the actual history.
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.
Seems true, given the note on set_boxstyle
.
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 would skip the discouragement here, unless you want to put the same in set_xlim and friends...
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.
removed.
clipping box to the corresponding rectangle and set the clipping path | ||
to ``None``. | ||
|
||
For technical reasons (support of ``setp``), a tuple |
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.
Seems true, given the note on set_boxstyle
.
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.
Unless I am mistaken (in which case please dismiss this), this doesn't work: previously one had
In [1]: plt.setp(plt.gca(), 'xlim')
xlim: (left: float, right: float)
but now
In [2]: plt.setp(plt.gca(), 'xlim')
xlim: float, optional
which is wrong
(this also shows up in the big properties table appended to the Axes docstring).
8caca1c
to
4df7647
Compare
@anntzer Thanks, you are right. I've re-targeted the PR; see the first comment above. |
4df7647
to
366805d
Compare
PR Summary
They are not needed anymore because he information can nowadays be read from numpydoc-style docstrings.This PR does not remove the parser logic nor the tests of the ACCEPTS mechanism (may be done separately).Need for accepts (current state)
As @anntzer pointed out #15074 (review) the info from ACCEPTS is still needed in some cases.
In particular, we need ACCEPTS if more than one parameter needs to be set for a property. The current implementation for it goes like this:
set_foo((a, b, c))
is equivalent toset_foo(a, b, c)
andsetp('foo', (a, b, c))
works... ACCEPTS: (a, b, c)
in the docstring. This allowssetp
to provide a proper parameter description and also shows up in property lists.Docstring cleanup in this PR
This PR moves plain
ACCEPTS
to comments.. ACCEPTS
. Thus, these lines do not show up in the rendered HTML docs. This is preferable as the plain ACCEPTS statements are more confusing than helpful for a regular reader of the docs.Additionally, some docstrings have been improved.
Possible future improvements
Handling the tuple unpacking and parameter assignment inside the function is quite cumbersome and mixes concerns. I'm considering to move this to a decorator. The decorator could also take the data information so that the docstring can be cleaned from this
.. ACCEPTS
cruft. But that's for another PR (this one could still go in 3.2.0, the decorator stuff would be for 3.3).