Skip to content

Commit edb1b60

Browse files
committed
Typing fixes after rebase
1 parent 3963db7 commit edb1b60

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

lib/galaxy/managers/workflows.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,9 @@ def normalize_workflow_format(self, trans, as_dict):
356356
# create a temporary file for the workflow if it is provided
357357
# as JSON, to make it parseable by the WorkflowProxy
358358
if workflow_path is None:
359-
f = tempfile.NamedTemporaryFile(delete=False)
360-
json.dump(as_dict, f)
361-
workflow_path = f.name
362-
f.close()
359+
with tempfile.NamedTemporaryFile(mode="w+", delete=False) as f:
360+
json.dump(as_dict, f)
361+
workflow_path = f.name
363362
if object_id:
364363
workflow_path += "#" + object_id
365364
wf_proxy = workflow_proxy(workflow_path)

lib/galaxy/tools/evaluation.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import shlex
55
import tempfile
6-
from typing import Any, cast, Dict, List
6+
from typing import Any, cast, Dict, List, Optional, Union
77

88
from galaxy import model
99
from galaxy.files import ProvidesUserFileSourcesUserContext
@@ -249,9 +249,8 @@ def wrap_input(input_values, input):
249249
)
250250
input_values[input.name] = wrapper
251251
elif isinstance(input, FieldTypeToolParameter):
252-
if value is None:
253-
field_wrapper = None
254-
else:
252+
field_wrapper: Optional[Union[InputValueWrapper, DatasetFilenameWrapper]] = None
253+
if value:
255254
assert "value" in value, value
256255
assert "src" in value, value
257256
src = value["src"]
@@ -260,7 +259,7 @@ def wrap_input(input_values, input):
260259
elif src == "hda":
261260
field_wrapper = DatasetFilenameWrapper(value["value"],
262261
datatypes_registry=self.app.datatypes_registry,
263-
tool=self,
262+
tool=self.tool,
264263
name=input.name)
265264
else:
266265
raise ValueError(f"src should be 'json' or 'hda' but is '{src}'")

0 commit comments

Comments
 (0)