Skip to content

Commit 5f91b3d

Browse files
Further simplification
1 parent d0f2939 commit 5f91b3d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pylint/checkers/utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,11 @@ def decorated_with(
872872
# We only want to infer the function name
873873
decorator_node = decorator_node.func
874874
try:
875-
if any(
876-
(hasattr(i, "name") and i.name in qnames)
877-
or (hasattr(i, "qname") and i.qname() in qnames)
875+
return any(
876+
i.name in qnames or i.qname() in qnames
878877
for i in decorator_node.infer()
879-
if i is not None and not isinstance(i, util.UninferableBase)
880-
):
881-
return True
878+
if isinstance(i, (nodes.ClassDef, nodes.FunctionDef))
879+
)
882880
except astroid.InferenceError:
883881
continue
884882
return False

0 commit comments

Comments
 (0)