Пример #1
0
 def __iter__(self):
     """ Iterates over item attributes. """
     attr = gv.firstattr(self.handle)
     while gv.ok(attr):
         yield gv.nameof(attr), \
             decode_page(gv.getv(self.handle, attr))
         attr = gv.nextattr(self.handle, attr)
Пример #2
0
    def _iterattrs(self, handle=""):
        """ Iterate over the attributes of a graph item.

        If no handle attribute is given, iterates over the attributes
        of the root graph
        """
        if not handle:
            handle = self.handle
        attr = gv.firstattr(handle)
        while gv.ok(attr):
            yield gv.nameof(attr), decode_page(gv.getv(handle, attr))
            attr = gv.nextattr(handle, attr)