-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[pyflakes] Avoid false positives in @no_type_check contexts (F821, F722)
#14615
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
13 commits
Select commit
Hold shift + click to select a range
9aa4913
add test case from #13824
ntBre 3c5ceab
skip visit_type_definition in a @no_type_check context
ntBre 1b3ae36
add docs to new flag
ntBre 530ddd2
use contains instead of manual check
ntBre 10b2cac
switch to snapshot test
ntBre 3fac5c5
Revert "add test case from #13824"
ntBre 01f29a7
add failing tests for classes where no_type_check is also valid
ntBre 06c1655
move no_type_check check into visit_decorator
ntBre b367082
add and use SemanticModel::in_no_type_check
ntBre 615b4b8
ensure no_type_check propagates into function bodies
ntBre a60b747
make sure typing.no_type_check works too
ntBre 350f6e3
use `match_typing_expr`
ntBre 1d5ee64
ignore `@no_type_check` for classes
ntBre 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
move no_type_check check into visit_decorator
- Loading branch information
commit 06c1655c8f7ff9eab3895f65d92b6f39389918de
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.
I think this should use
match_typing_exprso that it works for@typing.no_type_checktoo.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.
So, will this apply to type annotations in the body of the function? And should it, per the spec? (I don't know off-hand.)
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.
Ah thanks, I missed
match_typing_expr.Yes, this should apply to annotations in the body too, based on my reading of the
no_type_checkdocs:Similarly in the typing docs linked in what Micha linked:
I added annotated variables to the test fixtures in my last commit to check this.