From d1a493928a86151f83f3f5b3cae2bdb2369c44d4 Mon Sep 17 00:00:00 2001 From: ewuerger Date: Wed, 17 Jul 2024 12:56:51 +0200 Subject: [PATCH] refactor: Remove unnecessary diagram IDs --- capellambse_context_diagrams/context.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/capellambse_context_diagrams/context.py b/capellambse_context_diagrams/context.py index 473c1957..7bd7c820 100644 --- a/capellambse_context_diagrams/context.py +++ b/capellambse_context_diagrams/context.py @@ -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 ( @@ -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, @@ -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): @@ -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): @@ -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): @@ -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): @@ -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):