Skip to content

google: parse docstrings that open with a section title (#115) - #116

Open
HardMax71 wants to merge 1 commit into
rr-:masterfrom
HardMax71:fix/google-title-on-first-line
Open

HardMax71 wants to merge 1 commit into
rr-:masterfrom
HardMax71:fix/google-title-on-first-line

Conversation

@HardMax71

Copy link
Copy Markdown

Fixes GH-115. A Google docstring with no summary line, opening straight with Args:, came back with zero params: inspect.cleandoc strips only the first line and dedents the rest, so the entries ended up flush with the title, the section was cut empty and GoogleParser.parse raised ParseError. In auto mode that is swallowed and the REST parse with nothing in it wins.

The parser now pushes a first-line title below a newline before cleandoc, so the title is dedented together with its entries. Docstrings with a summary or with a blank first line are untouched. Numpydoc and reST never had the problem since their entries sit at the title's indent.

Tests: a params and a returns case in test_google.py, and the auto-detection case in test_parser.py. Suite green on 3.8 and 3.12, pre-commit tools clean.

Copilot AI lite review requested due to automatic review settings September 3, 2026 15:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google docstring that starts with "Args:" is parsed as REST with no params

2 participants