-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
✨ Added new Error to TypedDict #14225
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
20 commits
Select commit
Hold shift + click to select a range
c7824be
✨ Added new Error to TypedDict
JoaquimEsteves f19a7f7
🐛 Fixed 'missing keys' not being reported
JoaquimEsteves 2a4220c
🐛 Early return in case there's missing or extra keys
JoaquimEsteves fcf4909
🧑🔬 Fixed simple error-code tests
JoaquimEsteves deb6543
Update test-data/unit/check-typeddict.test
JoaquimEsteves 222869d
Update test-data/unit/check-errorcodes.test
JoaquimEsteves 70c0a18
✨ We now typecheck despite having an extra-key
JoaquimEsteves eda0c8b
🧹 Setting an extra value on a TypedDict now has the correct error code
JoaquimEsteves 25f3dbc
✨ We can now set an item and get the correct error code
JoaquimEsteves c7c687f
🧑🔬 Redid the `IgnotErrorCodeTypedDictNoteIgnore` test
JoaquimEsteves a275c86
🐈⬛ Black
JoaquimEsteves f7a7f4f
🐛 Added Review Suggestions
JoaquimEsteves 06a3866
📝 Fixed docstring not being in the correct format.
JoaquimEsteves 780e10d
🐛 Fixed ignoring unknown-key not silencing the 'Did you mean' message
JoaquimEsteves fb98524
Review Feedback - Better Docstrings
JoaquimEsteves 708d322
📝 Added `unknown-key` to the `error_code_list`
JoaquimEsteves e4b82b6
🐛 Black and sphinx bugs
JoaquimEsteves 1c9a623
Merge branch 'master' into master
JoaquimEsteves f4f0cd0
Merge branch 'master' into master
JoaquimEsteves 957ba17
Apply suggestions from code review (docs)
ilevkivskyi 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
🐛 Added Review Suggestions
We don't need to convert dict_keys/items to set. Also fixed the comment saying literally the opposite of what was happening
- Loading branch information
commit f7a7f4f84ac06e5dadc7d6ab05094cd2ca9cd782
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
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.
This condition is unreachable, there is
callee.required_keys <= actual_keysin the enclosing if statement.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.
Hello!
I believe this is correct as the
callee.required_keys <= actual_keyshas a not preceeding it.Indeed, removing this return wil fail the test
[case TestCannotCreateTypedDictInstanceWithMissingItems]Let's imagine the following:
Will return AnyType and print out a single error message: "missing required key 3"
Whereas with
actual_keys = {1,2,3, 'unrelated'}will print out "extra key 'unrelated' but not return AnyType; ie it will continue to check the TypedDict for any other errors (For example, the actual keys might all be accounted for but have the wrong type).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.
Oh yeah, right, I have missed the
not.