Use (float, float) as parameter type for 2D positions in docstrings#12237
Use (float, float) as parameter type for 2D positions in docstrings#12237NelleV merged 1 commit intomatplotlib:masterfrom
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.
I don't get line 191 here... Do you mean it should return (float, float)?
There was a problem hiding this comment.
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.
jklymak
left a comment
There was a problem hiding this comment.
Looks great but a couple of small comments...
| def set_offset(self, xy): | ||
| """ | ||
| set offset of the container. | ||
| Set the offset of the container. |
There was a problem hiding this comment.
the extra "the" wasn't really necessary here.
There was a problem hiding this comment.
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