Skip to content

google: read short return types before the colon - #185

Merged
rr- merged 1 commit into
rework/42-google-itemsfrom
rework/43-google-return-types
Nov 7, 2026
Merged

rr- merged 1 commit into
rework/42-google-itemsfrom
rework/43-google-return-types

Conversation

@rr-

@rr- rr- commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Under Google Returns: and Yields:, a short type of several words before the colon is now the return's type. Before, it was read as part of the description:

  • list of str: Names. gives type list of str
  • int or None: Maybe. gives type int or None
  • dict[str, list[int]] | None: Counts. gives that type (single-word and bracketed types like dict[str, int]: already worked)

A short type is two or three type words joined by of, or or |. Words in a row with no joiner, as in The value: a number. or A list of str: x, are still a sentence and stay in the description. Brackets nest one level deep in this pattern, so a match can't backtrack far. The existing test for a 20000-member union return still finishes in time.

Case diffs: none. No case in the corpus has such a head under Returns:.

Parity against rework/42-google-items: 0 of 29183 docstrings differ (case 0, stdlib 0, generated 0), and none parse only in base. No stdlib docstring newly makes strict parse raise. The new tests in test_google.py cover the change.

Under Returns or Yields, a type of several words before the colon, as
in "list of str: text" or "int or None: text", was read as part of the
description. Two or three type words joined by "of", "or" or "|" are
now the return's type. Words in a row with no joiner between them, as
in "The value: text", are still a sentence.
@rr- rr- self-assigned this Nov 7, 2026
@rr-
rr- merged commit ac88b9d into rework/42-google-items Nov 7, 2026
@rr-
rr- deleted the rework/43-google-return-types branch November 7, 2026 00:20
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