10000 bpo-39411: pyclbr rewrite on AST by isidentical · Pull Request #18103 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-39411: pyclbr rewrite on AST #18103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 11, 2020
Prev Previous commit
Next Next commit
avoid copying whole Function
  • Loading branch information
isidentical committed Jan 21, 2020
commit bf12f16481428ab349f9fb14395b5b43546ffd83
12 changes: 8 additions & 4 deletions Lib/pyclbr.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,14 @@ def visit_Assign(self, node):
return

name = node.targets[0].id
child = copy.deepcopy(self.tree[node.value.id])
child.parent = self.stack[-1]
self.stack[-1]._addchild(name, child)
self.stack[-1]._addmethod(name, node.lineno)
value = self.tree[node.value.id]
parent = self.stack[-1]
child = Function(
value.module, name, value.file, node.lineno, parent, value.is_async
)
child.children = copy.deepcopy(value.children)
parent._addchild(name, child)
parent._addmethod(name, node.lineno)

def single_target_function_assign(self, node):
"""Check if given assignment consists from a single target
Expand Down
0