Skip to content

Commit

Permalink
handle Attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
clavedeluna committed Nov 22, 2022
1 parent 73dfd82 commit c191af8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/whatsnew/fragments/7821.bugfix
@@ -0,0 +1,3 @@
Fixes bug that resulted in crash during ``unnecessary_list_index_lookup`` check.

Closes #7821
2 changes: 1 addition & 1 deletion pylint/checkers/refactoring/refactoring_checker.py
Expand Up @@ -2303,7 +2303,7 @@ def _enumerate_with_start(
def _get_start_value(self, node: nodes.NodeNG) -> tuple[int | None, Confidence]:
confidence = HIGH

if isinstance(node, (nodes.Name, nodes.Call)):
if isinstance(node, (nodes.Name, nodes.Call, nodes.Attribute)):
inferred = utils.safe_infer(node)
start_val = inferred.value if inferred else None
confidence = INFERENCE
Expand Down
Expand Up @@ -138,3 +138,9 @@ def return_start(start):

for idx, val in enumerate():
print(my_list[idx])

class Command:
def _get_extra_attrs(self, extra_columns):
self.extra_rows_start = 8 # pylint: disable=attribute-defined-outside-init
for index, column in enumerate(extra_columns, start=self.extra_rows_start):
pass

0 comments on commit c191af8

Please sign in to comment.