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)
def GetAttrs(obj): attrs={} gsym=gv.firstattr(obj) while gsym: name=gv.nameof(gsym) attrs[name]=gv.getv(obj,gsym) gsym=gv.nextattr(obj,gsym) return attrs
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)