From 304ac419212bddb22fd47f731d201144a4df80a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20M=C3=B6ller?= Date: Fri, 29 Sep 2023 16:12:03 +0200 Subject: [PATCH] model.base: replace `continue` with `break` in `NamespaceSet.remove()` If an item has been found, it doesn't make any sense to continue iterating the remaining items. Thus, this `continue` is replaced by a `break`, to break out of the loop once an item has been found. --- basyx/aas/model/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basyx/aas/model/base.py b/basyx/aas/model/base.py index bacd8b005..db9da5b11 100644 --- a/basyx/aas/model/base.py +++ b/basyx/aas/model/base.py @@ -1879,7 +1879,7 @@ def remove(self, item: _NSO) -> None: item_in_dict = backend[self._get_attribute(item, attr_name, case_sensitive)] if item_in_dict is item: item_found = True - continue + break if not item_found: raise KeyError("Object not found in NamespaceDict") item.parent = None