Skip to content

Commit c191642

Browse files
committed
type annotation: mypy2: make build_job_script callable return str
1 parent d4d42aa commit c191642

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cwltool/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self): # type: () -> None
5050
self.pathmapper = None # type: PathMapper
5151
self.stagedir = None # type: Text
5252
self.make_fs_access = None # type: Type[StdFsAccess]
53-
self.build_job_script = None # type: Callable[[List[str]], Text]
53+
self.build_job_script = None # type: Callable[[List[str]], str]
5454
self.debug = False # type: bool
5555
self.mutation_manager = None # type: MutationManager
5656

cwltool/job.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def _execute(self, runtime, env, rm_tmpdir=True, move_outputs="move"):
192192
os.makedirs(dn)
193193
stdout_path = absout
194194

195-
build_job_script = self.builder.build_job_script # type: Callable[[List[str]], Text]
195+
build_job_script = self.builder.build_job_script # type: Callable[[List[str]], str]
196196
rcode = _job_popen(
197197
[Text(x).encode('utf-8') for x in runtime + self.command_line],
198198
stdin_path=stdin_path,
@@ -315,7 +315,7 @@ def add_volumes(self, pathmapper, runtime, stage_output):
315315
shutil.copytree(vol.resolved, vol.target)
316316
elif vol.type == "CreateFile":
317317
createtmp = os.path.join(host_outdir, os.path.basename(vol.target))
318-
with open(createtmp, "w") as f:
318+
with open(createtmp, "wb") as f:
319319
f.write(vol.resolved.encode("utf-8"))
320320
runtime.append(u"--volume=%s:%s:ro" % (createtmp, vol.target))
321321

@@ -399,11 +399,11 @@ def _job_popen(
399399
env, # type: Union[MutableMapping[Text, Text], MutableMapping[str, str]]
400400
cwd, # type: Text
401401
job_dir=None, # type: Text
402-
build_job_script=None, # type: Callable[[List[str]], Text]
402+
build_job_script=None, # type: Callable[[List[str]], str]
403403
):
404404
# type: (...) -> int
405405

406-
job_script_contents = None # type: Text
406+
job_script_contents = None
407407
if build_job_script:
408408
job_script_contents = build_job_script(commands)
409409

0 commit comments

Comments
 (0)