Skip to content

Commit 4a56f3d

Browse files
committed
Refactor: condense if clause
1 parent c7d2789 commit 4a56f3d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pyiron_workflow/mixin/semantics.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,11 @@ def parent(self, new_parent: SemanticParent | None) -> None:
6565
# Exit early if nothing is changing
6666
return
6767

68-
if new_parent is not None:
69-
if not isinstance(new_parent, SemanticParent):
70-
raise ValueError(
71-
f"Expected None or a {SemanticParent.__name__} for the parent of "
72-
f"{self.label}, but got {new_parent}"
73-
)
68+
if new_parent is not None and not isinstance(new_parent, SemanticParent):
69+
raise ValueError(
70+
f"Expected None or a {SemanticParent.__name__} for the parent of "
71+
f"{self.label}, but got {new_parent}"
72+
)
7473

7574
if (
7675
self._parent is not None

0 commit comments

Comments
 (0)