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

All Samples(7)  |  Call(7)  |  Derive(0)  |  Import(0)
Copy source location (`lineno` and `col_offset` attributes) from
*old_node* to *new_node* if possible, and return *new_node*.

        def copy_location(new_node, old_node):
    """
    Copy source location (`lineno` and `col_offset` attributes) from
    *old_node* to *new_node* if possible, and return *new_node*.
    """
    for attr in 'lineno', 'col_offset':
        if attr in old_node._attributes and attr in new_node._attributes \
           and hasattr(old_node, attr):
            setattr(new_node, attr, getattr(old_node, attr))
    return new_node
        


src/i/n/instrumental-0.5.1/instrumental/recorder.py   instrumental(Download)
            recorder_call = deepcopy(base_call)
            recorder_call.args.insert(0, node.values[i])
            recorder_call.args.append(ast.copy_location(ast.Num(n=i), node.values[i]))
            node.values[i] = ast.copy_location(recorder_call, node.values[i])
        ast.fix_missing_locations(node)
        return node
 
    def add_test(self, modulename, label, node):
        base_call = ast.copy_location(self.get_recorder_call(),
    def add_comparison(self, modulename, label, node):
        base_call = ast.copy_location(self.get_recorder_call(),
                                      node)
        base_call.args = \
            [node,
    def add_statement(self, modulename, node):
        marker = self.get_statement_recorder_call(modulename, node.lineno)
        marker = ast.copy_location(marker, node)
        ast.fix_missing_locations(marker)
        return marker

src/r/u/runnynose-0.1.2/runnynose/hook.py   runnynose(Download)
        if module.body:
            for node in setup:
                ast.copy_location(node, module.body[0])
 
            futures = []
    def visit_FunctionDef(self, defn):
        self.generic_visit(defn)
        record = get_record()
        for node in record:
            ast.copy_location(node, defn.body[0])