Repository navigation
google: read short return types before the colon - #185
Merged
Merged
Conversation
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.
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.
Under Google
Returns:andYields:, 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 typelist of strint or None: Maybe.gives typeint or Nonedict[str, list[int]] | None: Counts.gives that type (single-word and bracketed types likedict[str, int]:already worked)A short type is two or three type words joined by
of,oror|. Words in a row with no joiner, as inThe value: a number.orA 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
parseraise. The new tests intest_google.pycover the change.