-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Interpret type
annotations as type[Any]
annotations
#16366
Open
tyralla
wants to merge
25
commits into
python:master
Choose a base branch
from
tyralla:fix/narrow_type_vs_Type
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a430c12
Interpret `type` annotations as `type[Any]` annotations.
tyralla 56fb2bd
Replace `type` with `type[object]` in Mypy's code.
tyralla fe0cd0a
Find other places where `analyze_annotation` should eventually be set…
tyralla 28ee26b
* Rename `analyze_annotation` to `builtin_type_is_type_type` and mak…
tyralla 84d06cb
Merge branch 'master' into fix/narrow_type_vs_Type
tyralla dcf1f95
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b1bb26c
small fixes
tyralla 339f0b9
Merge branch 'fix/narrow_type_vs_Type' of https://github.com/tyralla/…
tyralla 80a8c67
minor fixes after review
tyralla ab7322c
Add type[ignore] to tuple.pyi to satisfy testDisallowAnyExplicitGener…
tyralla aa0cd97
Add error codes to the type: ignores in tuple.pyi (and tuple.pyi) to …
tyralla dcd12ba
Consider TypeType as hashable if (if no metaclass sets __hash__ to None)
tyralla e25f8e8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ed0f652
Look for __hash__ instead of checking the name of the potential Hashable
tyralla a46e5d9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 721465a
Merge branch 'master' into fix/narrow_type_vs_Type
tyralla 7d1d3f2
Add another `TypeVar`-related test to `testBuiltinTypeType`.
tyralla 7107fb8
Add more test cases to `testBuiltinTypeType`.
tyralla 3858928
Check more thoroughly if the `Protocol` is `Hashable`-like.
tyralla a09c6e2
Check more thoroughly if the signatures agree.
tyralla 1a2202f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 4330ea0
remove unused local symtab variable
tyralla d6e4338
Merge remote-tracking branch 'upstream/master' into fix/narrow_type_v…
hauntsaninja c7dbe6a
fix merge
hauntsaninja 5a3e028
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 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
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
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 would behave incorrectly in an exotic case where the protocol contains a member named
__hash__
that doesn't have the standard signature. Maybe that's OK though as it's better than the current state.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.
The same holds for the potential subclass. I added additional checks for both of them.