Skip to content

Commit e734457

Browse files
committed
Remove unnecessary variable binding
1 parent b7938b1 commit e734457

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pylint/extensions/private_import.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,23 @@ def _populate_type_annotations_annotation(
196196
or a Subscript e.g. `Optional[type]` or an Attribute, e.g. `pylint.lint.linter`.
197197
"""
198198
match node:
199-
case nodes.Name(name=name) if name not in all_used_type_annotations:
200-
all_used_type_annotations[name] = True
201-
return name # type: ignore[no-any-return]
202-
case nodes.Subscript(slice=s, value=value):
199+
case nodes.Name() if node.name not in all_used_type_annotations:
200+
all_used_type_annotations[node.name] = True
201+
return node.name # type: ignore[no-any-return]
202+
case nodes.Subscript():
203203
# slice is the next nested type
204-
self._populate_type_annotations_annotation(s, all_used_type_annotations)
204+
self._populate_type_annotations_annotation(
205+
node.slice, all_used_type_annotations
206+
)
205207
# value is the current type name: could be a Name or Attribute
206208
return self._populate_type_annotations_annotation(
207-
value, all_used_type_annotations
209+
node.value, all_used_type_annotations
208210
)
209-
case nodes.Attribute(expr=expr):
211+
case nodes.Attribute():
210212
# An attribute is a type like `pylint.lint.pylinter`. node.expr is the next level
211213
# up, could be another attribute
212214
return self._populate_type_annotations_annotation(
213-
expr, all_used_type_annotations
215+
node.expr, all_used_type_annotations
214216
)
215217
return None
216218

0 commit comments

Comments
 (0)