mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
improve typing of lib/galaxy/workflow/run.py
lib/galaxy/workflow/run.py:333: error: Item "DatasetCollection" of "Union[HistoryDatasetCollectionAssociation, DatasetCollection]" has no attribute "collection"
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user