-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Option to disallow explicit Any types (--disallow-any=explicit) #3579
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 all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fa8e7a3
Implement option to disallow explicit Any types
ilinum 95a75f5
Merge branch 'master' into disallow-any=explicit
ilinum e3cd6eb
Report errors for explicit `Any` in TypedDict declaration
ilinum 1bf6c61
Make error message simpler (just say that there's `Any` on this line)
ilinum 398b2d8
Simplify test by splitting it into two
ilinum 4b9643f
Add test to check for generic alias with generic type "Any"
ilinum 8bcaf99
Uncomment test for NewType with explicit Any
ilinum 3d87808
Improve wording in a comment
ilinum ddc12e3
Merge branch 'master' into disallow-any=explicit
ilinum 4394530
Rename function to mark_any_non_explicit
ilinum 022684c
Update comment about `explicit` and `implicit` attributes on AnyType
ilinum f4c87fe
Add comment to the test about explicit Any in NewType
ilinum 9380796
Merge branch 'master' into disallow-any=explicit
ilinum 5ffbd1e
Use TypeTranslator to make Any non-explicit + extract method
ilinum 24c88c1
remove unneeded assert
ilinum 4384491
Merge branch 'master' into disallow-any=explicit
ilinum 8f90d49
Add documentation
ilinum 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 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
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
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
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.
Is this not always the opposite of
implicit
? If not, the specifics need to be made very clear in the comment.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,
explicit
is not always the opposite ofimplicit
, which is confusing.implicit
refers to situations whenAny
was inferred because a variable or parameter was not annotated.explicit
refers to situations when there was an explicitAny
annotation.However, if this
Any
comes, for instance, from an unimported type, bothexplicit
andimplicit
will beFalse
.It seems to me that
implicit
has a wrong name. It is currently used for--disallow-untyped-defs
to see if thisAny
comes from a parameter or variable with no explicit type annotation.I think instead of tweaking comments we should rename
implicit
. How do you feel about calling itfrom_unannotated
?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.
Added comment on implicit to make it more clear.