How to use the pygraphviz.graphviz.agattrdefval function in pygraphviz

To help you get started, we’ve selected a few pygraphviz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
def iteritems(self):
        ah = None
        while True:
            try:
                ah = gv.agnxtattr(self.handle, self.type, ah)
                yield (gv.agattrname(ah).decode(self.encoding),
                       gv.agattrdefval(ah).decode(self.encoding))
            except KeyError: # gv.agattrdefval returned KeyError, skip
                continue
            except StopIteration:  # gv.agnxtattr is done, as are we
                return
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
def __getitem__(self, name):
        item = gv.agget(self.handle, name.encode(self.encoding))
        if item is None:
            ah = gv.agattr(self.handle, self.type,
                           name.encode(self.encoding),
                           None)
            item = gv.agattrdefval(ah)
        return item.decode(self.encoding)
github philipaxer / pygraphviz / pygraphviz / agraph.py View on Github external
def __getitem__(self, name):
        item=gv.agget(self.handle,name.encode(self.encoding))
        if item is None:
            ah=gv.agattr(self.handle,self.type,
                         name,
                         None)
            item=gv.agattrdefval(ah)
        return item.decode(self.encoding)
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
def __init__(self, handle, atype):
        self.handle = handle
        self.type = atype
        self.ghandle = gv.agraphof(handle)
        # get the encoding
        root_handle = gv.agroot(self.ghandle) # get root graph
        try:
            ah = gv.agattr(root_handle, 0, b'charset', None)
            self.encoding = gv.agattrdefval(ah)
        except KeyError:
            self.encoding = _DEFAULT_ENCODING
github philipaxer / pygraphviz / pygraphviz / agraph.py View on Github external
def iteritems(self):
        ah=None
        while True:
            try:
                ah=gv.agnxtattr(self.handle,self.type,ah)
                yield (gv.agattrname(ah).decode(self.encoding),
                       gv.agattrdefval(ah).decode(self.encoding))
            except KeyError: # gv.agattrdefval returned KeyError, skip
                continue
github pygraphviz / pygraphviz / pygraphviz / agraph.py View on Github external
def iteritems(self):
        ah = None
        while 1:
            try:
                ah = gv.agnxtattr(self.ghandle, self.type, ah)
                value = gv.agxget(self.handle, ah)
                try:
                    defval = gv.agattrdefval(ah) # default value
                    if defval == value:
                        continue # don't report default
                except: # no default, gv.getattrdefval raised error
                    pass
                    # unique value for this edge
                yield (gv.agattrname(ah).decode(self.encoding),
                       value.decode(self.encoding))
            except KeyError: # gv.agxget returned KeyError, skip
                continue
            except StopIteration:  # gv.agnxtattr is done, as are we
                return
github philipaxer / pygraphviz / pygraphviz / agraph.py View on Github external
def __init__(self,handle,atype):
        self.handle=handle
        self.type=atype
        # get the encoding
        ghandle=gv.agraphof(handle)
        root_handle=gv.agroot(ghandle) # get root graph
        try:
            ah=gv.agattr(root_handle,0,'charset',None)
            self.encoding=gv.agattrdefval(ah)
        except KeyError:
            self.encoding=_DEFAULT_ENCODING