~amirouche/mutation

0687f862079d55a585dbffcc7974b7d8e7bc31d5 — Amirouche 7 months ago c64a2bf
replace function node_root with a parso method.
1 files changed, 1 insertions(+), 7 deletions(-)

M mutation.py
M mutation.py => mutation.py +1 -7
@@ 189,14 189,8 @@ def node_iter(node, level=1):
        yield from node_iter(child, level)


def node_root(node):
    if node.parent is None:
        return node
    return node_root(node.parent)


def node_copy_tree(node, index):
    root = node_root(node)
    root = node.get_root_node()
    root = deepcopy(root)
    iterator = itertools.dropwhile(
        lambda x: x[0] != index, zip(itertools.count(0), node_iter(root))