We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d0f2939 commit 5f91b3dCopy full SHA for 5f91b3d
pylint/checkers/utils.py
@@ -872,13 +872,11 @@ def decorated_with(
872
# We only want to infer the function name
873
decorator_node = decorator_node.func
874
try:
875
- if any(
876
- (hasattr(i, "name") and i.name in qnames)
877
- or (hasattr(i, "qname") and i.qname() in qnames)
+ return any(
+ i.name in qnames or i.qname() in qnames
878
for i in decorator_node.infer()
879
- if i is not None and not isinstance(i, util.UninferableBase)
880
- ):
881
- return True
+ if isinstance(i, (nodes.ClassDef, nodes.FunctionDef))
+ )
882
except astroid.InferenceError:
883
continue
884
return False
0 commit comments