From 1a9f7d671539557a42f5a134f7276f8eaa93c47f Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 10 Sep 2024 14:18:10 +0100 Subject: [PATCH] Fix signature override of `WorkflowModule.save_to_step()` method Fix the following mypy 1.11 errors: ``` lib/galaxy/workflow/modules.py:650: error: Signature of "save_to_step" incompatible with supertype "WorkflowModule" [override] def save_to_step(self, step, **kwd): ^ lib/galaxy/workflow/modules.py:650: note: Superclass: lib/galaxy/workflow/modules.py:650: note: def save_to_step(self, step: Any, detached: Any = ...) -> Any lib/galaxy/workflow/modules.py:650: note: Subclass: lib/galaxy/workflow/modules.py:650: note: def save_to_step(self, step: Any, **kwd: Any) -> Any lib/galaxy/workflow/modules.py:1030: error: Signature of "save_to_step" incompatible with supertype "WorkflowModule" [override] def save_to_step(self, step, **kwd): ^ lib/galaxy/workflow/modules.py:1030: note: Superclass: lib/galaxy/workflow/modules.py:1030: note: def save_to_step(self, step: Any, detached: Any = ...) -> Any lib/galaxy/workflow/modules.py:1030: note: Subclass: lib/galaxy/workflow/modules.py:1030: note: def save_to_step(self, step: Any, **kwd: Any) -> Any lib/galaxy/workflow/modules.py:1680: error: Signature of "save_to_step" incompatible with supertype "WorkflowModule" [override] def save_to_step(self, step, **kwd): ^ lib/galaxy/workflow/modules.py:1680: note: Superclass: lib/galaxy/workflow/modules.py:1680: note: def save_to_step(self, step: Any, detached: Any = ...) -> Any lib/galaxy/workflow/modules.py:1680: note: Subclass: lib/galaxy/workflow/modules.py:1680: note: def save_to_step(self, step: Any, **kwd: Any) -> Any ``` --- lib/galaxy/workflow/modules.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index 610f804e0f47..de1b65223309 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -286,7 +286,7 @@ def from_workflow_step(Class, trans, step, **kwds): # ---- Saving in various forms ------------------------------------------ - def save_to_step(self, step, detached=False): + def save_to_step(self, step, detached: bool = False) -> None: step.type = self.type step.tool_inputs = self.get_state() @@ -647,7 +647,7 @@ def from_workflow_step(Class, trans, step, **kwds): module.subworkflow = step.subworkflow return module - def save_to_step(self, step, **kwd): + def save_to_step(self, step, detached=False): step.type = self.type step.subworkflow = self.subworkflow ensure_object_added_to_session(step, object_in_session=self.subworkflow) @@ -1027,7 +1027,7 @@ def step_state_to_tool_state(self, state): state = json.dumps(state) return state - def save_to_step(self, step, **kwd): + def save_to_step(self, step, detached=False): step.type = self.type step.tool_inputs = self._parse_state_into_dict() @@ -1677,7 +1677,7 @@ def _string_to_parameter_def_option(str_value): rval.update({"parameter_type": self.default_parameter_type, "optional": self.default_optional}) return rval - def save_to_step(self, step, **kwd): + def save_to_step(self, step, detached=False): step.type = self.type step.tool_inputs = self._parse_state_into_dict()