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

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)

        def new_list_elts(node, elts=None):
    if elts is None:
        elts = []
    new_node = ast.List(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,
                return new_constant(node, ())
            if qualname == 'list':
                return new_list_elts(node)
            if qualname == 'dict':
                return new_dict_elts(node)
            if to_type == list:
                # [1, 2, 3] => (1, 2, 3)
                return new_list_elts(node, node.elts)
            if to_type == set:
                return self.node_to_set(node)
            items.append(elt)
 
        return new_list_elts(node, items)
 
    def fullvisit_For(self, node):
                # [x*2 for x in "abc" if False] => []
                # [x*2 for x in []] => []
                return new_list_elts(node)
 
            if isinstance(iter_expr, ast.List):