Exemplo n.º 1
0
 def visit_getattr(self, node, parent):
     """visit a Getattr node by returning a fresh instance of it"""
     newnode = new.Getattr()
     self._set_infos(node, newnode, parent)
     if self.asscontext == "Aug":
         return self.visit_assattr(node, parent)
     newnode.expr = self.visit(node.expr, newnode)
     newnode.attrname = node.attrname
     return newnode
Exemplo n.º 2
0
 def visit_getattr(self, node, parent):
     """visit a Getattr node by returning a fresh instance of it"""
     if self.asscontext == "Del":
         # FIXME : maybe we should reintroduce and visit_delattr ?
         # for instance, deactivating asscontext
         newnode = new.DelAttr()
     elif self.asscontext == "Ass":
         # FIXME : maybe we should call visit_assattr ?
         newnode = new.AssAttr()
         self._delayed_assattr.append(newnode)
     else:
         newnode = new.Getattr()
     _lineno_parent(node, newnode, parent)
     asscontext, self.asscontext = self.asscontext, None
     newnode.expr = self.visit(node.value, newnode)
     self.asscontext = asscontext
     newnode.attrname = node.attr
     newnode.set_line_info(newnode.last_child())
     return newnode