Skip to content

Commit

Permalink
Update name
Browse files Browse the repository at this point in the history
  • Loading branch information
adsharma authored and MiguelMarcelino committed Dec 26, 2023
1 parent 1651153 commit ded531d
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions py2many/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ def visit_Assign(self, node):
return node

def visit_AnnAssign(self, node):
self._generic_target_visit(node, node.target)
target = node.target
if isinstance(target, ast.Name):
target.assigned_from = node
self.scope.vars.append(target)
return node

def visit_AugAssign(self, node):
Expand All @@ -256,15 +259,7 @@ def _generic_target_visit(self, node, target):
target.assigned_from = node
if isinstance(target, ast.Name):
self.scope.vars.append(target)
if isinstance(target, ast.Attribute):
if get_id(target.value) == "self":
self_var = ast.Name(id=target.attr)
self_var.target_node = target
self._class_vars.append(self_var)
else:
self_var = target
if isinstance(target, ast.Tuple) or isinstance(target, ast.List):
self.scope.vars.extend([t for t in target.elts])
return node


class LHSAnnotationTransformer(ast.NodeTransformer):
Expand Down

0 comments on commit ded531d

Please sign in to comment.