Skip to content

Commit

Permalink
Typing fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Nov 22, 2021
1 parent 3e5efab commit 55380de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions lib/galaxy/managers/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,9 @@ def normalize_workflow_format(self, trans, as_dict):
# create a temporary file for the workflow if it is provided
# as JSON, to make it parseable by the WorkflowProxy
if workflow_path is None:
f = tempfile.NamedTemporaryFile(delete=False)
json.dump(as_dict, f)
workflow_path = f.name
f.close()
with tempfile.NamedTemporaryFile(mode="w+", delete=False) as f:
json.dump(as_dict, f)
workflow_path = f.name
if object_id:
workflow_path += "#" + object_id
wf_proxy = workflow_proxy(workflow_path)
Expand Down
9 changes: 4 additions & 5 deletions lib/galaxy/tools/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import shlex
import tempfile
from typing import Any, cast, Dict, List
from typing import Any, cast, Dict, List, Optional, Union

from galaxy import model
from galaxy.files import ProvidesUserFileSourcesUserContext
Expand Down Expand Up @@ -249,9 +249,8 @@ def wrap_input(input_values, input):
)
input_values[input.name] = wrapper
elif isinstance(input, FieldTypeToolParameter):
if value is None:
field_wrapper = None
else:
field_wrapper: Optional[Union[InputValueWrapper, DatasetFilenameWrapper]] = None
if value:
assert "value" in value, value
assert "src" in value, value
src = value["src"]
Expand All @@ -260,7 +259,7 @@ def wrap_input(input_values, input):
elif src == "hda":
field_wrapper = DatasetFilenameWrapper(value["value"],
datatypes_registry=self.app.datatypes_registry,
tool=self,
tool=self.tool,
name=input.name)
else:
raise ValueError(f"src should be 'json' or 'hda' but is '{src}'")
Expand Down

0 comments on commit 55380de

Please sign in to comment.