|
5 | 5 | from collections.abc import MutableMapping, MutableSequence |
6 | 6 | from io import StringIO |
7 | 7 | from pathlib import Path |
8 | | -from typing import IO, Any, Union, cast |
| 8 | +from typing import Any, IO, cast |
9 | 9 | from urllib.parse import urldefrag |
10 | 10 |
|
11 | 11 | from schema_salad.exceptions import ValidationException |
@@ -48,12 +48,8 @@ def _compare_records( |
48 | 48 | _logger.info( |
49 | 49 | "Record comparison failure for %s and %s\n" |
50 | 50 | "Did not match fields for %s: %s and %s", |
51 | | - cast( |
52 | | - Union[cwl.InputRecordSchema, cwl.CommandOutputRecordSchema], src |
53 | | - ).name, |
54 | | - cast( |
55 | | - Union[cwl.InputRecordSchema, cwl.CommandOutputRecordSchema], sink |
56 | | - ).name, |
| 51 | + cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, src).name, |
| 52 | + cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, sink).name, |
57 | 53 | key, |
58 | 54 | srcfields.get(key), |
59 | 55 | sinkfields.get(key), |
@@ -225,7 +221,7 @@ def check_all_types( |
225 | 221 | continue |
226 | 222 | if sourceField is not None: |
227 | 223 | if isinstance(sourceField, MutableSequence): |
228 | | - linkMerge = sink.linkMerge or ( |
| 224 | + linkMerge: str | None = sink.linkMerge or ( |
229 | 225 | "merge_nested" if len(sourceField) > 1 else None |
230 | 226 | ) |
231 | 227 | if sink.pickValue in ("first_non_null", "the_only_non_null"): |
@@ -525,7 +521,7 @@ def type_for_source( |
525 | 521 | """Determine the type for the given sourcenames.""" |
526 | 522 | scatter_context: list[tuple[int, str] | None] = [] |
527 | 523 | params = param_for_source_id(process, sourcenames, parent, scatter_context) |
528 | | - if not isinstance(params, list): |
| 524 | + if not isinstance(params, MutableSequence): |
529 | 525 | new_type = params.type_ |
530 | 526 | if scatter_context[0] is not None: |
531 | 527 | if scatter_context[0][1] == "nested_crossproduct": |
@@ -580,11 +576,15 @@ def param_for_source_id( |
580 | 576 | sourcenames: str | list[str], |
581 | 577 | parent: cwl.Workflow | None = None, |
582 | 578 | scatter_context: list[tuple[int, str] | None] | None = None, |
583 | | -) -> list[cwl.WorkflowInputParameter] | cwl.WorkflowInputParameter: |
| 579 | +) -> ( |
| 580 | + cwl.CommandInputParameter |
| 581 | + | cwl.WorkflowInputParameter |
| 582 | + | MutableSequence[cwl.CommandInputParameter | cwl.WorkflowInputParameter] |
| 583 | +): |
584 | 584 | """Find the process input parameter that matches one of the given sourcenames.""" |
585 | 585 | if isinstance(sourcenames, str): |
586 | 586 | sourcenames = [sourcenames] |
587 | | - params: list[cwl.WorkflowInputParameter] = [] |
| 587 | + params: MutableSequence[cwl.CommandInputParameter | cwl.WorkflowInputParameter] = [] |
588 | 588 | for sourcename in sourcenames: |
589 | 589 | if not isinstance(process, cwl.Workflow): |
590 | 590 | for param in process.inputs: |
|
0 commit comments