-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use (float, float) as parameter type for 2D positions in docstrings #12237
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
The (x,y) coordinates of the offset in display units. | ||
A callable must have the signature:: | ||
|
||
def offset(width, height, xdescent, ydescent, renderer) \ |
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 don't get line 191 here... Do you mean it should return (float, float)?
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.
This is the notation for the return type hint.
https://13820-1385122-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/api/offsetbox_api.html#matplotlib.offsetbox.OffsetBox.set_offset
We're already using this in other places such as:
https://13820-1385122-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/api/_as_gen/matplotlib.artist.Artist.set_contains.html#matplotlib.artist.Artist.set_contains
I've just not annotated the function parameters in this example to keep it more readable, and their types are quite obvious anyway.
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.
Looks great but a couple of small comments...
@@ -773,9 +783,12 @@ def set_transform(self, t): | |||
|
|||
def set_offset(self, xy): | |||
""" | |||
set offset of the container. | |||
Set the offset of the container. |
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.
the extra "the" wasn't really necessary here.
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 think we mostly use the form with the article in the docs. But I don't care too much.
Thanks @timhoffm ! |
…r 2D positions in docstrings
…237-on-v3.0.x Backport PR #12237 on branch v3.0.x (Use (float, float) as parameter type for 2D positions in docstrings)
PR Summary
Application of #12227 to the docstrings.
PR Checklist