Skip to content

Read Epydoc's synonyms of field names - #163

Merged
rr- merged 1 commit into
mainfrom
rework/35-epydoc-fields
Nov 6, 2026
Merged

rr- merged 1 commit into
mainfrom
rework/35-epydoc-fields

Conversation

@rr-

@rr- rr- commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Epydoc's manual gives several fields synonyms, and Twisted and other projects use them. Until now the parser only knew the canonical names, so the synonyms came out as plain text metas:

>>> d = parse("Short.\n\n@raises ValueError: If bad.\n@returns: R.\n@returntype: int", "epydoc")

Before, d.raises and d.returns were empty. There were three text metas, and the @returntype typed nothing. Now there is a raises of type ValueError and a return R. of type int.

The synonyms, as the Epydoc manual lists them:

Field Synonyms
@param @parameter, @arg, @argument
@keyword @kwarg, @kwparam
@return @returns
@rtype @returntype
@raise @raises, @except, @exception

Each meta keeps the name it was written with as its key. compose() still writes the canonical names, so @raises comes out as @raise, and that reads back as the same raises. The synonyms are also in default_sections("epydoc"), so users building their own field list start from them.

Parity: 6 of 29,127 docstrings differ, all case inputs. Two are real Twisted docstrings (twisted.conch.ssh._kex.getKex and twisted.protocols.ftp.FTP.ftp_NLST.listErr), which now give a raises and a return instead of text metas. The other four are the new cases. No stdlib or generated docstrings changed.

Bench on 3.8: parse is 0.98–1.00x of main.

@rr- rr- self-assigned this Nov 6, 2026
Epydoc's manual gives synonyms for its fields: @raises, @except and
@exception for @raise, @returns for @return, @returntype for @rtype,
@parameter, @arg and @argument for @PARAM, and @kwarg and @kwparam for
@Keyword. They were read as plain text metas, so a raises written as
@raises had no type and a @returntype typed nothing. Read them as the
fields they stand for, keeping the name written as the key. Compose
still writes the canonical names.
@rr-
rr- force-pushed the rework/35-epydoc-fields branch from e72cc57 to d63693c Compare November 6, 2026 17:25
@rr-
rr- merged commit 28e2d1a into main Nov 6, 2026
25 checks passed
@rr-
rr- deleted the rework/35-epydoc-fields branch November 6, 2026 23:51
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