Skip to content

Commit

Permalink
fix: Add types and remove unused imports (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger authored Dec 10, 2024
2 parents 1259fa5 + 1ee7b98 commit 9166735
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion capellambse_context_diagrams/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from __future__ import annotations

import collections.abc as cabc
import logging
import typing as t
from importlib import metadata
Expand Down
8 changes: 7 additions & 1 deletion capellambse_context_diagrams/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
The pre-layouted data was collected with the functions from
[collectors][capellambse_context_diagrams.collectors].
"""

from __future__ import annotations

import collections.abc as cabc
Expand All @@ -15,6 +16,7 @@
import typing as t

from capellambse import diagram as cdiagram
from capellambse import model as m
from capellambse.svg import decorations

from . import _elkjs, context
Expand Down Expand Up @@ -303,12 +305,16 @@ def get_styleclass(self, uuid: str) -> str | None:
[`_elkjs.ELKOutputChild`][capellambse_context_diagrams._elkjs.ELKOutputChild].
"""
try:
melodyobj = self._diagram._model.by_uuid(uuid)
melodyobj: m.ModelElement | m.Diagram = (
self._diagram._model.by_uuid(uuid)
)
except KeyError:
if not uuid.startswith("__"):
return None
return uuid[2:].split(":", 1)[0]
else:
if isinstance(melodyobj, m.Diagram):
return melodyobj.type.value
return melodyobj._get_styleclass()

def get_styleoverrides(
Expand Down

0 comments on commit 9166735

Please sign in to comment.