diff --git a/capellambse/_namespaces.py b/capellambse/_namespaces.py index ebc7f85f4..7f47e1436 100644 --- a/capellambse/_namespaces.py +++ b/capellambse/_namespaces.py @@ -78,15 +78,14 @@ def __str__(self) -> str: return self.name def __repr__(self) -> str: - if len(_values := list(self._values)) > 2: - name, minv, maxv = _values - values = [name, f"[{minv}|{maxv}]"] + if isinstance(self.version, tuple): + minv, maxv = self.version + values = [self.name, f"[{minv}|{maxv}]"] else: - name, version = _values - values = [name] - if version is not None: - values.append(version) - return "".join(values) # type: ignore[arg-type] + values = [self.name] + if self.version is not None: + values.append(self.version) + return "".join(values) def _tofloat(other: str) -> float: diff --git a/capellambse/aird/_common.py b/capellambse/aird/_common.py index d6144cb3d..8153f9e7f 100644 --- a/capellambse/aird/_common.py +++ b/capellambse/aird/_common.py @@ -74,7 +74,7 @@ class StackingBox(diagram.Box): CHILD_MARGIN = 0 - children: StackingBox._StackingChildren # type: ignore[name-defined] + children: _StackingChildren __features: cabc.MutableSequence[str] | None def __init__( diff --git a/capellambse/cli_helpers.py b/capellambse/cli_helpers.py index 502f03a8c..a62cb36e6 100644 --- a/capellambse/cli_helpers.py +++ b/capellambse/cli_helpers.py @@ -86,14 +86,15 @@ def convert(self, value: t.Any, param, ctx) -> dict[str, t.Any]: assert False except ImportError: + if not t.TYPE_CHECKING: - def ModelCLI(*__, **_): # type: ignore[no-redef] - """Raise a dependency error.""" - raise RuntimeError("click is not installed") + def ModelCLI(*__, **_): + """Raise a dependency error.""" + raise RuntimeError("click is not installed") - def ModelInfoCLI(*__, **_): # type: ignore[no-redef] - """Raise a dependency error.""" - raise RuntimeError("click is not installed") + def ModelInfoCLI(*__, **_): + """Raise a dependency error.""" + raise RuntimeError("click is not installed") def enumerate_known_models() -> cabc.Iterator[importlib.abc.Traversable]: