Skip to content

Commit b828a75

Browse files
committed
Fix update
1 parent 156391d commit b828a75

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

cwltool/update.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,19 @@ def rewrite_requirements(t: CWLObjectType) -> None:
104104
if cls in rewrite:
105105
r["class"] = rewrite[cls]
106106
if "hints" in t:
107-
for r in cast(MutableSequence[CWLObjectType], t["hints"]):
108-
cls = cast(str, r["class"])
109-
if cls in rewrite:
110-
r["class"] = rewrite[cls]
107+
for index, r in enumerate(cast(MutableSequence[CWLObjectType], t["hints"])):
108+
if isinstance(r, MutableMapping):
109+
if "class" not in r:
110+
raise SourceLine(r, None, ValidationException).makeError(
111+
"'hints' entry missing required key 'class'."
112+
)
113+
cls = cast(str, r["class"])
114+
if cls in rewrite:
115+
r["class"] = rewrite[cls]
116+
else:
117+
raise SourceLine(t["hints"], index, ValidationException).makeError(
118+
f"'hints' entries must be dictionaries: {type(r)} {r}."
119+
)
111120
if "steps" in t:
112121
for s in cast(MutableSequence[CWLObjectType], t["steps"]):
113122
rewrite_requirements(s)

0 commit comments

Comments
 (0)