Skip to content

Commit

Permalink
refactor: Remove unnecessary diagram IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Jul 17, 2024
1 parent 2b41190 commit d1a4939
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions capellambse_context_diagrams/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from capellambse import diagram as cdiagram
from capellambse import helpers
from capellambse.model import common, diagram, modeltypes
from capellambse.model.crosslayer import fa

from . import _elkjs, filters, serializers, styling
from .collectors import (
Expand Down Expand Up @@ -71,10 +70,7 @@ def __get__(
return self._get(obj, ContextDiagram)

def _get(
self,
obj: common.GenericElement,
diagram_class: type[ContextDiagram],
diagram_id: str = "{}_context",
self, obj: common.GenericElement, diagram_class: type[ContextDiagram]
) -> common.Accessor | ContextDiagram:
new_diagram = diagram_class(
self._dgcls,
Expand Down Expand Up @@ -108,7 +104,7 @@ def __get__( # type: ignore
assert isinstance(obj, common.GenericElement)
assert isinstance(obj.parent, common.GenericElement)
self._dgcls = self.__dgclasses[obj.parent.__class__]
return self._get(obj, InterfaceContextDiagram, "{}_interface_context")
return self._get(obj, InterfaceContextDiagram)


class FunctionalContextAccessor(ContextAccessor):
Expand All @@ -122,9 +118,7 @@ def __get__( # type: ignore
if obj is None: # pragma: no cover
return self
assert isinstance(obj, common.GenericElement)
return self._get(
obj, FunctionalContextDiagram, "{}_functional_context"
)
return self._get(obj, FunctionalContextDiagram)


class ClassTreeAccessor(ContextAccessor):
Expand All @@ -147,7 +141,7 @@ def __get__( # type: ignore
if obj is None: # pragma: no cover
return self
assert isinstance(obj, common.GenericElement)
return self._get(obj, ClassTreeDiagram, "{}_class_tree")
return self._get(obj, ClassTreeDiagram)


class RealizationViewContextAccessor(ContextAccessor):
Expand All @@ -170,7 +164,7 @@ def __get__( # type: ignore
if obj is None: # pragma: no cover
return self
assert isinstance(obj, common.GenericElement)
return self._get(obj, RealizationViewDiagram, "{}_realization_view")
return self._get(obj, RealizationViewDiagram)


class DataFlowAccessor(ContextAccessor):
Expand All @@ -191,7 +185,7 @@ def __get__( # type: ignore
if obj is None: # pragma: no cover
return self
assert isinstance(obj, common.GenericElement)
return self._get(obj, DataFlowViewDiagram, "{}_data_flow_view")
return self._get(obj, DataFlowViewDiagram)


class ContextDiagram(diagram.AbstractDiagram):
Expand Down

0 comments on commit d1a4939

Please sign in to comment.