Repository navigation
Give items with no description None, never an empty string - #175
Merged
Merged
Conversation
An item with nothing after its colon, such as ReST ":param x:", got an empty string as its description, while one with no colon at all got None. Every meta now takes None for an empty description, so users test for one value only, in every style. Compose loses the difference the two had, so it writes what reads back as None: a typed item with no description as its type field alone, as before for a None one; an untyped one, or one whose field gives its own type, such as ReST ":param int x:", as its field; and a Google raises type alone only when it has no trailing space, which the colon after it keeps.
# Conflicts: # CHANGELOG.md
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.
An item with no description now has
Noneas its description in every style, never"". Before, an item with nothing after its colon got an empty string, while one with no colon at all gotNone. Users had to check for both.Before:
After:
DocstringMetaand its subclasses store an empty description asNone, so the parsers and items that users build give the same answer. Compose now writes each item so that it reads back withNone:Noneone already did.:param int x:, keeps that field.@return:field.This is a breaking change: code that compares descriptions to
""has to compare toNonenow.Parity against main: 3085 of 29157 docstrings differ (43 case, 40 stdlib, 3002 generated). Nearly all of them are parse output going from
''toNone. The compose diffs are the field choices listed above. The round-trip invariant passes with no new exclusions.Bench against main: 1.01x at most.