Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def new_tuple_elts(node, elts=None):
    if elts is None:
        elts = []
    new_node = ast.Tuple(elts=elts, ctx=ast.Load())
    return copy_lineno(node, new_node)
        


src/a/s/astoptimizer-0.6/astoptimizer/optimizer.py   astoptimizer(Download)
 
from astoptimizer import UNSET
from astoptimizer.ast_tools import (
    copy_lineno,
    new_constant, new_literal, new_call, new_pass,
            if to_type == tuple:
                # [1, 2, 3] => (1, 2, 3)
                return new_tuple_elts(node, node.elts)
            if to_type == set:
                return self.node_to_set(node)