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

Skip to content

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

Merged
merged 1 commit into from
Sep 24, 2018

Conversation

timhoffm
Copy link
Member

PR Summary

Application of #12227 to the docstrings.

PR Checklist

  • Documentation is sphinx and numpydoc compliant

@timhoffm timhoffm added this to the v3.0.x milestone Sep 23, 2018
The (x,y) coordinates of the offset in display units.
A callable must have the signature::

def offset(width, height, xdescent, ydescent, renderer) \
Copy link
Member

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)?

Copy link
Member Author

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.

Copy link
Member

@jklymak jklymak left a 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.
Copy link
Member

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.

Copy link
Member Author

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.

@NelleV NelleV merged commit 2603ebc into matplotlib:master Sep 24, 2018
@NelleV
Copy link
Member

NelleV commented Sep 24, 2018

Thanks @timhoffm !

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 24, 2018
@timhoffm timhoffm deleted the doc-xy branch September 24, 2018 12:01
dstansby added a commit that referenced this pull request Sep 24, 2018
…237-on-v3.0.x

Backport PR #12237 on branch v3.0.x (Use (float, float) as parameter type for 2D positions in docstrings)
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.

3 participants