summaryrefslogtreecommitdiff
path: root/pylint/checkers/variables.py
diff options
context:
space:
mode:
authorMarc Mueller <30130371+cdce8p@users.noreply.github.com>2021-03-06 03:31:34 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-03-28 20:30:23 +0200
commit7905ec1f35d35aedb0a299598eebc9c98fe73f8a (patch)
tree64d9c49d306a2449a73cd31057da6131238a2a7e /pylint/checkers/variables.py
parent12acc439bdbece347334b9e1efbdc7245da5001d (diff)
downloadpylint-git-7905ec1f35d35aedb0a299598eebc9c98fe73f8a.tar.gz
Fix false-positive for unused-import on class keyword arguments
Diffstat (limited to 'pylint/checkers/variables.py')
-rw-r--r--pylint/checkers/variables.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index 875257155..9fc523576 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -976,6 +976,14 @@ class VariablesChecker(BaseChecker):
):
continue
+ # Ignore inner class scope for keywords in class definition
+ if (
+ current_consumer.scope_type == "class"
+ and isinstance(node.parent, astroid.Keyword)
+ and isinstance(node.parent.parent, astroid.ClassDef)
+ ):
+ continue
+
# if the name node is used as a function default argument's value or as
# a decorator, then start from the parent frame of the function instead
# of the function frame - and thus open an inner class scope