Use docstring_parser.description for help (fix #469)#470
Open
rec wants to merge 1 commit into
Open
Conversation
rec
commented
May 14, 2026
| if docstring is None: | ||
| return "" | ||
|
|
||
| docstring = _strings.dedent(docstring) |
| if parsed_docstring.long_description is not None: | ||
| parts.append(parsed_docstring.long_description) | ||
| return "\n".join(parts) | ||
| return docstring_parser.parse(docstring).description |
Author
There was a problem hiding this comment.
This one line does the same as the above, except it doesn't remove the carriage return between the first and second paragraphs.
It's also conceptually simpler to do exactly what docstring_parser does.
|
|
||
| usage, *lines = get_helptext_with_checks(Helptext).split("\n") | ||
| assert usage.startswith("usage:") | ||
| assert lines[:7] == ["", "First", "", "Second", "", "Third", ""] |
Author
There was a problem hiding this comment.
Before this commit, this code would have read:
assert lines[:5] == ["", "First Second", "", "Third", ""]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I accidentally closed the linked issue. 🙂