def visit_decorators(self, node, parent): """visit a Decorators node by returning a fresh instance of it""" # /!\ node is actually a _ast.Function node while # parent is a astng.nodes.Function node newnode = new.Decorators() _lineno_parent(node, newnode, parent) if 'decorators' in node._fields: # py < 2.6, i.e. 2.5 decorators = node.decorators else: decorators = node.decorator_list newnode.nodes = [self.visit(child, newnode) for child in decorators] newnode.set_line_info(newnode.last_child()) return newnode
def visit_decorators(self, node, parent): """visit a Decorators node by returning a fresh instance of it""" newnode = new.Decorators() self._set_infos(node, newnode, parent) newnode.nodes = [self.visit(child, newnode) for child in node.nodes] return newnode