def __init__(self, canvas, config): self.canvas = canvas styles = [dict(arrowtail='none', arrowhead="open"), dict(arrowtail="none", arrowhead='empty'), dict(arrowtail="node", arrowhead='empty', style='dashed'), dict(fontcolor='green', arrowtail='none', arrowhead='diamond', style='solid') ] DiagramWriter.__init__(self, config, styles)
def _setup(project: Project, config: PyreverseConfig, writer: DiagramWriter) -> Iterator: linker = Linker(project) handler = DiadefsHandler(config) dd = DefaultDiadefGenerator(linker, handler).visit(project) for diagram in dd: diagram.extract_relationships() writer.write(dd) yield for fname in (DOT_FILES + COLORIZED_DOT_FILES + VCG_FILES + PUML_FILES + COLORIZED_PUML_FILES + MMD_FILES + HTML_FILES): try: os.remove(fname) except FileNotFoundError: continue
def setup_colorized_dot(colorized_dot_config: PyreverseConfig, get_project: Callable) -> Iterator: writer = DiagramWriter(colorized_dot_config) project = get_project(os.path.join(os.path.dirname(__file__), "..", "data"), name="colorized") yield from _setup(project, colorized_dot_config, writer)
def setup_colorized_puml(colorized_puml_config: PyreverseConfig, get_project: Callable) -> Iterator: writer = DiagramWriter(colorized_puml_config) project = get_project(TEST_DATA_DIR, name="colorized") yield from _setup(project, colorized_puml_config, writer)
def setup_puml(puml_config: PyreverseConfig, get_project: Callable) -> Iterator: writer = DiagramWriter(puml_config) project = get_project(TEST_DATA_DIR) yield from _setup(project, puml_config, writer)
def test_color_for_stdlib_module(default_config: PyreverseConfig) -> None: writer = DiagramWriter(default_config) obj = Mock() obj.node = Mock() obj.node.qname.return_value = "collections" assert writer.get_shape_color(obj) == "grey"
def setup_vcg(vcg_config: PyreverseConfig, get_project: Callable) -> Iterator: writer = DiagramWriter(vcg_config) project = get_project(os.path.join(os.path.dirname(__file__), "..", "data")) yield from _setup(project, vcg_config, writer)