MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / to_dot

Method to_dot

code2flow/model.py:618–650  ·  view source on GitHub ↗

Returns string format for embedding in a dotfile. Example output: subgraph group_uid_a { node_uid_b node_uid_c; label='class_name'; ... subgraph group_uid_z { ... } ... } :rtype:

(self)

Source from the content-addressed store, hash-verified

616 return []
617
618 def to_dot(self):
619 """
620 Returns string format for embedding in a dotfile. Example output:
621 subgraph group_uid_a {
622 node_uid_b node_uid_c;
623 label='class_name';
624 ...
625 subgraph group_uid_z {
626 ...
627 }
628 ...
629 }
630 :rtype: str
631 """
632
633 ret = 'subgraph ' + self.uid + ' {\n'
634 if self.nodes:
635 ret += ' '
636 ret += ' '.join(node.uid for node in self.nodes)
637 ret += ';\n'
638 attributes = {
639 'label': self.label(),
640 'name': self.token,
641 'style': 'filled',
642 }
643 for k, v in attributes.items():
644 ret += f' {k}="{v}";\n'
645 ret += ' graph[style=dotted];\n'
646 for subgroup in self.subgroups:
647 ret += ' ' + ('\n'.join(' ' + ln for ln in
648 subgroup.to_dot().split('\n'))).strip() + '\n'
649 ret += '};\n'
650 return ret

Callers

nothing calls this directly

Calls 2

labelMethod · 0.95
to_dotMethod · 0.45

Tested by

no test coverage detected