summaryrefslogtreecommitdiff
path: root/pylint
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2022-09-24 08:49:01 -0400
committerJacob Walls <jacobtylerwalls@gmail.com>2022-09-28 16:41:09 -0400
commit530d79051fc2d63512808f40032729b5e18f4769 (patch)
treebdaeca8294c1c3b6852cee79c40a5c89ec4ea922 /pylint
parent51a5850234e12455fc29824cbacf680d7d439033 (diff)
downloadpylint-git-530d79051fc2d63512808f40032729b5e18f4769.tar.gz
Prevent `redefined-outer-name` for `if t.TYPE_CHECKING`
Diffstat (limited to 'pylint')
-rw-r--r--pylint/checkers/variables.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index a62d2362f..7be3916a7 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -1230,9 +1230,7 @@ class VariablesChecker(BaseChecker):
# Do not take in account redefined names for the purpose
# of type checking.:
if any(
- isinstance(definition.parent, nodes.If)
- and definition.parent.test.as_string() in TYPING_TYPE_CHECKS_GUARDS
- for definition in globs[name]
+ in_type_checking_block(definition) for definition in globs[name]
):
continue