Skip to content

Commit

Permalink
more type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Dec 25, 2024
1 parent 910f114 commit 3fbfa1b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion cwl_utils/cwl_v1_0_expression_refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ def traverse_CommandLineTool(
new_clt_step = copy.copy(
step
) # a deepcopy would be convenient, but params2.cwl gives it problems
new_clt_step.id = cast(str, new_clt_step.id).split("#")[-1]
new_clt_step.id = new_clt_step.id.split("#")[-1]
new_clt_step.run = copy.copy(step.run)
new_clt_step.run.id = None
remove_JSReq(new_clt_step.run, skip_command_line1)
Expand Down
2 changes: 1 addition & 1 deletion cwl_utils/cwl_v1_1_expression_refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ def traverse_CommandLineTool(
new_clt_step = copy.copy(
step
) # a deepcopy would be convenient, but params2.cwl gives it problems
new_clt_step.id = cast(str, new_clt_step.id).split("#")[-1]
new_clt_step.id = new_clt_step.id.split("#")[-1]
new_clt_step.run = copy.copy(step.run)
new_clt_step.run.id = None
remove_JSReq(new_clt_step.run, skip_command_line1)
Expand Down
4 changes: 2 additions & 2 deletions cwl_utils/cwl_v1_2_expression_refactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ def process_workflow_inputs_and_outputs(
)
target_type = copy.deepcopy(param2.type_)
if isinstance(target_type, cwl.OutputArraySchema):
target_type.name = None
target_type.name = ""
target = cwl.WorkflowInputParameter(id=None, type_=target_type)
if not isinstance(param2.outputSource, list):
sources = param2.outputSource.split("#")[-1]
Expand Down Expand Up @@ -1520,7 +1520,7 @@ def traverse_CommandLineTool(
new_clt_step = copy.copy(
step
) # a deepcopy would be convenient, but params2.cwl gives it problems
new_clt_step.id = cast(str, new_clt_step.id).split("#")[-1]
new_clt_step.id = new_clt_step.id.split("#")[-1]
new_clt_step.run = copy.copy(step.run)
new_clt_step.run.id = None
remove_JSReq(new_clt_step.run, skip_command_line1)
Expand Down
8 changes: 3 additions & 5 deletions cwl_utils/parser/cwl_v1_0_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def check_all_types(
for src in srcs_of_sink:
check_result = check_types(
type_dict[cast(str, src.id)],
type_dict[cast(str, sink.id)],
type_dict[sink.id],
linkMerge,
getattr(sink, "valueFrom", None),
)
Expand Down Expand Up @@ -312,6 +312,7 @@ def load_inputfile(
baseuri = cwl.file_uri(os.getcwd()) + "/"
if loadingOptions is None:
loadingOptions = cwl.LoadingOptions()

result, metadata = _inputfile_load(
doc,
baseuri,
Expand Down Expand Up @@ -380,10 +381,7 @@ def type_for_step_input(
cwl_utils.parser.utils.convert_stdstreams_to_files(step_run)
if step_run and step_run.inputs:
for step_input in step_run.inputs:
if (
cast(str, step_input.id).split("#")[-1]
== cast(str, in_.id).split("#")[-1]
):
if cast(str, step_input.id).split("#")[-1] == in_.id.split("#")[-1]:
input_type = step_input.type_
if step.scatter is not None and in_.id in aslist(step.scatter):
input_type = cwl.ArraySchema(items=input_type, type_="array")
Expand Down
7 changes: 2 additions & 5 deletions cwl_utils/parser/cwl_v1_1_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def check_all_types(
for src in srcs_of_sink:
check_result = check_types(
type_dict[cast(str, src.id)],
type_dict[cast(str, sink.id)],
type_dict[sink.id],
linkMerge,
getattr(sink, "valueFrom", None),
)
Expand Down Expand Up @@ -397,10 +397,7 @@ def type_for_step_input(
cwl_utils.parser.utils.convert_stdstreams_to_files(step_run)
if step_run and step_run.inputs:
for step_input in step_run.inputs:
if (
cast(str, step_input.id).split("#")[-1]
== cast(str, in_.id).split("#")[-1]
):
if cast(str, step_input.id).split("#")[-1] == in_.id.split("#")[-1]:
input_type = step_input.type_
if step.scatter is not None and in_.id in aslist(step.scatter):
input_type = cwl.ArraySchema(items=input_type, type_="array")
Expand Down
10 changes: 4 additions & 6 deletions cwl_utils/parser/cwl_v1_2_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def check_all_types(
)
if _is_conditional_step(param_to_step, parm_id):
src_typ = aslist(type_dict[src_dict[parm_id].id])
snk_typ = type_dict[cast(str, sink.id)]
snk_typ = type_dict[sink.id]
if "null" not in src_typ:
src_typ = ["null"] + cast(list[Any], src_typ)
if (
Expand All @@ -288,7 +288,7 @@ def check_all_types(
for src in srcs_of_sink:
check_result = check_types(
type_dict[cast(str, src.id)],
type_dict[cast(str, sink.id)],
type_dict[sink.id],
linkMerge,
getattr(sink, "valueFrom", None),
)
Expand Down Expand Up @@ -411,6 +411,7 @@ def load_inputfile(
baseuri = cwl.file_uri(os.getcwd()) + "/"
if loadingOptions is None:
loadingOptions = cwl.LoadingOptions()

result, metadata = _inputfile_load(
doc,
baseuri,
Expand Down Expand Up @@ -479,10 +480,7 @@ def type_for_step_input(
cwl_utils.parser.utils.convert_stdstreams_to_files(step_run)
if step_run and step_run.inputs:
for step_input in step_run.inputs:
if (
cast(str, step_input.id).split("#")[-1]
== cast(str, in_.id).split("#")[-1]
):
if cast(str, step_input.id).split("#")[-1] == in_.id.split("#")[-1]:
input_type = step_input.type_
if step.scatter is not None and in_.id in aslist(step.scatter):
input_type = cwl.ArraySchema(items=input_type, type_="array")
Expand Down

0 comments on commit 3fbfa1b

Please sign in to comment.