10000 Less ACCEPTS, more numpydoc. by anntzer · Pull Request #12229 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Less ACCEPTS, more numpydoc. #12229

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
Merged

Less ACCEPTS, more numpydoc. #12229

merged 1 commit into from
Sep 24, 2018

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Sep 23, 2018

PR Summary

All's in the title.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.1 milestone Sep 23, 2018
instances. Use *kwarg* *minor=True* to select minor ticks.
All other kwargs are used to update the text object properties.
As for get_ticklabels, label1 (left or bottom) is
affected for a given tick only if its label1On attribute
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is simply not true: we update all ticks regardless of visibility.

labels.
minor : bool
If True, set minor ticks instead of major ticks.
**kwargs :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No colon needed if you don't specify a type.

"""
Returns
-------
List of visible `Text`\s. For each tick, includes ``tick.label1`` if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numpydoc requires Returns to be formatted like Parameters. Do something like

Returns
-------
labels
    List of visible `Text`\s.  For each tick, includes ``tick.label1`` if
    it is visible, then ``tick.label2`` if it is visible, in that order.

@anntzer
Copy link
Contributor Author
anntzer commented Sep 23, 2018

comments handled

match = re.search("(?m)^ *{} : (.+)".format(param_name), docstring)
# We could set the number of * based on whether the parameter is a
# var(kw)args but it's not really worth the complexity.
match = re.search("(?m)^ *\*{{0,2}}{} : (.+)".format(param_name),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did this regexp change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is \*{{0,2}} to support parsing

    *margins : float, optional

and potentially also **kwargs : type (though I don't know if we have such a case. See also the added test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that this can never be **kwargs (because the setter passes the argument positionally), so I replaced it to only support a single *.

@jklymak jklymak merged commit d03e4ac into matplotlib:master Sep 24, 2018
@anntzer anntzer deleted the lessACCEPTS branch September 24, 2018 18:56
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
0