-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python APIView] Fix type parsing regression in Python 3.10 #2479
Merged
Conversation
This file contains 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
tjprescott
commented
Dec 30, 2021
Comment on lines
30
to
31
assert arg.argtype == "typing.Optional[str]" | ||
assert arg.default == "None" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this test, we'll at least know when a version change breaks this behavior.
tjprescott
commented
Dec 30, 2021
packages/python-packages/api-stub-generator/tests/function_parsing_test.py
Show resolved
Hide resolved
tjprescott
commented
Jan 3, 2022
tjprescott
force-pushed
the
tjprescott/Fix310ParseIssue
branch
2 times, most recently
from
January 3, 2022 21:01
5811094
to
8bf0bb7
Compare
tjprescott
force-pushed
the
tjprescott/Fix310ParseIssue
branch
from
January 3, 2022 21:34
8bf0bb7
to
9e98dca
Compare
9 tasks
tjprescott
force-pushed
the
tjprescott/Fix310ParseIssue
branch
from
January 4, 2022 18:53
617b83c
to
9f3e2e8
Compare
johanste
reviewed
Jan 4, 2022
packages/python-packages/api-stub-generator/apistub/nodes/_docstring_parser.py
Outdated
Show resolved
Hide resolved
…string_parser.py Co-authored-by: Johan Stenberg (MSFT) <johan.stenberg@microsoft.com>
praveenkuttappan
approved these changes
Jan 5, 2022
chlowell
approved these changes
Jan 6, 2022
Co-authored-by: Charles Lowell <10964656+chlowell@users.noreply.github.com>
We'll merge this next week after the bulk of releases have gone out. |
tjprescott
force-pushed
the
tjprescott/Fix310ParseIssue
branch
from
January 10, 2022 21:06
5b55647
to
7f7072f
Compare
tjprescott
force-pushed
the
tjprescott/Fix310ParseIssue
branch
from
January 10, 2022 21:40
7f7072f
to
836e0e9
Compare
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.
Fixes #2478.
Fixes #752.
https://apiviewstaging.azurewebsites.net/Assemblies/Review/170d3e834f4d48f28bc3d98e7c20d3d0?diffRevisionId=941daaf7bb3743c087fd6cb7a069b7e1&doc=False&diffOnly=True
Note that for Python 2 code, APIView does NOT read the typehints (except for return types). The type information comes from the docstring. Since we have dropped Python 2 support, there's no motivation to fix this.
Finally, this also updates the syntax for kwargs to match those obtained from type hints:
old: str = ...
new: Optional[str] = ...