diff --git a/lib/galaxy/workflow/run.py b/lib/galaxy/workflow/run.py index 803febfce5c..b6145c1110a 100644 --- a/lib/galaxy/workflow/run.py +++ b/lib/galaxy/workflow/run.py @@ -1,5 +1,6 @@ import logging import uuid +from typing import List, Union from galaxy import model from galaxy.util import ExecutionTimer @@ -270,19 +271,27 @@ class WorkflowProgress: return remaining_steps def replacement_for_input(self, step, input_dict): - replacement = modules.NO_REPLACEMENT + replacement: Union[ + modules.NoReplacement, + model.DatasetCollectionInstance, + List[model.DatasetCollectionInstance], + ] = modules.NO_REPLACEMENT prefixed_name = input_dict["name"] multiple = input_dict["multiple"] if prefixed_name in step.input_connections_by_name: connection = step.input_connections_by_name[prefixed_name] if input_dict["input_type"] == "dataset" and multiple: - replacement = [self.replacement_for_connection(c) for c in connection] + temp = [self.replacement_for_connection(c) for c in connection] # If replacement is just one dataset collection, replace tool # input_dict with dataset collection - tool framework will extract # datasets properly. - if len(replacement) == 1: - if isinstance(replacement[0], model.HistoryDatasetCollectionAssociation): - replacement = replacement[0] + if len(temp) == 1: + if isinstance(temp[0], model.HistoryDatasetCollectionAssociation): + replacement = temp[0] + else: + replacement = temp + else: + replacement = temp else: is_data = input_dict["input_type"] in ["dataset", "dataset_collection"] replacement = self.replacement_for_connection(connection[0], is_data=is_data) @@ -327,7 +336,7 @@ class WorkflowProgress: if not replacement.is_ok: raise modules.CancelWorkflowEvaluation() else: - if not replacement.collection.populated: + if not replacement.collection.populated: # type: ignore raise modules.DelayedWorkflowEvaluation() pending = False for dataset_instance in replacement.dataset_instances: diff --git a/setup.cfg b/setup.cfg index e30be627080..5161894188d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -602,8 +602,6 @@ check_untyped_defs = False check_untyped_defs = False [mypy-galaxy.main] check_untyped_defs = False -[mypy-galaxy.workflow.run] -check_untyped_defs = False [mypy-galaxy.web.framework.middleware.sqldebug] check_untyped_defs = False [mypy-galaxy.tools.recommendations]