From 93df1429a8cfb0a232597496137d7f7093745bd7 Mon Sep 17 00:00:00 2001 From: ewagner-verta Date: Tue, 29 Aug 2023 18:20:42 +0200 Subject: [PATCH] refactor: move type casting from validation function to setter function --- client/verta/verta/pipeline/_pipeline_graph.py | 4 ++-- client/verta/verta/pipeline/_pipeline_step.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/verta/verta/pipeline/_pipeline_graph.py b/client/verta/verta/pipeline/_pipeline_graph.py index 7910e33ab8..60a434b58c 100644 --- a/client/verta/verta/pipeline/_pipeline_graph.py +++ b/client/verta/verta/pipeline/_pipeline_graph.py @@ -65,7 +65,7 @@ def set_steps( TypeError If ``steps`` is not a set of PipelineStep objects. """ - self._steps = self._validate_steps(steps) + self._steps = set(self._validate_steps(steps)) return self.steps def _validate_steps( @@ -98,7 +98,7 @@ def _validate_steps( f"individual steps of a PipelineGraph must be type" f" PipelineStep, not {type(step)}." ) - return set(steps) + return steps @classmethod def _from_definition( diff --git a/client/verta/verta/pipeline/_pipeline_step.py b/client/verta/verta/pipeline/_pipeline_step.py index 09413f828a..76a916d2ed 100644 --- a/client/verta/verta/pipeline/_pipeline_step.py +++ b/client/verta/verta/pipeline/_pipeline_step.py @@ -167,7 +167,7 @@ def set_predecessors( If the provided value for ``steps`` is not a set of PipelineStep objects. """ if steps: - self._predecessors = self._validate_predecessors(steps) + self._predecessors = set(self._validate_predecessors(steps)) return self.predecessors self._predecessors = set() return self.predecessors @@ -196,7 +196,7 @@ def _validate_predecessors( f"individual predecessors of a PipelineStep must be type" f" PipelineStep, not {type(step)}." ) - return set(predecessors) + return predecessors def _get_registered_model(self) -> RegisteredModel: """Fetch the registered model associated with this step's model version.