summaryrefslogtreecommitdiff
path: root/pylint/checkers/variables.py
diff options
context:
space:
mode:
authorMark Byrne <31762852+mbyrnepr2@users.noreply.github.com>2022-10-29 17:45:18 +0200
committerGitHub <noreply@github.com>2022-10-29 17:45:18 +0200
commitdfd0e5aefe2e90b64099b97fe8dc78f813d5b149 (patch)
tree50d33a3d22104bd3fdea956bffd38d71ca7d86ef /pylint/checkers/variables.py
parent7bd847008ed5668ff331f95f4770ddce5acd5d17 (diff)
downloadpylint-git-dfd0e5aefe2e90b64099b97fe8dc78f813d5b149.tar.gz
Fix a false negative for ``unused-import`` (#7621)
When linting multiple modules & one module uses an import in a type annotation & the same import is unused in a subsequent module. Closes #4150 Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'pylint/checkers/variables.py')
-rw-r--r--pylint/checkers/variables.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index 7be3916a7..ecd30f3a6 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -1147,6 +1147,7 @@ class VariablesChecker(BaseChecker):
return
self._check_imports(not_consumed)
+ self._type_annotation_names = []
def visit_classdef(self, node: nodes.ClassDef) -> None:
"""Visit class: update consumption analysis variable."""