From bed124b0de4288b9e5030abe2dc19077e0bf75b7 Mon Sep 17 00:00:00 2001 From: Huyen Nguyen <48179958+huyenngn@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:51:26 +0100 Subject: [PATCH] fix: Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ernst Würger --- capellambse_context_diagrams/__init__.py | 5 +---- .../collectors/custom.py | 7 ++----- capellambse_context_diagrams/context.py | 17 +---------------- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/capellambse_context_diagrams/__init__.py b/capellambse_context_diagrams/__init__.py index c5fa031..460c356 100644 --- a/capellambse_context_diagrams/__init__.py +++ b/capellambse_context_diagrams/__init__.py @@ -254,10 +254,7 @@ def register_physical_port_context() -> None: m.set_accessor( cs.PhysicalPort, ATTR_NAME, - context.PhysicalPortContextAccessor( - DiagramType.PAB.value, - {}, - ), + context.PhysicalPortContextAccessor(DiagramType.PAB.value, {}), ) diff --git a/capellambse_context_diagrams/collectors/custom.py b/capellambse_context_diagrams/collectors/custom.py index 273e3ba..ffbc576 100644 --- a/capellambse_context_diagrams/collectors/custom.py +++ b/capellambse_context_diagrams/collectors/custom.py @@ -31,7 +31,7 @@ class CustomCollector: def __init__( self, - diagram: context.ContextDiagram, + diagram: context.CustomDiagram, params: dict[str, t.Any], ) -> None: self.diagram = diagram @@ -89,9 +89,7 @@ def __call__(self) -> _elkjs.ELKInputData: and getattr(current, "owner", None) is not None and not isinstance(current.owner, generic.PackageTypes) ): - current = self._make_owner_box( - current, - ) + current = self._make_owner_box(current) self.common_owners.discard(current.uuid) for edge_uuid, box_uuid in self.edge_owners.items(): if box := self.boxes.get(box_uuid): @@ -288,7 +286,6 @@ def _make_edge_and_ports( ), ) self.edges[edge_obj.uuid] = edge - return edge def _need_switch( diff --git a/capellambse_context_diagrams/context.py b/capellambse_context_diagrams/context.py index d6225da..752d7cd 100644 --- a/capellambse_context_diagrams/context.py +++ b/capellambse_context_diagrams/context.py @@ -892,14 +892,6 @@ class CustomDiagram(ContextDiagram): """An automatically generated CustomDiagram Diagram.""" _collect: dict[str, t.Any] - _display_symbols_as_boxes: bool - _display_parent_relation: bool - _hide_direct_children: bool - _slim_center_box: bool - _display_port_labels: bool - _port_label_position: str - _transparent_background: bool - _display_unused_ports: bool _unify_edge_direction: str def __init__( @@ -912,14 +904,7 @@ def __init__( ) -> None: default_render_parameters = { "collect": {}, - "display_symbols_as_boxes": False, - "display_parent_relation": False, - "hide_direct_children": False, "slim_center_box": False, - "display_port_labels": False, - "port_label_position": _elkjs.PORT_LABEL_POSITION.OUTSIDE.name, - "transparent_background": False, - "display_unused_ports": False, "unify_edge_direction": str, } | default_render_parameters super().__init__( @@ -931,7 +916,7 @@ def __init__( self.collector = custom.collector -class PhysicalPortContextDiagram(ContextDiagram): +class PhysicalPortContextDiagram(CustomDiagram): """An automatically generated Context Diagram exclusively for PhysicalPorts. """