Skip to content

docstring_parser: unescape names in every style - #188

Merged
rr- merged 2 commits into
mainfrom
rework/53-names-escapes
Nov 7, 2026
Merged

rr- merged 2 commits into
mainfrom
rework/53-names-escapes

Conversation

@rr-

@rr- rr- commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Covers these items from the BEHAVIOR.md review for #136.

  • Every style now drops the backslashes that escape ReST markup in a name, so \*\*kwargs reads as **kwargs and class\_ as class_. Only ReST did this before. Epydoc used to raise ParseError on @param \*\*kwargs:.
  • ReST also unescapes :type:/:vartype: values, inline types and .. attribute:: names and types.
  • When composing ReST, a name that ends in _ is written class\_, because docutils would read class_ as a reference. a_b stays as it is.
  • Google and Numpydoc read ... as one of several names, as sphinx.ext.napoleon does, so arg1, arg2, ... gives three params.
  • A Google Args: line of bare names (x, y) is now tested.

Case diffs: one file, scipy.stats._distn_infrastructure.rv_discrete.logsf. Its arg1, arg2, arg3,... is now four params: arg1, arg2, arg3 and ....

Parity against origin/main: 5 of 29184 docstrings differ (case 5, stdlib 0, generated 0). One is the parse change above. The other four are ReST compose output that now escapes names such as from_.

Only ReST dropped the backslashes escaping markup in a name, as in
\*\*kwargs or class\_. Google, Numpydoc and Epydoc now do too, and
Epydoc no longer fails on @PARAM \*\*kwargs. ReST also unescapes type
fields and attribute directives, and escapes a name's trailing
underscore on compose, which docutils reads as a reference.

Google and Numpydoc read "..." as one of several names, as napoleon
does, so "arg1, arg2, ..." gives three params.
@rr- rr- self-assigned this Nov 7, 2026
@rr-
rr- merged commit 1e9089d into main Nov 7, 2026
26 checks passed
@rr-
rr- deleted the rework/53-names-escapes branch November 7, 2026 10:09
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.

1 participant