Skip to content

Commit 3f5eb22

Browse files
authored
fix scatter and workflow level params (#21)
1 parent aa898e5 commit 3f5eb22

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cwlupgrader/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@ def workflow_clean(document): # type: (MutableMapping[Text, Any]) -> None
101101
step["in"] = ins
102102
del step["inputs"]
103103
if "scatter" in step:
104-
if len(step["scatter"]) == 1:
104+
if isinstance(step["scatter"], (str, Text)) == 1:
105105
step["scatter"] = step["scatter"][step_id_len:]
106-
else:
106+
elif isinstance(step["scatter"], list) and len(step["scatter"]) > 1:
107107
step["scatter"] = [source[step_id_len:] for
108108
source in step["scatter"]]
109+
else:
110+
step["scatter"] = step["scatter"][0][step_id_len:]
109111
if "description" in step:
110112
step["doc"] = step.pop("description")
111113
new_steps[step_id.lstrip('#')] = step
@@ -154,7 +156,7 @@ def hints_and_requirements_clean(document):
154156

155157
def shorten_type(type_obj): # type: (List[Any]) -> Union[Text, List[Any]]
156158
"""Transform draft-3 style type declarations into idiomatic v1.0 types."""
157-
if isinstance(type_obj, Text) or not isinstance(type_obj, Sequence):
159+
if isinstance(type_obj, (str, Text)) or not isinstance(type_obj, Sequence):
158160
return type_obj
159161
new_type = []
160162
for entry in type_obj: # find arrays that we can shorten and do so

0 commit comments

Comments
 (0)