From 4e7693644faf07377b1b32ee80e795ba0b3b47d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20M=C3=B6ller?= Date: Fri, 12 Jan 2024 17:06:54 +0100 Subject: [PATCH] model.submodel: ignore a type to make mypy happy --- basyx/aas/model/submodel.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/basyx/aas/model/submodel.py b/basyx/aas/model/submodel.py index 6e7cc5022..47e5a2ff5 100644 --- a/basyx/aas/model/submodel.py +++ b/basyx/aas/model/submodel.py @@ -779,14 +779,15 @@ def _check_constraints(self, new: _SE, existing: Iterable[_SE]) -> None: f"semantic_id, got {new!r} with semantic_id={new.semantic_id!r}") # If we got here we know that `new` is an instance of type_value_list_element and that type_value_list_element - # is either Property or Range. Thus, `new` must have the value_type property. Ignore the type here because - # the typechecker doesn't get it. + # is either Property or Range. Thus, `new` must have the value_type property. + # Furthermore, value_type_list_element cannot be None, as this is already checked in __init__(). + # Ignore the types here because the typechecker doesn't get it. if self.type_value_list_element in (Property, Range) \ and new.value_type is not self.value_type_list_element: # type: ignore raise base.AASConstraintViolation(109, "All first level elements must have the value_type " # type: ignore "specified by value_type_list_element=" - f"{self.value_type_list_element.__name__}, got {new!r} with " - f"value_type={new.value_type.__name__}") # type: ignore + f"{self.value_type_list_element.__name__}, got " # type: ignore + f"{new!r} with value_type={new.value_type.__name__}") # type: ignore # If semantic_id_list_element is not None that would already enforce the semantic_id for all first level # elements. Thus, we only need to perform this check if semantic_id_list_element is None.