Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def rank_group(self, kind, priority):
name = "rankgroup-%d" % Graph.rank_counter
Graph.rank_counter += 1
rank = Rank(kind, name, priority)
self.rank_groups[name] = rank
return name
'''
self.source = source
self.target = target
self.attrs = attrs
def __str__(self):
repr = "{source} -> {target} {extra}".format(
source=self.source.name,
target=self.target.name,
extra="" if not self.attrs else
"[" + ','.join("{}={}".format(attr[0], crepr(attr[1]))
for attr in self.attrs.items()) + "]")
return repr
g_graph = Graph(title="some model")
def add_param(label, graph=None):
if not graph:
graph = g_graph
return graph.node(label=label, prefix='param', color='blue')
def add_op(label, graph=None):
if not graph:
graph = g_graph
label = '\n'.join([
'',
' ',
' <table border="0"><tbody><tr><td>',
label,</td></tr></tbody></table>