10000 bpo-30181: parse docstring using pydoc by brianmay · Pull Request #1505 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-30181: parse docstring using pydoc #1505

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

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use guard clause for internal function
  • Loading branch information
brianmay committed May 24, 2017
commit 30cec86e437da3f6af5501f4fadb64bec03e3a84
10 changes: 4 additions & 6 deletions Lib/unittest/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,11 @@ def __exit__(self, exc_type, exc_value, tb):
def _get_short_description(doc):
# Return the summary line from a docstring.
Copy link
Member

Choose a reason for hiding this comment

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

This should be part of a docstring, not code comment.

Copy link
Member

Choose a reason for hiding this comment

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

I suggested to replace too verbose docstring in initial commit with shorter comment. But since it was shortened I'm nice with a docstring too.

# If there is no summary line, return None.
if doc:
(synopsis, long_description) = pydoc.splitdoc(doc)
synopsis = synopsis.strip()
else:
# The text is either an empty string, or some other false value.
synopsis = None
if not doc:
return None

(synopsis, long_description) = pydoc.splitdoc(doc)
synopsis = synopsis.strip()
return synopsis


Expand Down
0