Skip to content

Commit

Permalink
Simplify the logic - Handle IndexError & AttributeError situations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbyrnepr2 committed May 7, 2022
1 parent 8357070 commit 38cbeeb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pylint/checkers/utils.py
Expand Up @@ -848,10 +848,10 @@ def uninferable_final_decorators(
decorators = []
for decorator in getattr(node, "nodes", []):
if isinstance(decorator, nodes.Attribute):
try:
import_node = decorator.expr.lookup(decorator.expr.name)[1][0]
except (AttributeError, IndexError):
_, import_nodes = decorator.expr.lookup(decorator.expr.name)
if not import_nodes:
continue
import_node = import_nodes[0]
elif isinstance(decorator, nodes.Name):
lookup_values = decorator.lookup(decorator.name)
if lookup_values[1]:
Expand Down

0 comments on commit 38cbeeb

Please sign in to comment.