Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Jun 6, 2024
1 parent 8c0e4be commit 39459c2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pylint/checkers/refactoring/refactoring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2454,11 +2454,9 @@ def _get_start_value(self, node: nodes.NodeNG) -> tuple[int | None, Confidence]:
and isinstance(node.operand, (nodes.Attribute, nodes.Name))
):
inferred = utils.safe_infer(node)
start_val = None
if isinstance(inferred, nodes.Const):
# inferred can be an astroid.base.Instance not only a nodes.Const,
# as in 'enumerate(x, int(y))'
start_val = inferred.value
# inferred can be an astroid.base.Instance as in 'enumerate(x, int(y))' or
# not correctly inferred (None)
start_val = inferred.value if isinstance(inferred, nodes.Const) else None
return start_val, INFERENCE
if isinstance(node, nodes.UnaryOp):
return node.operand.value, HIGH
Expand Down

0 comments on commit 39459c2

Please sign in to comment.