-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Refactor plugin system and special case TypedDict get and int.__pow__ #3501
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0c03d3f
Refactor plugin system
JukkaL d82aa69
Special case type checking of TypedDict get and int.__pow__
JukkaL 5661339
Fix argument type context for TypedDict get
JukkaL 753d52c
Report invalid TypedDict get key argument
JukkaL 166a911
Add test case that uses typeshed stubs
JukkaL b025991
Generalize method hook to work with Instances
JukkaL 2cf5cd7
TypedDict get tweaks
JukkaL abe29a9
Remove commented-out code
JukkaL 8a240dc
Various tweaks
JukkaL e43d94a
Fix test case
JukkaL 6db7d20
Address review feedback
JukkaL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
TypedDict get tweaks
- Loading branch information
commit 2cf5cd72057c20a06d521d1354f625ac808d9d76
There are no files selected for viewing
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
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
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
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.
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.
Wasn't there a use case where people write
p.get('d', {}).get('x')
and expect int or 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.
Yes, but as mentioned in the PR description, handling it safely requires a way of specifying that some TypedDict items may be missing, and we don't have that feature yet. The return type of
p.get('d', {})
should be a TypedDict that is likeD
but where both'x'
and'y'
may be missing. I'll add support for this in a separate PR once we can agree on the syntax (or I can add support for this as an mypy internal feature without public syntax so that missing keys are only generated through type inference).