Skip to content

Commit

Permalink
fix: Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ernst Würger <[email protected]>
  • Loading branch information
huyenngn and ewuerger authored Nov 25, 2024
1 parent 2a5f966 commit bed124b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
5 changes: 1 addition & 4 deletions capellambse_context_diagrams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, {}),
)


Expand Down
7 changes: 2 additions & 5 deletions capellambse_context_diagrams/collectors/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CustomCollector:

def __init__(
self,
diagram: context.ContextDiagram,
diagram: context.CustomDiagram,
params: dict[str, t.Any],
) -> None:
self.diagram = diagram
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -288,7 +286,6 @@ def _make_edge_and_ports(
),
)
self.edges[edge_obj.uuid] = edge

return edge

def _need_switch(
Expand Down
17 changes: 1 addition & 16 deletions capellambse_context_diagrams/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand All @@ -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__(
Expand All @@ -931,7 +916,7 @@ def __init__(
self.collector = custom.collector


class PhysicalPortContextDiagram(ContextDiagram):
class PhysicalPortContextDiagram(CustomDiagram):
"""An automatically generated Context Diagram exclusively for
PhysicalPorts.
"""
Expand Down

0 comments on commit bed124b

Please sign in to comment.