Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make multiline docstrings start with a newline.#17125

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 1 commit intomatplotlib:masterfromanntzer:multidoc
Apr 14, 2020

Conversation

anntzer
Copy link
Contributor

A few are still missing.

Also inherited a couple more docstrings.

Now we just need to figure out how to flake8-enforce that...

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code isFlake 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

@tacaswelltacaswell added this to thev3.3.0 milestoneApr 13, 2020
@timhoffm
Copy link
Member

Now we just need to figure out how to flake8-enforce that...

At least delete D213 ignore from.flake8. Not sure if that's enough. It may be that the due to the default docstring convention in pydocstyle/flake8-docstrings D213 is still not checked. In that case one needs to dig through flake8/flake8-docstrings/pydocstyle to find out how to explicitly activate it.

@anntzer
Copy link
ContributorAuthor

Removing it doesn't enforce the check (I tried), and in any case it's not actually fully fixed yet because there's still a problem with single-line docstrings which don't fit in one line when the quotes are in the same line, but do if the quotes are not there. This was raised at least once on the pydocstyle tracker (should be easy to find) and last time I check their response was basically "don't write single-line docstrings of just the line that's annoying"...

Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

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

Comments: While we're at it, for the touched docstrings at least, finish them with a period.

@anntzer
Copy link
ContributorAuthor

sure, done

@timhoffm
Copy link
Member

timhoffm commentedApr 13, 2020
edited
Loading

there's still a problem with single-line docstrings which don't fit in one line when the quotes are in the same line, but do if the quotes are not there.

That's a separate error code: D200. I think D213 still allows

def foo():    """    Single line.    """

This was raised at least once on the pydocstyle tracker (should be easy to find) and last time I check their response was basically "don't write single-line docstrings of just the line that's annoying"...

There wasPyCQA/pydocstyle#184 with D205 and D400 errors if you have very long first sentences that need to be wrapped. - IMHO they would be relatively easy to fix, but the issue was closed.

Additionally, I openedPyCQA/pydocstyle#453, because D200 cannot be fulfilled for docstrings withmax. line length - 6 < text length + indent <= max. line length. This is a bit harder to fix, because pycodestyle would need to know about my line limit to allow for an exception.

For now, this means that we cannot check D200, 205, D400, because I don't think we want to or even reasonably can rewrite the first sentence to be descrpitive and fit in 69 chars (or 65 for methods) in all cases.

A few are still missing.Also inherited a couple more docstrings.
@anntzer
Copy link
ContributorAuthor

ok, removed D213 from .flake8, we'll see how this goes...

@timhoffm
Copy link
Member

Just checked PEP-257 again on multi-line docstrings:

The summary line may be used by automatic indexing tools; it is important that it fits on one line and is separated from the rest of the docstring by a blank line.

So, if one plays strictly by the rules, it's viable to closePyCQA/pydocstyle#184 and require the authors to instead shorten the docstring. :sad: Though I don't think that's a reasonable way.

@anntzer
Copy link
ContributorAuthor

anntzer commentedApr 13, 2020
edited
Loading

I'm not sure how it matters here (this is not about requiring a single-line summary) or even if an exegesis of PEP257 makes sense, but if we're going to go that route note that PEP257 contains the example (verbatim)

def foo():    """    This is the second line of the docstring.    """

so "triple-quotes + newline + single-line-docstring + newline + triple-quotes" is apparently allowed.

@QuLogicQuLogic merged commit717d1fa intomatplotlib:masterApr 14, 2020
@anntzeranntzer deleted the multidoc branchApril 14, 2020 07:22
timhoffm added a commit to timhoffm/matplotlib that referenced this pull requestMar 10, 2024
timhoffm added a commit to timhoffm/matplotlib that referenced this pull requestMar 10, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.3.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@timhoffm@tacaswell@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp