INNER CODE UNIT · Python
makeGraph
KATRIN-Experiment/Kassiopeia · Scripts/gen-bindings-docs.py:85
def makeGraph(self, level=0, stack=[], nodes=set(), key='', with_children=True, with_attributes=False):
node_color = NODE_COLORS[(level+1) % len(NODE_COLORS)]
make_subgraph = (level == 0) or (with_children and self.children) or (with_attributes and self.attributes)
if not key and self.xml_names:
key = list(self.xml_names)[0]
cleanStr = lambda txt: txt.translate(dict([ (ord(c),'_') for c in "<>-" ])) # strip invalid chars
full_name = cleanStr(f'{self.name}__{key}')
if full_name in nodes:
return nodes
nodes.add(full_name)
if make_subgraph:
print(f'subgraph cluster_{cleanStr(self.name)} {{')
print(f'label="{self.name}"; fontsize={FONT_SIZE}; fontname="{FONT_FACE},bold"; style=filled; fillcolor="{CLUSTER_COLOR}{CLUSTER_ALPHA}";')
print(f'node [shape={NODE_SHAPE}, style=filled, fillcolor="{node_color}{NODE_ALPHA}", fontsize={FONT_SIZE}, fontname="{FONT_FACE},bold"];')