Skip to content

Commit 0ae5377

Browse files
committed
Handled the pickValue in the check_types function to avoid unnecessary warnings.
1 parent ec2f265 commit 0ae5377

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

cwl_utils/parser/cwl_v1_2_utils.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ def check_all_types(
295295
type_dict[cast(str, src.id)],
296296
sink_type,
297297
linkMerge,
298-
sink.pickValue,
299298
getattr(sink, "valueFrom", None),
300299
)
301300
if check_result in ("warning", "exception"):
@@ -309,7 +308,6 @@ def check_types(
309308
srctype: Any,
310309
sinktype: Any,
311310
linkMerge: str | None,
312-
pickValue: str | None = None,
313311
valueFrom: str | None = None,
314312
) -> str:
315313
"""
@@ -319,30 +317,6 @@ def check_types(
319317
"""
320318
if valueFrom is not None:
321319
return "pass"
322-
if pickValue is not None:
323-
if isinstance(srctype, cwl.ArraySchema):
324-
match pickValue:
325-
case "all_non_null":
326-
srctype = cwl.ArraySchema(items=srctype.items, type_="array")
327-
if (
328-
isinstance(srctype.items, MutableSequence)
329-
and "null" in srctype.items
330-
):
331-
srctype.items = [
332-
elem for elem in srctype.items if elem != "null"
333-
]
334-
case "first_non_null" | "the_only_non_null":
335-
if (
336-
isinstance(srctype.items, MutableSequence)
337-
and "null" in srctype.items
338-
):
339-
srctype = [elem for elem in srctype.items if elem != "null"]
340-
else:
341-
srctype = srctype.items
342-
case _:
343-
raise ValidationException(
344-
f"Invalid value {pickValue} for pickValue field."
345-
)
346320
match linkMerge:
347321
case None:
348322
if can_assign_src_to_sink(srctype, sinktype, strict=True):
@@ -356,10 +330,9 @@ def check_types(
356330
sinktype,
357331
None,
358332
None,
359-
None,
360333
)
361334
case "merge_flattened":
362-
return check_types(merge_flatten_type(srctype), sinktype, None, None, None)
335+
return check_types(merge_flatten_type(srctype), sinktype, None, None)
363336
case _:
364337
raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.")
365338

0 commit comments

Comments
 (0)