From 09966d496cdd4761c8e1ad2cb087e7a442f0bfc4 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Thu, 18 Dec 2025 22:12:41 +0100 Subject: [PATCH 01/23] Typed CWL parsers --- .gitignore | 3 + src/cwl_utils/cite_extract.py | 2 +- src/cwl_utils/cwl_v1_0_expression_refactor.py | 3 +- src/cwl_utils/cwl_v1_1_expression_refactor.py | 2 +- src/cwl_utils/cwl_v1_2_expression_refactor.py | 2 +- src/cwl_utils/docker_extract.py | 4 +- src/cwl_utils/inputs_schema_gen.py | 18 +- src/cwl_utils/parser/__init__.py | 6 + src/cwl_utils/parser/cwl_v1_0.py | 4177 +++++++------- src/cwl_utils/parser/cwl_v1_0_utils.py | 4 +- src/cwl_utils/parser/cwl_v1_1.py | 4458 ++++++++------- src/cwl_utils/parser/cwl_v1_1_utils.py | 7 +- src/cwl_utils/parser/cwl_v1_2.py | 4899 +++++++++-------- src/cwl_utils/parser/cwl_v1_2_utils.py | 5 +- src/cwl_utils/parser/utils.py | 11 +- src/cwl_utils/tests/test_parser_utils.py | 12 + src/cwl_utils/tests/test_subscope.py | 5 +- 17 files changed, 7212 insertions(+), 6406 deletions(-) diff --git a/.gitignore b/.gitignore index 0900bed7..376eb398 100644 --- a/.gitignore +++ b/.gitignore @@ -111,6 +111,9 @@ testenv*/ # PyCharm .idea/ +# UV +uv.lock + # Backup files *.orig *~ diff --git a/src/cwl_utils/cite_extract.py b/src/cwl_utils/cite_extract.py index d35081d5..e7ff61c6 100755 --- a/src/cwl_utils/cite_extract.py +++ b/src/cwl_utils/cite_extract.py @@ -33,7 +33,7 @@ def main() -> int: def extract_software_reqs( - process: cwl.Process, + process: cwl.Process | cwl.WorkflowStep, ) -> Iterator[cwl.SoftwareRequirement]: """Return an iterator over any SoftwareRequirements found in the given process.""" if process.requirements: diff --git a/src/cwl_utils/cwl_v1_0_expression_refactor.py b/src/cwl_utils/cwl_v1_0_expression_refactor.py index 1446319a..1a21aac8 100755 --- a/src/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_0_expression_refactor.py @@ -1242,7 +1242,7 @@ def traverse_CommandLineTool( """Extract any CWL Expressions within the given CommandLineTool into sibling steps.""" modified = False # don't modify clt, modify step.run - target_clt = step.run + target_clt = cast(cwl.CommandLineTool, step.run) inputs = empty_inputs(clt) if not step.id: return False @@ -1466,6 +1466,7 @@ def traverse_CommandLineTool( inp.linkMerge = None for index, out in enumerate(new_clt_step.out): new_clt_step.out[index] = out.split("/")[-1] + for tool_inp in new_clt_step.run.inputs: tool_inp.id = tool_inp.id.split("#")[-1] for tool_out in new_clt_step.run.outputs: diff --git a/src/cwl_utils/cwl_v1_1_expression_refactor.py b/src/cwl_utils/cwl_v1_1_expression_refactor.py index 1bedf4c2..453e4124 100755 --- a/src/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_1_expression_refactor.py @@ -1244,7 +1244,7 @@ def traverse_CommandLineTool( """Extract any CWL Expressions within the given CommandLineTool into sibling steps.""" modified = False # don't modify clt, modify step.run - target_clt = step.run + target_clt = cast(cwl.CommandLineTool, step.run) inputs = empty_inputs(clt) if not step.id: return False diff --git a/src/cwl_utils/cwl_v1_2_expression_refactor.py b/src/cwl_utils/cwl_v1_2_expression_refactor.py index 1fd73d74..1b667304 100755 --- a/src/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_2_expression_refactor.py @@ -1347,7 +1347,7 @@ def traverse_CommandLineTool( """Extract any CWL Expressions within the given CommandLineTool into sibling steps.""" modified = False # don't modify clt, modify step.run - target_clt = step.run + target_clt = cast(cwl.CommandLineTool, step.run) inputs = empty_inputs(clt) if not step.id: return False diff --git a/src/cwl_utils/docker_extract.py b/src/cwl_utils/docker_extract.py index f67163d0..6fa7528d 100755 --- a/src/cwl_utils/docker_extract.py +++ b/src/cwl_utils/docker_extract.py @@ -102,7 +102,9 @@ def extract_docker_requirements( yield req -def extract_docker_reqs(process: cwl.Process) -> Iterator[cwl.DockerRequirement]: +def extract_docker_reqs( + process: cwl.Process | cwl.WorkflowStep, +) -> Iterator[cwl.DockerRequirement]: """For the given process, extract the DockerRequirement(s).""" if process.requirements: for req in process.requirements: diff --git a/src/cwl_utils/inputs_schema_gen.py b/src/cwl_utils/inputs_schema_gen.py index a3592a5e..ad3389e0 100644 --- a/src/cwl_utils/inputs_schema_gen.py +++ b/src/cwl_utils/inputs_schema_gen.py @@ -13,7 +13,7 @@ from copy import deepcopy from importlib.resources import files from pathlib import Path -from typing import Any, TypeGuard +from typing import Any, TypeGuard, cast from urllib.parse import urlparse import requests @@ -27,6 +27,7 @@ InputEnumSchema, InputRecordSchema, InputRecordSchemaTypes, + SchemaDefRequirement, Workflow, WorkflowInputParameter, cwl_v1_0, @@ -403,12 +404,15 @@ def get_complex_schema_values(idx_iter: str) -> InputRecordSchema: if cwl_obj.requirements is not None: with suppress(StopIteration): - schema_def_requirement = next( - filter( - lambda requirement_iter: requirement_iter.class_ - == "SchemaDefRequirement", - cwl_obj.requirements, - ) + schema_def_requirement = cast( + SchemaDefRequirement, + next( + filter( + lambda requirement_iter: requirement_iter.class_ + == "SchemaDefRequirement", + cwl_obj.requirements, + ) + ), ) workflow_schema_definitions_list.extend( diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index 6e105072..3ff92077 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -238,6 +238,12 @@ class NoType(ABC): | cwl_v1_2.WorkflowStepInput ) """Type Union for a CWL v1.x LoadContents object.""" +SchemaDefRequirement: TypeAlias = ( + cwl_v1_0.SchemaDefRequirement + | cwl_v1_1.SchemaDefRequirement + | cwl_v1_2.SchemaDefRequirement +) +"""Type Union for a CWL v1.x SchemaDefRequirement object.""" _Loader: TypeAlias = cwl_v1_0._Loader | cwl_v1_1._Loader | cwl_v1_2._Loader """Type union for a CWL v1.x _Loader.""" diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 7f3110dd..4aedf527 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -3,18 +3,24 @@ # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. +from __future__ import annotations + import copy import logging import os import pathlib +import sys import tempfile import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec -from abc import ABC, abstractmethod +from abc import ABCMeta, abstractmethod from collections.abc import MutableMapping, MutableSequence, Sequence +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import trait +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,28 @@ from schema_salad.sourceline import SourceLine, add_lc_filename from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ -_vocab: dict[str, str] = {} -_rvocab: dict[str, str] = {} +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} _logger: Final = logging.getLogger("salad") -IdxType = MutableMapping[str, tuple[Any, "LoadingOptions"]] +IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +S = TypeVar("S", bound="Saveable") class LoadingOptions: idx: Final[IdxType] - fileuri: Final[Optional[str]] + fileuri: Final[str | None] baseuri: Final[str] namespaces: Final[MutableMapping[str, str]] schemas: Final[MutableSequence[str]] - original_doc: Final[Optional[Any]] + original_doc: Final[Any | None] addl_metadata: Final[MutableMapping[str, Any]] fetcher: Final[Fetcher] vocab: Final[dict[str, str]] @@ -50,24 +62,24 @@ class LoadingOptions: cache: Final[CacheType] imports: Final[list[str]] includes: Final[list[str]] - no_link_check: Final[Optional[bool]] - container: Final[Optional[str]] + no_link_check: Final[bool | None] + container: Final[str | None] def __init__( self, - fetcher: Optional[Fetcher] = None, - namespaces: Optional[dict[str, str]] = None, - schemas: Optional[list[str]] = None, - fileuri: Optional[str] = None, - copyfrom: Optional["LoadingOptions"] = None, - original_doc: Optional[Any] = None, - addl_metadata: Optional[dict[str, str]] = None, - baseuri: Optional[str] = None, - idx: Optional[IdxType] = None, - imports: Optional[list[str]] = None, - includes: Optional[list[str]] = None, - no_link_check: Optional[bool] = None, - container: Optional[str] = None, + fetcher: Fetcher | None = None, + namespaces: dict[str, str] | None = None, + schemas: list[str] | None = None, + fileuri: str | None = None, + copyfrom: LoadingOptions | None = None, + original_doc: Any | None = None, + addl_metadata: dict[str, str] | None = None, + baseuri: str | None = None, + idx: IdxType | None = None, + imports: list[str] | None = None, + includes: list[str] | None = None, + no_link_check: bool | None = None, + container: str | None = None, ) -> None: """Create a LoadingOptions object.""" self.original_doc = original_doc @@ -79,7 +91,7 @@ def __init__( self.idx = temp_idx if fileuri is not None: - temp_fileuri: Optional[str] = fileuri + temp_fileuri: str | None = fileuri else: temp_fileuri = copyfrom.fileuri if copyfrom is not None else None self.fileuri = temp_fileuri @@ -121,13 +133,13 @@ def __init__( self.includes = temp_includes if no_link_check is not None: - temp_no_link_check: Optional[bool] = no_link_check + temp_no_link_check: bool | None = no_link_check else: temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False self.no_link_check = temp_no_link_check if container is not None: - temp_container: Optional[str] = container + temp_container: str | None = container else: temp_container = copyfrom.container if copyfrom is not None else None self.container = temp_container @@ -201,7 +213,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@trait +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +224,8 @@ def fromDoc( _doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - ) -> "Saveable": + docRoot: str | None = None, + ) -> Self: """Construct this object from the result of yaml.load().""" @abstractmethod @@ -223,11 +236,11 @@ def save( def load_field( - val: Union[str, dict[str, str]], + val: Any | None, fieldtype: "_Loader", baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, + lc: Any | None = None, ) -> Any: """Load field.""" if isinstance(val, MutableMapping): @@ -251,7 +264,9 @@ def load_field( return fieldtype.load(val, baseuri, loadingOptions, lc=lc) -save_type = Optional[Union[MutableMapping[str, Any], MutableSequence[Any], int, float, bool, str]] +save_type: TypeAlias = ( + None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -367,7 +382,7 @@ def expand_url( loadingOptions: LoadingOptions, scoped_id: bool = False, vocab_term: bool = False, - scoped_ref: Optional[int] = None, + scoped_ref: int | None = None, ) -> str: if url in ("@id", "@type"): return url @@ -434,9 +449,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> Any | None: pass @@ -446,8 +461,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if doc is not None: return doc @@ -455,7 +470,7 @@ def load( class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: + def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: self.tp: Final = tp def load( @@ -463,8 +478,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") @@ -483,9 +498,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> list[Any]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -535,9 +550,9 @@ class _MapLoader(_Loader): def __init__( self, values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + name: str | None = None, + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.values: Final = values self.name: Final = name @@ -549,9 +564,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> dict[str, Any]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -584,11 +599,11 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if doc in self.symbols: - return doc + return cast(str, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -604,75 +619,76 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: r: Final[list[dict[str, Any]]] = [] - if isinstance(doc, MutableSequence): - for d in doc: - if isinstance(d, str): - if d.endswith("?"): - r.append({"pattern": d[:-1], "required": False}) - else: - r.append({"pattern": d}) - elif isinstance(d, dict): - new_dict1: dict[str, Any] = {} - dict_copy = copy.deepcopy(d) - if "pattern" in dict_copy: - new_dict1["pattern"] = dict_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {d}" + match doc: + case MutableSequence() as dlist: + for d in dlist: + if isinstance(d, str): + if d.endswith("?"): + r.append({"pattern": d[:-1], "required": False}) + else: + r.append({"pattern": d}) + elif isinstance(d, dict): + new_dict1: dict[str, Any] = {} + dict_copy = copy.deepcopy(d) + if "pattern" in dict_copy: + new_dict1["pattern"] = dict_copy.pop("pattern") + else: + raise ValidationException( + f"Missing pattern in secondaryFiles specification entry: {d}" + ) + new_dict1["required"] = ( + dict_copy.pop("required") if "required" in dict_copy else None ) - new_dict1["required"] = ( - dict_copy.pop("required") if "required" in dict_copy else None - ) - if len(dict_copy): - raise ValidationException( - "Unallowed values in secondaryFiles specification entry: {}".format( - dict_copy + if len(dict_copy): + raise ValidationException( + "Unallowed values in secondaryFiles specification entry: {}".format( + dict_copy + ) ) - ) - r.append(new_dict1) + r.append(new_dict1) + else: + raise ValidationException( + "Expected a string or sequence of (strings or mappings)." + ) + case MutableMapping() as decl: + new_dict2 = {} + doc_copy = copy.deepcopy(decl) + if "pattern" in doc_copy: + new_dict2["pattern"] = doc_copy.pop("pattern") else: raise ValidationException( - "Expected a string or sequence of (strings or mappings)." + f"Missing pattern in secondaryFiles specification entry: {decl}" ) - elif isinstance(doc, MutableMapping): - new_dict2: Final = {} - doc_copy: Final = copy.deepcopy(doc) - if "pattern" in doc_copy: - new_dict2["pattern"] = doc_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {doc}" - ) - new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None + new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None - if len(doc_copy): - raise ValidationException( - f"Unallowed values in secondaryFiles specification entry: {doc_copy}" - ) - r.append(new_dict2) + if len(doc_copy): + raise ValidationException( + f"Unallowed values in secondaryFiles specification entry: {doc_copy}" + ) + r.append(new_dict2) - elif isinstance(doc, str): - if doc.endswith("?"): - r.append({"pattern": doc[:-1], "required": False}) - else: - r.append({"pattern": doc}) - else: - raise ValidationException("Expected str or sequence of str") + case str(decl): + if decl.endswith("?"): + r.append({"pattern": decl[:-1], "required": False}) + else: + r.append({"pattern": decl}) + case _: + raise ValidationException("Expected str or sequence of str") return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader): +class _RecordLoader(_Loader, Generic[S]): def __init__( self, - classtype: type[Saveable], - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + classtype: type[S], + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.classtype: Final = classtype self.container: Final = container @@ -683,9 +699,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> S: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -710,19 +726,20 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if not isinstance(doc, str): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " f"but valid type for this field is a str." ) - return doc + else: + return doc class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: Optional[str] = None) -> None: + def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name @@ -734,8 +751,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: errors: Final = [] @@ -817,8 +834,8 @@ def __init__( inner: _Loader, scoped_id: bool, vocab_term: bool, - scoped_ref: Optional[int], - no_link_check: Optional[bool], + scoped_ref: int | None, + no_link_check: bool | None, ) -> None: self.inner: Final = inner self.scoped_id: Final = scoped_id @@ -831,39 +848,40 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check ) - if isinstance(doc, MutableSequence): - newdoc: Final = [] - for i in doc: - if isinstance(i, str): - newdoc.append( - expand_url( - i, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) - ) - else: - newdoc.append(i) - doc = newdoc - elif isinstance(doc, str): - doc = expand_url( - doc, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) + match doc: + case MutableSequence() as decl: + newdoc: Final = [] + for i in decl: + if isinstance(i, str): + newdoc.append( + expand_url( + i, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) + ) + else: + newdoc.append(i) + doc = newdoc + case str(decl): + doc = expand_url( + decl, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) if isinstance(doc, str): if not loadingOptions.no_link_check: errors: Final = [] @@ -880,7 +898,7 @@ def load( class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: + def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +908,7 @@ def resolve( doc: str, baseuri: str, loadingOptions: LoadingOptions, - ) -> Union[list[Union[dict[str, Any], str]], dict[str, Any], str]: + ) -> list[dict[str, Any] | str] | dict[str, Any] | str: doc_ = doc optional = False if doc_.endswith("?"): @@ -899,7 +917,7 @@ def resolve( if doc_.endswith("[]"): salad_versions: Final = [int(v) for v in self.salad_version[1:].split(".")] - items: Union[list[Union[dict[str, Any], str]], dict[str, Any], str] = "" + items: list[dict[str, Any] | str] | dict[str, Any] | str = "" rest: Final = doc_[0:-2] if salad_versions < [1, 3]: if rest.endswith("[]"): @@ -911,7 +929,7 @@ def resolve( items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) - expanded: Union[dict[str, Any], str] = {"type": "array", "items": items} + expanded: dict[str, Any] | str = {"type": "array", "items": items} else: expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) @@ -925,8 +943,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] @@ -950,7 +968,7 @@ def load( class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: + def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,8 +978,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] @@ -990,10 +1008,10 @@ def load( def _document_load( loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( @@ -1062,7 +1080,7 @@ def _document_load_by_url( loader: _Loader, url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1135,7 @@ def save_relative_uri( uri: Any, base_url: str, scoped_id: bool, - ref_scope: Optional[int], + ref_scope: int | None, relative_uris: bool, ) -> Any: """Convert any URI to a relative one, obeying the scoping rules.""" @@ -1168,6 +1186,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_0" +@trait class Documented(Saveable): pass @@ -1179,26 +1198,6 @@ class RecordField(Documented): name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, RecordField): return bool( @@ -1217,8 +1216,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1376,7 +1375,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1401,8 +1400,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -1441,16 +1440,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class RecordSchema(Saveable): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1460,9 +1456,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -1477,8 +1478,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1580,7 +1581,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1640,24 +1641,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) - - -class EnumSchema(Saveable): - """ - Define an enumerated type. - - """ - - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[RecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1667,10 +1656,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1688,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1849,7 +1848,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1874,7 +1873,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, extension_fields=extension_fields, @@ -1913,16 +1912,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type"]) - - -class ArraySchema(Saveable): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1932,9 +1928,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) + + +class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -1949,8 +1950,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2053,7 +2054,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2112,16 +2113,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class MapSchema(Saveable): def __init__( self, - type_: Any, - values: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2128,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items self.type_ = type_ - self.values = values + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): return bool(self.type_ == other.type_ and self.values == other.values) @@ -2148,8 +2149,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MapSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2252,7 +2253,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2311,16 +2312,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["type", "values"]) - - -class UnionSchema(Saveable): def __init__( self, - names: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["map"], + values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2330,9 +2327,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names self.type_ = type_ + self.values = values + + attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + +class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): return bool(self.names == other.names and self.type_ == other.type_) @@ -2347,8 +2348,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "UnionSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2451,7 +2452,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2510,16 +2511,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["names", "type"]) - - -class CWLArraySchema(ArraySchema): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["union"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2526,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.names = names self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + + +class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -2546,8 +2547,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2650,7 +2651,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2709,19 +2710,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class CWLRecordField(RecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2725,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2752,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2912,7 +2911,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2937,8 +2936,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -2977,16 +2976,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class CWLRecordSchema(RecordSchema): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2996,9 +2992,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -3013,8 +3014,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3116,7 +3117,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3176,7 +3177,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Literal["record"], + fields: None | Sequence[CWLRecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.fields = fields + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) class File(Saveable): @@ -3250,43 +3269,6 @@ class File(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - dirname: Optional[Any] = None, - nameroot: Optional[Any] = None, - nameext: Optional[Any] = None, - checksum: Optional[Any] = None, - size: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - format: Optional[Any] = None, - contents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents - def __eq__(self, other: Any) -> bool: if isinstance(other, File): return bool( @@ -3329,8 +3311,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "File": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3687,7 +3669,7 @@ def fromDoc( try: size = load_field( _doc.get("size"), - union_of_None_type_or_inttype, + union_of_None_type_or_inttype_or_inttype, baseuri, loadingOptions, lc=_doc.get("size") @@ -3870,7 +3852,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3983,7 +3965,44 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | int = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "location", @@ -4049,29 +4068,6 @@ class Directory(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - listing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing - def __eq__(self, other: Any) -> bool: if isinstance(other, Directory): return bool( @@ -4094,8 +4090,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Directory": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4306,7 +4302,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4382,13 +4378,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "location", "path", "basename", "listing"]) + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) +@trait class SchemaBase(Saveable): pass +@trait class Parameter(SchemaBase): """ Define an input or output parameter to a process. @@ -4398,18 +4421,22 @@ class Parameter(SchemaBase): pass +@trait class InputBinding(Saveable): pass +@trait class OutputBinding(Saveable): pass +@trait class InputSchema(SchemaBase): pass +@trait class OutputSchema(SchemaBase): pass @@ -4417,30 +4444,6 @@ class OutputSchema(SchemaBase): class InputRecordField(CWLRecordField): name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - inputBinding: Optional[Any] = None, - label: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.inputBinding = inputBinding - self.label = label - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): return bool( @@ -4461,8 +4464,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4714,7 +4717,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4739,8 +4742,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, inputBinding=inputBinding, label=label, @@ -4792,20 +4795,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type", "inputBinding", "label"]) - - -class InputRecordSchema(CWLRecordSchema, InputSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + label: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -4815,10 +4813,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + self.inputBinding = inputBinding self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "inputBinding", "label"] + ) + + +class InputRecordSchema(CWLRecordSchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordSchema): @@ -4839,8 +4846,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5045,7 +5052,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5070,10 +5077,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5115,21 +5122,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "name"]) - - -class InputEnumSchema(EnumSchema, InputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5139,11 +5139,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +class InputEnumSchema(EnumSchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5167,8 +5172,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5421,7 +5426,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5446,7 +5451,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -5498,18 +5503,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "inputBinding"]) - - -class InputArraySchema(CWLArraySchema, InputSchema): def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5519,11 +5521,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "inputBinding"] + ) + + +class InputArraySchema(CWLArraySchema, InputSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): return bool( @@ -5543,8 +5552,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5741,7 +5750,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5813,20 +5822,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "inputBinding"]) - - -class OutputRecordField(CWLRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5836,10 +5839,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ - self.outputBinding = outputBinding + self.label = label + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "inputBinding"] + ) + + +class OutputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -5860,8 +5871,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6066,7 +6077,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6091,8 +6102,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, @@ -6139,17 +6150,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type", "outputBinding"]) - - -class OutputRecordSchema(CWLRecordSchema, OutputSchema): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6159,10 +6167,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ - self.label = label + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "outputBinding"] + ) + +class OutputRecordSchema(CWLRecordSchema, OutputSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): return bool( @@ -6181,8 +6196,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6331,7 +6346,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6396,21 +6411,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label"]) - - -class OutputEnumSchema(EnumSchema, OutputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[OutputRecordField] = None, + label: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6420,11 +6427,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label - self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label"]) + + +class OutputEnumSchema(EnumSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -6448,8 +6459,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6702,7 +6713,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6727,7 +6738,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -6779,18 +6790,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "outputBinding"]) - - -class OutputArraySchema(CWLArraySchema, OutputSchema): def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6800,11 +6808,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.outputBinding = outputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "outputBinding"] + ) + + +class OutputArraySchema(CWLArraySchema, OutputSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): return bool( @@ -6824,8 +6839,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7022,7 +7037,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7094,25 +7109,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "outputBinding"]) - - -class InputParameter(Parameter): - id: str - def __init__( self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - inputBinding: Optional[Any] = None, - default: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Literal["array"], + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7122,15 +7126,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.inputBinding = inputBinding - self.default = default + self.items = items self.type_ = type_ + self.label = label + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "outputBinding"] + ) + + +class InputParameter(Parameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputParameter): @@ -7168,8 +7175,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7608,7 +7615,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7633,11 +7640,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, inputBinding=inputBinding, default=default, @@ -7711,35 +7718,19 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "inputBinding", - "default", - "type", - ] - ) - - -class OutputParameter(Parameter): - id: str - def __init__( self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + default: CWLObjectType | None = None, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7753,9 +7744,29 @@ def __init__( self.secondaryFiles = secondaryFiles self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.outputBinding = outputBinding + self.id = id self.format = format + self.inputBinding = inputBinding + self.default = default + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "inputBinding", + "default", + "type", + ] + ) + + +class OutputParameter(Parameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputParameter): @@ -7789,8 +7800,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8135,7 +8146,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8160,11 +8171,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, extension_fields=extension_fields, @@ -8228,7 +8239,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -8241,6 +8280,7 @@ def save( ) +@trait class ProcessRequirement(Saveable): """ A process requirement declares a prerequisite that may or must be fulfilled @@ -8255,6 +8295,7 @@ class ProcessRequirement(Saveable): pass +@trait class Process(Saveable): """ @@ -8275,23 +8316,6 @@ class InlineJavascriptRequirement(ProcessRequirement): """ - def __init__( - self, - expressionLib: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "InlineJavascriptRequirement" - self.expressionLib = expressionLib - def __eq__(self, other: Any) -> bool: if isinstance(other, InlineJavascriptRequirement): return bool( @@ -8309,8 +8333,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InlineJavascriptRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8380,7 +8404,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8446,7 +8470,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "expressionLib"]) + def __init__( + self, + expressionLib: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.expressionLib = expressionLib + + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) class SchemaDefRequirement(ProcessRequirement): @@ -8461,23 +8502,6 @@ class SchemaDefRequirement(ProcessRequirement): """ - def __init__( - self, - types: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SchemaDefRequirement" - self.types = types - def __eq__(self, other: Any) -> bool: if isinstance(other, SchemaDefRequirement): return bool(self.class_ == other.class_ and self.types == other.types) @@ -8492,8 +8516,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SchemaDefRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8564,7 +8588,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8627,23 +8651,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "types"]) - - -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ - def __init__( self, - envName: Any, - envValue: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + types: Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8653,8 +8665,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + + +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment + by the workflow platform when executing the command line tool. May be the + result of executing an expression, such as getting a parameter from input. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8672,8 +8695,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvironmentDef": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8776,7 +8799,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8836,7 +8859,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["envName", "envValue"]) + def __init__( + self, + envName: str, + envValue: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.envName = envName + self.envValue = envValue + + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) class CommandLineBinding(InputBinding): @@ -8879,34 +8920,6 @@ class CommandLineBinding(InputBinding): """ - def __init__( - self, - loadContents: Optional[Any] = None, - position: Optional[Any] = None, - prefix: Optional[Any] = None, - separate: Optional[Any] = None, - itemSeparator: Optional[Any] = None, - valueFrom: Optional[Any] = None, - shellQuote: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineBinding): return bool( @@ -8939,8 +8952,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9276,7 +9289,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9373,7 +9386,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | int = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote + + attrs: ClassVar[Collection[str]] = frozenset( [ "loadContents", "position", @@ -9401,26 +9442,6 @@ class CommandOutputBinding(OutputBinding): """ - def __init__( - self, - glob: Optional[Any] = None, - loadContents: Optional[Any] = None, - outputEval: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.glob = glob - self.loadContents = loadContents - self.outputEval = outputEval - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputBinding): return bool( @@ -9439,8 +9460,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9588,7 +9609,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9659,21 +9680,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["glob", "loadContents", "outputEval"]) - - -class CommandInputRecordField(InputRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - inputBinding: Optional[Any] = None, - label: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + glob: None | Sequence[str] | str = None, + loadContents: None | bool = None, + outputEval: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -9683,11 +9696,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.inputBinding = inputBinding - self.label = label + self.glob = glob + self.loadContents = loadContents + self.outputEval = outputEval + + attrs: ClassVar[Collection[str]] = frozenset(["glob", "loadContents", "outputEval"]) + + +class CommandInputRecordField(InputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9709,8 +9726,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9962,7 +9979,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9987,8 +10004,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, inputBinding=inputBinding, label=label, @@ -10040,20 +10057,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type", "inputBinding", "label"]) - - -class CommandInputRecordSchema(InputRecordSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + label: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -10063,10 +10075,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + self.inputBinding = inputBinding self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "inputBinding", "label"] + ) + + +class CommandInputRecordSchema(InputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordSchema): @@ -10087,8 +10108,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10293,7 +10314,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10318,10 +10339,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -10363,21 +10384,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "name"]) - - -class CommandInputEnumSchema(InputEnumSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[CommandInputRecordField] = None, + label: None | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -10387,11 +10401,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +class CommandInputEnumSchema(InputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): @@ -10415,8 +10434,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10669,7 +10688,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10694,7 +10713,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -10746,18 +10765,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "inputBinding"]) - - -class CommandInputArraySchema(InputArraySchema): def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -10767,11 +10783,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "inputBinding"] + ) + + +class CommandInputArraySchema(InputArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -10791,8 +10814,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10989,7 +11012,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11061,20 +11084,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "inputBinding"]) - - -class CommandOutputRecordField(OutputRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11084,10 +11101,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ - self.outputBinding = outputBinding + self.label = label + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "inputBinding"] + ) + + +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11108,8 +11133,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11314,7 +11339,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11339,8 +11364,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, @@ -11387,20 +11412,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type", "outputBinding"]) - - -class CommandOutputRecordSchema(OutputRecordSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11410,10 +11429,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "outputBinding"] + ) + + +class CommandOutputRecordSchema(OutputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordSchema): @@ -11434,8 +11461,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11640,7 +11667,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11665,10 +11692,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -11710,21 +11737,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "name"]) - - -class CommandOutputEnumSchema(OutputEnumSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[CommandOutputRecordField] = None, + label: None | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11734,11 +11754,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label - self.outputBinding = outputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + + +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -11762,8 +11787,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12016,7 +12041,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12041,7 +12066,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -12093,18 +12118,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "outputBinding"]) - - -class CommandOutputArraySchema(OutputArraySchema): def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12114,11 +12136,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.outputBinding = outputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "outputBinding"] + ) + + +class CommandOutputArraySchema(OutputArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): return bool( @@ -12138,8 +12167,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12336,7 +12365,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12408,29 +12437,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "outputBinding"]) - - -class CommandInputParameter(InputParameter): - """ - An input parameter for a CommandLineTool. - """ - - id: str - def __init__( self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - inputBinding: Optional[Any] = None, - default: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12440,15 +12454,22 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.inputBinding = inputBinding - self.default = default + self.items = items self.type_ = type_ + self.label = label + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "outputBinding"] + ) + + +class CommandInputParameter(InputParameter): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -12486,8 +12507,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12926,7 +12947,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12951,11 +12972,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, inputBinding=inputBinding, default=default, @@ -13029,7 +13050,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + default: CWLObjectType | None = None, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.inputBinding = inputBinding + self.default = default + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -13051,36 +13104,6 @@ class CommandOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - format: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.outputBinding = outputBinding - self.format = format - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputParameter): return bool( @@ -13115,8 +13138,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13508,7 +13531,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13533,11 +13556,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, type_=type_, @@ -13606,7 +13629,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | None | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -13628,53 +13681,6 @@ class CommandLineTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - id: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - baseCommand: Optional[Any] = None, - arguments: Optional[Any] = None, - stdin: Optional[Any] = None, - stderr: Optional[Any] = None, - stdout: Optional[Any] = None, - successCodes: Optional[Any] = None, - temporaryFailCodes: Optional[Any] = None, - permanentFailCodes: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_ = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineTool): return bool( @@ -13727,8 +13733,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -14514,7 +14520,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14539,7 +14545,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), inputs=inputs, outputs=outputs, requirements=requirements, @@ -14666,7 +14672,54 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[int] = None, + temporaryFailCodes: None | Sequence[int] = None, + permanentFailCodes: None | Sequence[int] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion + self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -14727,33 +14780,6 @@ class DockerRequirement(ProcessRequirement): """ - def __init__( - self, - dockerPull: Optional[Any] = None, - dockerLoad: Optional[Any] = None, - dockerFile: Optional[Any] = None, - dockerImport: Optional[Any] = None, - dockerImageId: Optional[Any] = None, - dockerOutputDirectory: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory - def __eq__(self, other: Any) -> bool: if isinstance(other, DockerRequirement): return bool( @@ -14786,8 +14812,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "DockerRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15092,7 +15118,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15198,7 +15224,34 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "dockerPull", @@ -15218,23 +15271,6 @@ class SoftwareRequirement(ProcessRequirement): """ - def __init__( - self, - packages: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SoftwareRequirement" - self.packages = packages - def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwareRequirement): return bool(self.class_ == other.class_ and self.packages == other.packages) @@ -15249,8 +15285,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwareRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15321,7 +15357,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15384,17 +15420,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "packages"]) - - -class SoftwarePackage(Saveable): def __init__( self, - package: Any, - version: Optional[Any] = None, - specs: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + packages: Sequence[SoftwarePackage], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -15404,10 +15434,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.packages = packages + + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -15426,8 +15459,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwarePackage": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15576,7 +15609,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15640,25 +15673,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["package", "version", "specs"]) - - -class Dirent(Saveable): - """ - Define a file or subdirectory that must be placed in the designated output - directory prior to executing the command line tool. May be the result of - executing an expression, such as building a configuration file from a - template. - - """ - def __init__( self, - entry: Any, - entryname: Optional[Any] = None, - writable: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -15668,9 +15689,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.package = package + self.version = version + self.specs = specs + + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) + + +class Dirent(Saveable): + """ + Define a file or subdirectory that must be placed in the designated output + directory prior to executing the command line tool. May be the result of + executing an expression, such as building a configuration file from a + template. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, Dirent): @@ -15690,8 +15723,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Dirent": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15840,7 +15873,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15908,19 +15941,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["entryname", "entry", "writable"]) - - -class InitialWorkDirRequirement(ProcessRequirement): - """ - Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. - """ - def __init__( self, - listing: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + entry: str, + entryname: None | str = None, + writable: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -15930,8 +15957,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InitialWorkDirRequirement" - self.listing = listing + self.entryname = entryname + self.entry = entry + self.writable = writable + + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + + +class InitialWorkDirRequirement(ProcessRequirement): + """ + Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. + """ def __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -15947,8 +15983,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InitialWorkDirRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16019,7 +16055,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16082,21 +16118,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "listing"]) - - -class EnvVarRequirement(ProcessRequirement): - """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. - - """ - def __init__( self, - envDef: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + listing: Sequence[Directory | Dirent | File | str] | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16106,8 +16132,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + + +class EnvVarRequirement(ProcessRequirement): + """ + Define a list of environment variables which will be set in the + execution environment of the tool. See `EnvironmentDef` for details. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -16123,8 +16159,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvVarRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16195,7 +16231,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16258,7 +16294,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "envDef"]) + def __init__( + self, + envDef: Sequence[EnvironmentDef], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.envDef = envDef + + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) class ShellCommandRequirement(ProcessRequirement): @@ -16273,21 +16326,6 @@ class ShellCommandRequirement(ProcessRequirement): """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ShellCommandRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, ShellCommandRequirement): return bool(self.class_ == other.class_) @@ -16302,8 +16340,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShellCommandRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16326,7 +16364,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16382,7 +16420,22 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) class ResourceRequirement(ProcessRequirement): @@ -16410,37 +16463,6 @@ class ResourceRequirement(ProcessRequirement): """ - def __init__( - self, - coresMin: Optional[Any] = None, - coresMax: Optional[Any] = None, - ramMin: Optional[Any] = None, - ramMax: Optional[Any] = None, - tmpdirMin: Optional[Any] = None, - tmpdirMax: Optional[Any] = None, - outdirMin: Optional[Any] = None, - outdirMax: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax - def __eq__(self, other: Any) -> bool: if isinstance(other, ResourceRequirement): return bool( @@ -16477,8 +16499,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ResourceRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16506,7 +16528,7 @@ def fromDoc( try: coresMin = load_field( _doc.get("coresMin"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMin") @@ -16600,7 +16622,7 @@ def fromDoc( try: ramMin = load_field( _doc.get("ramMin"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMin") @@ -16647,7 +16669,7 @@ def fromDoc( try: ramMax = load_field( _doc.get("ramMax"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMax") @@ -16741,7 +16763,7 @@ def fromDoc( try: tmpdirMax = load_field( _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMax") @@ -16788,7 +16810,7 @@ def fromDoc( try: outdirMin = load_field( _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMin") @@ -16835,7 +16857,7 @@ def fromDoc( try: outdirMax = load_field( _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMax") @@ -16877,7 +16899,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16987,7 +17009,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | int | str = None, + coresMax: None | int | str = None, + ramMin: None | int | str = None, + ramMax: None | int | str = None, + tmpdirMin: None | int | str = None, + tmpdirMax: None | int | str = None, + outdirMin: None | int | str = None, + outdirMax: None | int | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "coresMin", @@ -17005,36 +17058,6 @@ def save( class ExpressionToolOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - format: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.outputBinding = outputBinding - self.format = format - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionToolOutputParameter): return bool( @@ -17069,8 +17092,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionToolOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17462,7 +17485,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17487,11 +17510,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, type_=type_, @@ -17560,7 +17583,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -17582,39 +17635,6 @@ class ExpressionTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - expression: Any, - id: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_ = "ExpressionTool" - self.expression = expression - def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionTool): return bool( @@ -17653,8 +17673,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18112,7 +18132,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18137,7 +18157,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), inputs=inputs, outputs=outputs, requirements=requirements, @@ -18220,46 +18240,19 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "id", - "inputs", - "outputs", - "requirements", - "hints", - "label", - "doc", - "cwlVersion", - "class", - "expression", - ] - ) - - -class WorkflowOutputParameter(OutputParameter): - """ - Describe an output parameter of a workflow. The parameter must be - connected to one or more parameters defined in the workflow that will - provide the value of the output parameter. - - """ - - id: str - def __init__( self, - id: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - outputBinding: Optional[Any] = None, - format: Optional[Any] = None, - outputSource: Optional[Any] = None, - linkMerge: Optional[Any] = None, - type_: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + inputs: Sequence[InputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -18269,16 +18262,42 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.outputBinding = outputBinding - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ + self.cwlVersion = cwlVersion + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "inputs", + "outputs", + "requirements", + "hints", + "label", + "doc", + "cwlVersion", + "class", + "expression", + ] + ) + + +class WorkflowOutputParameter(OutputParameter): + """ + Describe an output parameter of a workflow. The parameter must be + connected to one or more parameters defined in the workflow that will + provide the value of the output parameter. + + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowOutputParameter): @@ -18318,8 +18337,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18805,7 +18824,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18830,11 +18849,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, outputBinding=outputBinding, format=format, outputSource=outputSource, @@ -18912,7 +18931,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -18928,6 +18981,7 @@ def save( ) +@trait class Sink(Saveable): pass @@ -18978,30 +19032,6 @@ class WorkflowStepInput(Sink): id: str - def __init__( - self, - id: Any, - source: Optional[Any] = None, - linkMerge: Optional[Any] = None, - default: Optional[Any] = None, - valueFrom: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.source = source - self.linkMerge = linkMerge - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.default = default - self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepInput): return bool( @@ -19024,8 +19054,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepInput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19276,7 +19306,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19301,9 +19331,9 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), source=source, linkMerge=linkMerge, - id=id, default=default, valueFrom=valueFrom, extension_fields=extension_fields, @@ -19350,7 +19380,33 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["source", "linkMerge", "id", "default", "valueFrom"]) + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.source = source + self.linkMerge = linkMerge + self.id = id + self.default = default + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( + ["source", "linkMerge", "id", "default", "valueFrom"] + ) class WorkflowStepOutput(Saveable): @@ -19364,22 +19420,6 @@ class WorkflowStepOutput(Saveable): id: str - def __init__( - self, - id: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepOutput): return bool(self.id == other.id) @@ -19394,8 +19434,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepOutput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19458,7 +19498,7 @@ def fromDoc( _errors__.append(ValidationException("missing id")) if not __original_id_is_none: baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19481,7 +19521,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -19511,7 +19551,23 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["id"]) + def __init__( + self, + id: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + + attrs: ClassVar[Collection[str]] = frozenset(["id"]) class WorkflowStep(Saveable): @@ -19576,40 +19632,6 @@ class WorkflowStep(Saveable): id: str - def __init__( - self, - id: Any, - in_: Any, - out: Any, - run: Any, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - scatter: Optional[Any] = None, - scatterMethod: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.run = run - self.scatter = scatter - self.scatterMethod = scatterMethod - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStep): return bool( @@ -19648,8 +19670,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStep": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -20138,7 +20160,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20163,7 +20185,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), in_=in_, out=out, requirements=requirements, @@ -20239,7 +20261,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any] = None, + label: None | str = None, + doc: None | str = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.run = run + self.scatter = scatter + self.scatterMethod = scatterMethod + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "in", @@ -20307,39 +20363,6 @@ class Workflow(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - steps: Any, - id: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_ = "Workflow" - self.steps = steps - def __eq__(self, other: Any) -> bool: if isinstance(other, Workflow): return bool( @@ -20378,8 +20401,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Workflow": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -20837,7 +20860,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20862,7 +20885,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), inputs=inputs, outputs=outputs, requirements=requirements, @@ -20942,7 +20965,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[InputParameter], + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], + id: None | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion + self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -20965,21 +21021,6 @@ class SubworkflowFeatureRequirement(ProcessRequirement): """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -20994,8 +21035,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SubworkflowFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21018,7 +21059,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21074,20 +21115,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class ScatterFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21097,7 +21128,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class ScatterFeatureRequirement(ProcessRequirement): + """ + Indicates that the workflow platform must support the `scatter` and + `scatterMethod` fields of [WorkflowStep](#WorkflowStep). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, ScatterFeatureRequirement): @@ -21113,8 +21154,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ScatterFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21137,7 +21178,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21193,20 +21234,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class MultipleInputFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21216,7 +21247,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class MultipleInputFeatureRequirement(ProcessRequirement): + """ + Indicates that the workflow platform must support multiple inbound data links + listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -21232,8 +21273,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MultipleInputFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21256,7 +21297,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21312,20 +21353,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class StepInputExpressionRequirement(ProcessRequirement): - """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21335,7 +21366,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class StepInputExpressionRequirement(ProcessRequirement): + """ + Indicate that the workflow platform must support the `valueFrom` field + of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, StepInputExpressionRequirement): @@ -21351,8 +21392,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "StepInputExpressionRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21375,7 +21416,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21431,15 +21472,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class LoadListingRequirement(ProcessRequirement): def __init__( self, - loadListing: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21449,9 +21485,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "LoadListingRequirement" - self.loadListing = loadListing + self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + +class LoadListingRequirement(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, LoadListingRequirement): return bool( @@ -21468,8 +21507,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "LoadListingRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21540,7 +21579,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21606,15 +21645,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "loadListing"]) - - -class InplaceUpdateRequirement(ProcessRequirement): def __init__( self, - inplaceUpdate: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21624,9 +21659,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.class_: Final[str] = "http://commonwl.org/cwltool#LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) + +class InplaceUpdateRequirement(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): return bool( @@ -21644,8 +21683,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InplaceUpdateRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21716,7 +21755,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21782,15 +21821,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "inplaceUpdate"]) - - -class Secrets(ProcessRequirement): def __init__( self, - secrets: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + inplaceUpdate: bool, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21800,9 +21835,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "Secrets" - self.secrets = secrets + self.class_: Final[str] = "http://commonwl.org/cwltool#InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) + +class Secrets(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -21817,8 +21856,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Secrets": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21889,7 +21928,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21951,23 +21990,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "secrets"]) - - -class TimeLimit(ProcessRequirement): - """ - Set an upper limit on the execution time of a CommandLineTool or - ExpressionTool. A tool execution which exceeds the time limit may - be preemptively terminated and considered failed. May also be - used by batch systems to make scheduling decisions. - - """ - def __init__( self, - timelimit: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + secrets: Sequence[str], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -21977,8 +22004,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "TimeLimit" - self.timelimit = timelimit + self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + + +class TimeLimit(ProcessRequirement): + """ + Set an upper limit on the execution time of a CommandLineTool or + ExpressionTool. A tool execution which exceeds the time limit may + be preemptively terminated and considered failed. May also be + used by batch systems to make scheduling decisions. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, TimeLimit): @@ -21996,8 +22035,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "TimeLimit": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22068,7 +22107,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22134,7 +22173,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "timelimit"]) + def __init__( + self, + timelimit: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "http://commonwl.org/cwltool#TimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) class WorkReuse(ProcessRequirement): @@ -22151,23 +22207,6 @@ class WorkReuse(ProcessRequirement): """ - def __init__( - self, - enableReuse: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "WorkReuse" - self.enableReuse = enableReuse - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkReuse): return bool( @@ -22184,8 +22223,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkReuse": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22256,7 +22295,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22322,7 +22361,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "enableReuse"]) + def __init__( + self, + enableReuse: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "http://commonwl.org/cwltool#WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) class NetworkAccess(ProcessRequirement): @@ -22345,23 +22401,6 @@ class NetworkAccess(ProcessRequirement): """ - def __init__( - self, - networkAccess: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "NetworkAccess" - self.networkAccess = networkAccess - def __eq__(self, other: Any) -> bool: if isinstance(other, NetworkAccess): return bool( @@ -22379,8 +22418,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "NetworkAccess": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22451,7 +22490,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22517,25 +22556,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "networkAccess"]) - - -class ProcessGenerator(Process): - id: str - def __init__( self, - inputs: Any, - outputs: Any, - run: Any, - id: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + networkAccess: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -22545,16 +22570,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_ = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "http://commonwl.org/cwltool#NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) + + +class ProcessGenerator(Process): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -22594,8 +22617,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ProcessGenerator": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23053,7 +23076,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23078,7 +23101,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), inputs=inputs, outputs=outputs, requirements=requirements, @@ -23157,7 +23180,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[InputParameter], + outputs: Sequence[OutputParameter], + run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + id: None | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion + self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "inputs", @@ -23179,23 +23235,6 @@ class MPIRequirement(ProcessRequirement): """ - def __init__( - self, - processes: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "MPIRequirement" - self.processes = processes - def __eq__(self, other: Any) -> bool: if isinstance(other, MPIRequirement): return bool( @@ -23212,8 +23251,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MPIRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23284,7 +23323,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23350,23 +23389,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "processes"]) - - -class CUDARequirement(ProcessRequirement): - """ - Require support for NVIDA CUDA (GPU hardware acceleration). - - """ - def __init__( self, - cudaComputeCapability: Any, - cudaVersionMin: Any, - cudaDeviceCountMax: Optional[Any] = None, - cudaDeviceCountMin: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + processes: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -23376,11 +23403,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +class CUDARequirement(ProcessRequirement): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -23410,8 +23443,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CUDARequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23624,7 +23657,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23714,23 +23747,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "class", - "cudaComputeCapability", - "cudaDeviceCountMax", - "cudaDeviceCountMin", - "cudaVersionMin", - ] - ) - - -class ShmSize(ProcessRequirement): def __init__( self, - shmSize: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + cudaComputeCapability: Sequence[str] | str, + cudaVersionMin: str, + cudaDeviceCountMax: None | int | str = None, + cudaDeviceCountMin: None | int | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -23740,9 +23764,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "cudaComputeCapability", + "cudaDeviceCountMax", + "cudaDeviceCountMin", + "cudaVersionMin", + ] + ) + + +class ShmSize(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -23757,8 +23796,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShmSize": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23829,7 +23868,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23892,10 +23931,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "shmSize"]) + def __init__( + self, + shmSize: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.shmSize = shmSize + + attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) -_vocab = { +_vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", @@ -24016,8 +24072,8 @@ def save( "union": "https://w3id.org/cwl/salad#union", "v1.0": "https://w3id.org/cwl/cwl#v1.0", "v1.0.dev4": "https://w3id.org/cwl/cwl#v1.0.dev4", -} -_rvocab = { +}) +_rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", @@ -24138,15 +24194,15 @@ def save( "https://w3id.org/cwl/salad#union": "union", "https://w3id.org/cwl/cwl#v1.0": "v1.0", "https://w3id.org/cwl/cwl#v1.0.dev4": "v1.0.dev4", -} - -strtype = _PrimitiveLoader(str) -inttype = _PrimitiveLoader(int) -floattype = _PrimitiveLoader(float) -booltype = _PrimitiveLoader(bool) -None_type = _PrimitiveLoader(type(None)) -Any_type = _AnyLoader() -PrimitiveTypeLoader = _EnumLoader( +}) + +strtype: Final = _PrimitiveLoader(str) +inttype: Final = _PrimitiveLoader(int) +floattype: Final = _PrimitiveLoader(float) +booltype: Final = _PrimitiveLoader(bool) +None_type: Final = _PrimitiveLoader(type(None)) +Any_type: Final = _AnyLoader() +PrimitiveTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -24172,17 +24228,17 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +AnyLoader: Final = _EnumLoader(("Any",), "Any") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader = _RecordLoader(RecordField, None, None) -RecordSchemaLoader = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader = _EnumLoader( +RecordFieldLoader: Final = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) +EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -24201,26 +24257,26 @@ def save( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader = _RecordLoader(CWLRecordSchema, None, None) -FileLoader = _RecordLoader(File, None, None) -DirectoryLoader = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader = _UnionLoader( +CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) +CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) +CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) +FileLoader: Final = _RecordLoader(File, None, None) +DirectoryLoader: Final = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( ( None_type, CWLObjectTypeLoader, ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( union_of_None_type_or_CWLObjectTypeLoader ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( union_of_None_type_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True ) -CWLInputFileLoader = map_of_union_of_None_type_or_CWLObjectTypeLoader -CWLVersionLoader = _EnumLoader( +CWLInputFileLoader: Final = map_of_union_of_None_type_or_CWLObjectTypeLoader +CWLVersionLoader: Final = _EnumLoader( ( "draft-2", "draft-3.dev1", @@ -24240,35 +24296,49 @@ def save( """ Version symbols for published CWL document versions. """ -ExpressionLoader = _ExpressionLoader(str) -InputRecordFieldLoader = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader = _RecordLoader(OutputArraySchema, None, None) -InputParameterLoader = _RecordLoader(InputParameter, None, None) -OutputParameterLoader = _RecordLoader(OutputParameter, None, None) -InlineJavascriptRequirementLoader = _RecordLoader( +ExpressionLoader: Final = _ExpressionLoader(str) +InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) +InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) +InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) +InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) +OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) +OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) +OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) +OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) +InputParameterLoader: Final = _RecordLoader(InputParameter, None, None) +OutputParameterLoader: Final = _RecordLoader(OutputParameter, None, None) +InlineJavascriptRequirementLoader: Final = _RecordLoader( InlineJavascriptRequirement, None, None ) -SchemaDefRequirementLoader = _RecordLoader(SchemaDefRequirement, None, None) -EnvironmentDefLoader = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader = _RecordLoader(CommandInputRecordField, None, None) -CommandInputRecordSchemaLoader = _RecordLoader(CommandInputRecordSchema, None, None) -CommandInputEnumSchemaLoader = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader = _RecordLoader(CommandInputArraySchema, None, None) -CommandOutputRecordFieldLoader = _RecordLoader(CommandOutputRecordField, None, None) -CommandOutputRecordSchemaLoader = _RecordLoader(CommandOutputRecordSchema, None, None) -CommandOutputEnumSchemaLoader = _RecordLoader(CommandOutputEnumSchema, None, None) -CommandOutputArraySchemaLoader = _RecordLoader(CommandOutputArraySchema, None, None) -CommandInputParameterLoader = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader = _RecordLoader(CommandOutputParameter, None, None) -stdoutLoader = _EnumLoader(("stdout",), "stdout") +SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) +EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) +CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) +CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) +CommandInputRecordFieldLoader: Final = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final = _RecordLoader( + CommandInputRecordSchema, None, None +) +CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) +CommandInputArraySchemaLoader: Final = _RecordLoader( + CommandInputArraySchema, None, None +) +CommandOutputRecordFieldLoader: Final = _RecordLoader( + CommandOutputRecordField, None, None +) +CommandOutputRecordSchemaLoader: Final = _RecordLoader( + CommandOutputRecordSchema, None, None +) +CommandOutputEnumSchemaLoader: Final = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final = _RecordLoader( + CommandOutputArraySchema, None, None +) +CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) +CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) +stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24312,7 +24382,7 @@ def save( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24356,20 +24426,24 @@ def save( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader = _RecordLoader(CommandLineTool, None, None) -DockerRequirementLoader = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader = _RecordLoader(SoftwareRequirement, None, None) -SoftwarePackageLoader = _RecordLoader(SoftwarePackage, None, None) -DirentLoader = _RecordLoader(Dirent, None, None) -InitialWorkDirRequirementLoader = _RecordLoader(InitialWorkDirRequirement, None, None) -EnvVarRequirementLoader = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader = _RecordLoader(ShellCommandRequirement, None, None) -ResourceRequirementLoader = _RecordLoader(ResourceRequirement, None, None) -ExpressionToolOutputParameterLoader = _RecordLoader( +CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) +DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) +SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) +SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) +DirentLoader: Final = _RecordLoader(Dirent, None, None) +InitialWorkDirRequirementLoader: Final = _RecordLoader( + InitialWorkDirRequirement, None, None +) +EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) +ShellCommandRequirementLoader: Final = _RecordLoader( + ShellCommandRequirement, None, None +) +ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) +ExpressionToolOutputParameterLoader: Final = _RecordLoader( ExpressionToolOutputParameter, None, None ) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) +LinkMergeMethodLoader: Final = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -24379,10 +24453,12 @@ def save( """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader = _RecordLoader(WorkflowOutputParameter, None, None) -WorkflowStepInputLoader = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader = _EnumLoader( +WorkflowOutputParameterLoader: Final = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) +WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) +ScatterMethodLoader: Final = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -24393,38 +24469,44 @@ def save( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader = _RecordLoader(Workflow, None, None) -SubworkflowFeatureRequirementLoader = _RecordLoader( +WorkflowStepLoader: Final = _RecordLoader(WorkflowStep, None, None) +WorkflowLoader: Final = _RecordLoader(Workflow, None, None) +SubworkflowFeatureRequirementLoader: Final = _RecordLoader( SubworkflowFeatureRequirement, None, None ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( +ScatterFeatureRequirementLoader: Final = _RecordLoader( + ScatterFeatureRequirement, None, None +) +MultipleInputFeatureRequirementLoader: Final = _RecordLoader( MultipleInputFeatureRequirement, None, None ) -StepInputExpressionRequirementLoader = _RecordLoader( +StepInputExpressionRequirementLoader: Final = _RecordLoader( StepInputExpressionRequirement, None, None ) -LoadListingRequirementLoader = _RecordLoader(LoadListingRequirement, None, None) -InplaceUpdateRequirementLoader = _RecordLoader(InplaceUpdateRequirement, None, None) -SecretsLoader = _RecordLoader(Secrets, None, None) -TimeLimitLoader = _RecordLoader(TimeLimit, None, None) -WorkReuseLoader = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader = _RecordLoader(NetworkAccess, None, None) -ProcessGeneratorLoader = _RecordLoader(ProcessGenerator, None, None) -MPIRequirementLoader = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader = _RecordLoader(CUDARequirement, None, None) -ShmSizeLoader = _RecordLoader(ShmSize, None, None) -array_of_strtype = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype = _UnionLoader( +LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) +InplaceUpdateRequirementLoader: Final = _RecordLoader( + InplaceUpdateRequirement, None, None +) +SecretsLoader: Final = _RecordLoader(Secrets, None, None) +TimeLimitLoader: Final = _RecordLoader(TimeLimit, None, None) +WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) +ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) +MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) +CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) +ShmSizeLoader: Final = _RecordLoader(ShmSize, None, None) +array_of_strtype: Final = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +uri_strtype_True_False_None_None: Final = _URILoader(strtype, True, False, None, None) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -24435,10 +24517,14 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -24450,51 +24536,57 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader = _UnionLoader( +array_of_RecordFieldLoader: Final = _ArrayLoader(RecordFieldLoader) +union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") +union_of_None_type_or_strtype: Final = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_None: Final = _URILoader( union_of_None_type_or_strtype, True, False, None, None ) -uri_array_of_strtype_True_False_None_None = _URILoader( +uri_array_of_strtype_True_False_None_None: Final = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2 = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None = _URILoader( +Enum_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2 = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2 = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2 = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +Array_nameLoader: Final = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") +Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") +Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -24503,10 +24595,14 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -24516,73 +24612,82 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader = _UnionLoader( +array_of_CWLRecordFieldLoader: Final = _ArrayLoader(CWLRecordFieldLoader) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" ) -File_classLoader = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None = _URILoader( +File_classLoader: Final = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_False_False_None_None: Final = _URILoader( union_of_None_type_or_strtype, False, False, None, None ) -union_of_None_type_or_inttype = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader ) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( + _UnionLoader( + ( + None_type, + array_of_union_of_FileLoader_or_DirectoryLoader, + ) ) ) -uri_union_of_None_type_or_strtype_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_True: Final = _URILoader( union_of_None_type_or_strtype, True, False, None, True ) -Directory_classLoader = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None = _URILoader( +Directory_classLoader: Final = _EnumLoader(("Directory",), "Directory_class") +uri_Directory_classLoader_False_True_None_None: Final = _URILoader( Directory_classLoader, False, True, None, None ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader = _ArrayLoader( +array_of_union_of_strtype_or_ExpressionLoader: Final = _ArrayLoader( union_of_strtype_or_ExpressionLoader ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader: ( + Final +) = _UnionLoader( ( None_type, strtype, @@ -24590,13 +24695,15 @@ def save( array_of_union_of_strtype_or_ExpressionLoader, ) ) -union_of_None_type_or_booltype = _UnionLoader( +union_of_None_type_or_booltype: Final = _UnionLoader( ( None_type, booltype, ) ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -24605,10 +24712,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -24618,35 +24729,41 @@ def save( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -array_of_InputRecordFieldLoader = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader = _UnionLoader( +array_of_InputRecordFieldLoader: Final = _ArrayLoader(InputRecordFieldLoader) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( + _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") ) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -24655,10 +24772,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -24668,50 +24789,60 @@ def save( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_OutputRecordFieldLoader = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader = _UnionLoader( +array_of_OutputRecordFieldLoader: Final = _ArrayLoader(OutputRecordFieldLoader) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( + _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") ) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: ( + Final +) = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24722,30 +24853,36 @@ def save( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, strtype, ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( + _URILoader( + union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True + ) ) -array_of_InputParameterLoader = _ArrayLoader(InputParameterLoader) -idmap_inputs_array_of_InputParameterLoader = _IdMapLoader( +array_of_InputParameterLoader: Final = _ArrayLoader(InputParameterLoader) +idmap_inputs_array_of_InputParameterLoader: Final = _IdMapLoader( array_of_InputParameterLoader, "id", "type" ) -array_of_OutputParameterLoader = _ArrayLoader(OutputParameterLoader) -idmap_outputs_array_of_OutputParameterLoader = _IdMapLoader( +array_of_OutputParameterLoader: Final = _ArrayLoader(OutputParameterLoader) +idmap_outputs_array_of_OutputParameterLoader: Final = _IdMapLoader( array_of_OutputParameterLoader, "id", "type" ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( + Final +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -24770,21 +24907,29 @@ def save( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( + Final +) = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( + Final +) = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -24810,68 +24955,86 @@ def save( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader = _UnionLoader( +union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( ( None_type, CWLVersionLoader, ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_CWLVersionLoader, False, True, None, None ) -InlineJavascriptRequirement_classLoader = _EnumLoader( +InlineJavascriptRequirement_classLoader: Final = _EnumLoader( ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" ) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( InlineJavascriptRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_array_of_strtype: Final = _UnionLoader( ( None_type, array_of_strtype, ) ) -SchemaDefRequirement_classLoader = _EnumLoader( +SchemaDefRequirement_classLoader: Final = _EnumLoader( ("SchemaDefRequirement",), "SchemaDefRequirement_class" ) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( SchemaDefRequirement_classLoader, False, True, None, None ) -union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader = ( - _UnionLoader( - ( - InputRecordSchemaLoader, - InputEnumSchemaLoader, - InputArraySchemaLoader, - ) +union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: ( + Final +) = _UnionLoader( + ( + InputRecordSchemaLoader, + InputEnumSchemaLoader, + InputArraySchemaLoader, ) ) -array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader = _ArrayLoader( +array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: ( + Final +) = _ArrayLoader( union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_inttype: Final = _UnionLoader( ( None_type, - strtype, - ExpressionLoader, - array_of_strtype, + inttype, + ) +) +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + array_of_strtype, + ) ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -24880,10 +25043,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -24893,31 +25060,39 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader = _ArrayLoader(CommandInputRecordFieldLoader) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final = _ArrayLoader( + CommandInputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( _IdMapLoader( union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -24926,10 +25101,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -24939,31 +25118,39 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandOutputRecordFieldLoader = _ArrayLoader(CommandOutputRecordFieldLoader) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final = _ArrayLoader( + CommandOutputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( _IdMapLoader( union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24974,12 +25161,16 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24992,72 +25183,82 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader = _EnumLoader(("CommandLineTool",), "CommandLineTool_class") -uri_CommandLineTool_classLoader_False_True_None_None = _URILoader( +CommandLineTool_classLoader: Final = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" +) +uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( CommandLineTool_classLoader, False, True, None, None ) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( +array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( array_of_CommandInputParameterLoader, "id", "type" ) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( +array_of_CommandOutputParameterLoader: Final = _ArrayLoader( + CommandOutputParameterLoader +) +idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( array_of_CommandOutputParameterLoader, "id", "type" ) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) ) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype = _UnionLoader( +array_of_inttype: Final = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final = _UnionLoader( ( None_type, array_of_inttype, ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_classLoader: Final = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( +uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( DockerRequirement_classLoader, False, True, None, None ) -SoftwareRequirement_classLoader = _EnumLoader( +SoftwareRequirement_classLoader: Final = _EnumLoader( ("SoftwareRequirement",), "SoftwareRequirement_class" ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( +uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( SoftwareRequirement_classLoader, False, True, None, None ) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( +array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) +idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( array_of_SoftwarePackageLoader, "package", "specs" ) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( union_of_None_type_or_array_of_strtype, False, False, None, True ) -InitialWorkDirRequirement_classLoader = _EnumLoader( +InitialWorkDirRequirement_classLoader: Final = _EnumLoader( ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" ) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _URILoader( InitialWorkDirRequirement_classLoader, False, True, None, None ) -union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: ( + Final +) = _UnionLoader( ( FileLoader, DirectoryLoader, @@ -25066,39 +25267,54 @@ def save( ExpressionLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: ( + Final +) = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader ) -union_of_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader_or_strtype_or_ExpressionLoader: ( + Final +) = _UnionLoader( ( array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader, strtype, ExpressionLoader, ) ) -EnvVarRequirement_classLoader = _EnumLoader( +EnvVarRequirement_classLoader: Final = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( +uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( EnvVarRequirement_classLoader, False, True, None, None ) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( +array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) +idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( array_of_EnvironmentDefLoader, "envName", "envValue" ) -ShellCommandRequirement_classLoader = _EnumLoader( +ShellCommandRequirement_classLoader: Final = _EnumLoader( ("ShellCommandRequirement",), "ShellCommandRequirement_class" ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( ShellCommandRequirement_classLoader, False, True, None, None ) -ResourceRequirement_classLoader = _EnumLoader( +ResourceRequirement_classLoader: Final = _EnumLoader( ("ResourceRequirement",), "ResourceRequirement_class" ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( ResourceRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + inttype, + inttype, + strtype, + ExpressionLoader, + ) + ) +) +union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, inttype, @@ -25106,7 +25322,9 @@ def save( ExpressionLoader, ) ) -union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( None_type, CWLTypeLoader, @@ -25117,67 +25335,75 @@ def save( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -ExpressionTool_classLoader = _EnumLoader(("ExpressionTool",), "ExpressionTool_class") -uri_ExpressionTool_classLoader_False_True_None_None = _URILoader( +ExpressionTool_classLoader: Final = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" +) +uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( ExpressionTool_classLoader, False, True, None, None ) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( +array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( ExpressionToolOutputParameterLoader ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _IdMapLoader( array_of_ExpressionToolOutputParameterLoader, "id", "type" ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) ) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( +union_of_None_type_or_LinkMergeMethodLoader: Final = _UnionLoader( ( None_type, LinkMergeMethodLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) ) -array_of_WorkflowStepInputLoader = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader = _IdMapLoader( +array_of_WorkflowStepInputLoader: Final = _ArrayLoader(WorkflowStepInputLoader) +idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( array_of_WorkflowStepInputLoader, "id", "source" ) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( union_of_strtype_or_WorkflowStepOutputLoader ) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) ) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( + Final +) = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type = _UnionLoader( +array_of_Any_type: Final = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( ( None_type, array_of_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _IdMapLoader( union_of_None_type_or_array_of_Any_type, "class", "None" ) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -25186,64 +25412,70 @@ def save( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: ( + Final +) = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) ) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( +union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_ScatterMethodLoader, False, True, None, None ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( +Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") +uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( Workflow_classLoader, False, True, None, None ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( +array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( + WorkflowOutputParameterLoader +) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( array_of_WorkflowOutputParameterLoader, "id", "type" ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( +array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) +union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( + (array_of_WorkflowStepLoader,) +) +idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( union_of_array_of_WorkflowStepLoader, "id", "None" ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( SubworkflowFeatureRequirement_classLoader, False, True, None, None ) -ScatterFeatureRequirement_classLoader = _EnumLoader( +ScatterFeatureRequirement_classLoader: Final = _EnumLoader( ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" ) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( ScatterFeatureRequirement_classLoader, False, True, None, None ) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( + _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) ) -StepInputExpressionRequirement_classLoader = _EnumLoader( +StepInputExpressionRequirement_classLoader: Final = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( StepInputExpressionRequirement_classLoader, False, True, None, None ) -uri_strtype_False_True_None_None = _URILoader(strtype, False, True, None, None) -LoadListingEnumLoader = _EnumLoader( +uri_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) +LoadListingEnumLoader: Final = _EnumLoader( ( "no_listing", "shallow_listing", @@ -25251,42 +25483,44 @@ def save( ), "LoadListingEnum", ) -union_of_LoadListingEnumLoader = _UnionLoader((LoadListingEnumLoader,)) -uri_array_of_strtype_False_False_0_None = _URILoader( +union_of_LoadListingEnumLoader: Final = _UnionLoader((LoadListingEnumLoader,)) +uri_array_of_strtype_False_False_0_None: Final = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_inttype_or_strtype = _UnionLoader( +union_of_inttype_or_strtype: Final = _UnionLoader( ( inttype, strtype, ) ) -union_of_booltype_or_strtype = _UnionLoader( +union_of_booltype_or_strtype: Final = _UnionLoader( ( booltype, strtype, ) ) -union_of_inttype_or_ExpressionLoader = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( ( inttype, ExpressionLoader, ) ) -union_of_strtype_or_array_of_strtype = _UnionLoader( +union_of_strtype_or_array_of_strtype: Final = _UnionLoader( ( strtype, array_of_strtype, ) ) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, inttype, ExpressionLoader, ) ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -25294,10 +25528,14 @@ def save( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -25319,12 +25557,15 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" +) def load_document( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -25341,9 +25582,9 @@ def load_document( def load_document_with_metadata( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -25361,7 +25602,7 @@ def load_document_with_metadata( def load_document_by_string( string: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: yaml = yaml_no_ts() result = yaml.load(string) @@ -25382,7 +25623,7 @@ def load_document_by_string( def load_document_by_yaml( yaml: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """ Shortcut to load via a YAML object. diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index 4f4dfd5f..0f0e3b7a 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -205,7 +205,7 @@ def check_all_types( for parm_id in sourceField: srcs_of_sink += [src_dict[parm_id]] else: - parm_id = cast(str, sourceField) + parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( f"{sourceName} not found: {parm_id}" @@ -375,7 +375,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] == in_.id.split("#")[-1]: + if 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") diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index 744cba7f..d03c8932 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -3,18 +3,24 @@ # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. +from __future__ import annotations + import copy import logging import os import pathlib +import sys import tempfile import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec -from abc import ABC, abstractmethod +from abc import ABCMeta, abstractmethod from collections.abc import MutableMapping, MutableSequence, Sequence +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import trait +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,28 @@ from schema_salad.sourceline import SourceLine, add_lc_filename from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ -_vocab: dict[str, str] = {} -_rvocab: dict[str, str] = {} +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} _logger: Final = logging.getLogger("salad") -IdxType = MutableMapping[str, tuple[Any, "LoadingOptions"]] +IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +S = TypeVar("S", bound="Saveable") class LoadingOptions: idx: Final[IdxType] - fileuri: Final[Optional[str]] + fileuri: Final[str | None] baseuri: Final[str] namespaces: Final[MutableMapping[str, str]] schemas: Final[MutableSequence[str]] - original_doc: Final[Optional[Any]] + original_doc: Final[Any | None] addl_metadata: Final[MutableMapping[str, Any]] fetcher: Final[Fetcher] vocab: Final[dict[str, str]] @@ -50,24 +62,24 @@ class LoadingOptions: cache: Final[CacheType] imports: Final[list[str]] includes: Final[list[str]] - no_link_check: Final[Optional[bool]] - container: Final[Optional[str]] + no_link_check: Final[bool | None] + container: Final[str | None] def __init__( self, - fetcher: Optional[Fetcher] = None, - namespaces: Optional[dict[str, str]] = None, - schemas: Optional[list[str]] = None, - fileuri: Optional[str] = None, - copyfrom: Optional["LoadingOptions"] = None, - original_doc: Optional[Any] = None, - addl_metadata: Optional[dict[str, str]] = None, - baseuri: Optional[str] = None, - idx: Optional[IdxType] = None, - imports: Optional[list[str]] = None, - includes: Optional[list[str]] = None, - no_link_check: Optional[bool] = None, - container: Optional[str] = None, + fetcher: Fetcher | None = None, + namespaces: dict[str, str] | None = None, + schemas: list[str] | None = None, + fileuri: str | None = None, + copyfrom: LoadingOptions | None = None, + original_doc: Any | None = None, + addl_metadata: dict[str, str] | None = None, + baseuri: str | None = None, + idx: IdxType | None = None, + imports: list[str] | None = None, + includes: list[str] | None = None, + no_link_check: bool | None = None, + container: str | None = None, ) -> None: """Create a LoadingOptions object.""" self.original_doc = original_doc @@ -79,7 +91,7 @@ def __init__( self.idx = temp_idx if fileuri is not None: - temp_fileuri: Optional[str] = fileuri + temp_fileuri: str | None = fileuri else: temp_fileuri = copyfrom.fileuri if copyfrom is not None else None self.fileuri = temp_fileuri @@ -121,13 +133,13 @@ def __init__( self.includes = temp_includes if no_link_check is not None: - temp_no_link_check: Optional[bool] = no_link_check + temp_no_link_check: bool | None = no_link_check else: temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False self.no_link_check = temp_no_link_check if container is not None: - temp_container: Optional[str] = container + temp_container: str | None = container else: temp_container = copyfrom.container if copyfrom is not None else None self.container = temp_container @@ -201,7 +213,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@trait +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +224,8 @@ def fromDoc( _doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - ) -> "Saveable": + docRoot: str | None = None, + ) -> Self: """Construct this object from the result of yaml.load().""" @abstractmethod @@ -223,11 +236,11 @@ def save( def load_field( - val: Union[str, dict[str, str]], + val: Any | None, fieldtype: "_Loader", baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, + lc: Any | None = None, ) -> Any: """Load field.""" if isinstance(val, MutableMapping): @@ -251,7 +264,9 @@ def load_field( return fieldtype.load(val, baseuri, loadingOptions, lc=lc) -save_type = Optional[Union[MutableMapping[str, Any], MutableSequence[Any], int, float, bool, str]] +save_type: TypeAlias = ( + None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -367,7 +382,7 @@ def expand_url( loadingOptions: LoadingOptions, scoped_id: bool = False, vocab_term: bool = False, - scoped_ref: Optional[int] = None, + scoped_ref: int | None = None, ) -> str: if url in ("@id", "@type"): return url @@ -434,9 +449,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> Any | None: pass @@ -446,8 +461,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if doc is not None: return doc @@ -455,7 +470,7 @@ def load( class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: + def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: self.tp: Final = tp def load( @@ -463,8 +478,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") @@ -483,9 +498,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> list[Any]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -535,9 +550,9 @@ class _MapLoader(_Loader): def __init__( self, values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + name: str | None = None, + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.values: Final = values self.name: Final = name @@ -549,9 +564,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> dict[str, Any]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -584,11 +599,11 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if doc in self.symbols: - return doc + return cast(str, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -604,75 +619,76 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: r: Final[list[dict[str, Any]]] = [] - if isinstance(doc, MutableSequence): - for d in doc: - if isinstance(d, str): - if d.endswith("?"): - r.append({"pattern": d[:-1], "required": False}) - else: - r.append({"pattern": d}) - elif isinstance(d, dict): - new_dict1: dict[str, Any] = {} - dict_copy = copy.deepcopy(d) - if "pattern" in dict_copy: - new_dict1["pattern"] = dict_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {d}" + match doc: + case MutableSequence() as dlist: + for d in dlist: + if isinstance(d, str): + if d.endswith("?"): + r.append({"pattern": d[:-1], "required": False}) + else: + r.append({"pattern": d}) + elif isinstance(d, dict): + new_dict1: dict[str, Any] = {} + dict_copy = copy.deepcopy(d) + if "pattern" in dict_copy: + new_dict1["pattern"] = dict_copy.pop("pattern") + else: + raise ValidationException( + f"Missing pattern in secondaryFiles specification entry: {d}" + ) + new_dict1["required"] = ( + dict_copy.pop("required") if "required" in dict_copy else None ) - new_dict1["required"] = ( - dict_copy.pop("required") if "required" in dict_copy else None - ) - if len(dict_copy): - raise ValidationException( - "Unallowed values in secondaryFiles specification entry: {}".format( - dict_copy + if len(dict_copy): + raise ValidationException( + "Unallowed values in secondaryFiles specification entry: {}".format( + dict_copy + ) ) - ) - r.append(new_dict1) + r.append(new_dict1) + else: + raise ValidationException( + "Expected a string or sequence of (strings or mappings)." + ) + case MutableMapping() as decl: + new_dict2 = {} + doc_copy = copy.deepcopy(decl) + if "pattern" in doc_copy: + new_dict2["pattern"] = doc_copy.pop("pattern") else: raise ValidationException( - "Expected a string or sequence of (strings or mappings)." + f"Missing pattern in secondaryFiles specification entry: {decl}" ) - elif isinstance(doc, MutableMapping): - new_dict2: Final = {} - doc_copy: Final = copy.deepcopy(doc) - if "pattern" in doc_copy: - new_dict2["pattern"] = doc_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {doc}" - ) - new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None + new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None - if len(doc_copy): - raise ValidationException( - f"Unallowed values in secondaryFiles specification entry: {doc_copy}" - ) - r.append(new_dict2) + if len(doc_copy): + raise ValidationException( + f"Unallowed values in secondaryFiles specification entry: {doc_copy}" + ) + r.append(new_dict2) - elif isinstance(doc, str): - if doc.endswith("?"): - r.append({"pattern": doc[:-1], "required": False}) - else: - r.append({"pattern": doc}) - else: - raise ValidationException("Expected str or sequence of str") + case str(decl): + if decl.endswith("?"): + r.append({"pattern": decl[:-1], "required": False}) + else: + r.append({"pattern": decl}) + case _: + raise ValidationException("Expected str or sequence of str") return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader): +class _RecordLoader(_Loader, Generic[S]): def __init__( self, - classtype: type[Saveable], - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + classtype: type[S], + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.classtype: Final = classtype self.container: Final = container @@ -683,9 +699,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> S: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -710,19 +726,20 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if not isinstance(doc, str): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " f"but valid type for this field is a str." ) - return doc + else: + return doc class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: Optional[str] = None) -> None: + def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name @@ -734,8 +751,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: errors: Final = [] @@ -817,8 +834,8 @@ def __init__( inner: _Loader, scoped_id: bool, vocab_term: bool, - scoped_ref: Optional[int], - no_link_check: Optional[bool], + scoped_ref: int | None, + no_link_check: bool | None, ) -> None: self.inner: Final = inner self.scoped_id: Final = scoped_id @@ -831,39 +848,40 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check ) - if isinstance(doc, MutableSequence): - newdoc: Final = [] - for i in doc: - if isinstance(i, str): - newdoc.append( - expand_url( - i, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) - ) - else: - newdoc.append(i) - doc = newdoc - elif isinstance(doc, str): - doc = expand_url( - doc, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) + match doc: + case MutableSequence() as decl: + newdoc: Final = [] + for i in decl: + if isinstance(i, str): + newdoc.append( + expand_url( + i, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) + ) + else: + newdoc.append(i) + doc = newdoc + case str(decl): + doc = expand_url( + decl, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) if isinstance(doc, str): if not loadingOptions.no_link_check: errors: Final = [] @@ -880,7 +898,7 @@ def load( class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: + def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +908,7 @@ def resolve( doc: str, baseuri: str, loadingOptions: LoadingOptions, - ) -> Union[list[Union[dict[str, Any], str]], dict[str, Any], str]: + ) -> list[dict[str, Any] | str] | dict[str, Any] | str: doc_ = doc optional = False if doc_.endswith("?"): @@ -899,7 +917,7 @@ def resolve( if doc_.endswith("[]"): salad_versions: Final = [int(v) for v in self.salad_version[1:].split(".")] - items: Union[list[Union[dict[str, Any], str]], dict[str, Any], str] = "" + items: list[dict[str, Any] | str] | dict[str, Any] | str = "" rest: Final = doc_[0:-2] if salad_versions < [1, 3]: if rest.endswith("[]"): @@ -911,7 +929,7 @@ def resolve( items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) - expanded: Union[dict[str, Any], str] = {"type": "array", "items": items} + expanded: dict[str, Any] | str = {"type": "array", "items": items} else: expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) @@ -925,8 +943,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] @@ -950,7 +968,7 @@ def load( class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: + def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,8 +978,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] @@ -990,10 +1008,10 @@ def load( def _document_load( loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( @@ -1062,7 +1080,7 @@ def _document_load_by_url( loader: _Loader, url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1135,7 @@ def save_relative_uri( uri: Any, base_url: str, scoped_id: bool, - ref_scope: Optional[int], + ref_scope: int | None, relative_uris: bool, ) -> Any: """Convert any URI to a relative one, obeying the scoping rules.""" @@ -1168,6 +1186,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_1" +@trait class Documented(Saveable): pass @@ -1179,26 +1198,6 @@ class RecordField(Documented): name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, RecordField): return bool( @@ -1217,8 +1216,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1376,7 +1375,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1401,8 +1400,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -1441,16 +1440,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class RecordSchema(Saveable): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1460,9 +1456,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -1477,8 +1478,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1580,7 +1581,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1640,24 +1641,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) - - -class EnumSchema(Saveable): - """ - Define an enumerated type. - - """ - - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[RecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1667,10 +1656,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1688,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1849,7 +1848,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1874,7 +1873,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, extension_fields=extension_fields, @@ -1913,16 +1912,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type"]) - - -class ArraySchema(Saveable): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1932,9 +1928,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) + + +class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -1949,8 +1950,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2053,7 +2054,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2112,16 +2113,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class MapSchema(Saveable): def __init__( self, - type_: Any, - values: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2128,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items self.type_ = type_ - self.values = values + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): return bool(self.type_ == other.type_ and self.values == other.values) @@ -2148,8 +2149,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MapSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2252,7 +2253,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2311,16 +2312,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["type", "values"]) - - -class UnionSchema(Saveable): def __init__( self, - names: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["map"], + values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2330,9 +2327,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names self.type_ = type_ + self.values = values + + attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + +class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): return bool(self.names == other.names and self.type_ == other.type_) @@ -2347,8 +2348,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "UnionSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2451,7 +2452,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2510,16 +2511,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["names", "type"]) - - -class CWLArraySchema(ArraySchema): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["union"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2526,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.names = names self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + + +class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -2546,8 +2547,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2650,7 +2651,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2709,19 +2710,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class CWLRecordField(RecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2725,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2752,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2912,7 +2911,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2937,8 +2936,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -2977,16 +2976,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class CWLRecordSchema(RecordSchema): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2996,9 +2992,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -3013,8 +3014,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3116,7 +3117,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3176,7 +3177,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Literal["record"], + fields: None | Sequence[CWLRecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.fields = fields + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) class File(Saveable): @@ -3250,43 +3269,6 @@ class File(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - dirname: Optional[Any] = None, - nameroot: Optional[Any] = None, - nameext: Optional[Any] = None, - checksum: Optional[Any] = None, - size: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - format: Optional[Any] = None, - contents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents - def __eq__(self, other: Any) -> bool: if isinstance(other, File): return bool( @@ -3329,8 +3311,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "File": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3687,7 +3669,7 @@ def fromDoc( try: size = load_field( _doc.get("size"), - union_of_None_type_or_inttype, + union_of_None_type_or_inttype_or_inttype, baseuri, loadingOptions, lc=_doc.get("size") @@ -3870,7 +3852,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3983,7 +3965,44 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | int = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "location", @@ -4049,29 +4068,6 @@ class Directory(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - listing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing - def __eq__(self, other: Any) -> bool: if isinstance(other, Directory): return bool( @@ -4094,8 +4090,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Directory": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4306,7 +4302,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4382,37 +4378,70 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "location", "path", "basename", "listing"]) + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) +@trait class Labeled(Saveable): pass +@trait class Identified(Saveable): pass +@trait class IdentifierRequired(Identified): pass +@trait class LoadContents(Saveable): pass +@trait class FieldBase(Labeled): pass +@trait class InputFormat(Saveable): pass +@trait class OutputFormat(Saveable): pass +@trait class Parameter(FieldBase, Documented, IdentifierRequired): """ Define an input or output parameter to a process. @@ -4423,22 +4452,6 @@ class Parameter(FieldBase, Documented, IdentifierRequired): class InputBinding(Saveable): - def __init__( - self, - loadContents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - def __eq__(self, other: Any) -> bool: if isinstance(other, InputBinding): return bool(self.loadContents == other.loadContents) @@ -4453,8 +4466,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4508,7 +4521,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4566,17 +4579,36 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents"]) + def __init__( + self, + loadContents: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.loadContents = loadContents + attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) + +@trait class IOSchema(Labeled, Documented): pass +@trait class InputSchema(IOSchema): pass +@trait class OutputSchema(IOSchema): pass @@ -4584,38 +4616,6 @@ class OutputSchema(IOSchema): class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): return bool( @@ -4652,8 +4652,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5093,7 +5093,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5118,8 +5118,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -5199,7 +5199,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -5217,30 +5249,6 @@ def save( class InputRecordSchema(CWLRecordSchema, InputSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordSchema): return bool( @@ -5261,8 +5269,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5514,7 +5522,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5539,11 +5547,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5589,21 +5597,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class InputEnumSchema(EnumSchema, InputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5613,11 +5615,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +class InputEnumSchema(EnumSchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5639,8 +5649,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5893,7 +5903,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5918,7 +5928,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -5967,21 +5977,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class InputArraySchema(CWLArraySchema, InputSchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5991,11 +5995,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class InputArraySchema(CWLArraySchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): @@ -6017,8 +6029,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6271,7 +6283,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6296,11 +6308,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -6345,23 +6357,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6371,13 +6375,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -6411,8 +6421,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6758,7 +6768,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6783,8 +6793,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -6848,23 +6858,17 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] - ) - - -class OutputRecordSchema(CWLRecordSchema, OutputSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6874,11 +6878,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] + ) + + +class OutputRecordSchema(CWLRecordSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): @@ -6900,8 +6914,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7153,7 +7167,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7178,11 +7192,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7228,21 +7242,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class OutputEnumSchema(EnumSchema, OutputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[OutputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7252,11 +7260,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +class OutputEnumSchema(EnumSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -7278,8 +7294,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7532,7 +7548,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7557,7 +7573,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -7606,21 +7622,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class OutputArraySchema(CWLArraySchema, OutputSchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7630,11 +7640,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class OutputArraySchema(CWLArraySchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): @@ -7656,8 +7674,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7910,7 +7928,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7935,11 +7953,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7984,17 +8002,46 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) + def __init__( + self, + items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Literal["array"], + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) +@trait class InputParameter(Parameter, InputFormat, LoadContents): pass +@trait class OutputParameter(Parameter, OutputFormat): pass +@trait class ProcessRequirement(Saveable): """ A process requirement declares a prerequisite that may or must be fulfilled @@ -8009,6 +8056,7 @@ class ProcessRequirement(Saveable): pass +@trait class Process(Identified, Labeled, Documented): """ @@ -8029,23 +8077,6 @@ class InlineJavascriptRequirement(ProcessRequirement): """ - def __init__( - self, - expressionLib: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "InlineJavascriptRequirement" - self.expressionLib = expressionLib - def __eq__(self, other: Any) -> bool: if isinstance(other, InlineJavascriptRequirement): return bool( @@ -8063,8 +8094,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InlineJavascriptRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8134,7 +8165,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8200,9 +8231,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "expressionLib"]) + def __init__( + self, + expressionLib: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.expressionLib = expressionLib + + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) +@trait class CommandInputSchema(Saveable): pass @@ -8219,23 +8268,6 @@ class SchemaDefRequirement(ProcessRequirement): """ - def __init__( - self, - types: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SchemaDefRequirement" - self.types = types - def __eq__(self, other: Any) -> bool: if isinstance(other, SchemaDefRequirement): return bool(self.class_ == other.class_ and self.types == other.types) @@ -8250,8 +8282,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SchemaDefRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8322,7 +8354,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8385,16 +8417,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "types"]) - - -class SecondaryFileSchema(Saveable): def __init__( self, - pattern: Any, - required: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8404,9 +8431,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + +class SecondaryFileSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SecondaryFileSchema): return bool( @@ -8423,8 +8454,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SecondaryFileSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8526,7 +8557,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8586,21 +8617,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["pattern", "required"]) - - -class LoadListingRequirement(ProcessRequirement): - """ - Specify the desired behavior for loading the `listing` field of - a Directory object for use by expressions. - - """ - def __init__( self, - loadListing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + pattern: str, + required: None | bool | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8610,17 +8632,27 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "LoadListingRequirement" - self.loadListing = loadListing + self.pattern = pattern + self.required = required - def __eq__(self, other: Any) -> bool: - if isinstance(other, LoadListingRequirement): - return bool( - self.class_ == other.class_ and self.loadListing == other.loadListing - ) - return False + attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) - def __hash__(self) -> int: + +class LoadListingRequirement(ProcessRequirement): + """ + Specify the desired behavior for loading the `listing` field of + a Directory object for use by expressions. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, LoadListingRequirement): + return bool( + self.class_ == other.class_ and self.loadListing == other.loadListing + ) + return False + + def __hash__(self) -> int: return hash((self.class_, self.loadListing)) @classmethod @@ -8629,8 +8661,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "LoadListingRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8700,7 +8732,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8766,23 +8798,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "loadListing"]) - - -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ - def __init__( self, - envName: Any, - envValue: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8792,8 +8812,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "https://w3id.org/cwl/cwl#LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) + + +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment + by the workflow platform when executing the command line tool. May be the + result of executing an expression, such as getting a parameter from input. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8811,8 +8842,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvironmentDef": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8915,7 +8946,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8975,7 +9006,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["envName", "envValue"]) + def __init__( + self, + envName: str, + envValue: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.envName = envName + self.envValue = envValue + + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) class CommandLineBinding(InputBinding): @@ -9018,34 +9067,6 @@ class CommandLineBinding(InputBinding): """ - def __init__( - self, - loadContents: Optional[Any] = None, - position: Optional[Any] = None, - prefix: Optional[Any] = None, - separate: Optional[Any] = None, - itemSeparator: Optional[Any] = None, - valueFrom: Optional[Any] = None, - shellQuote: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineBinding): return bool( @@ -9078,8 +9099,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9415,7 +9436,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9512,7 +9533,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | int | str = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote + + attrs: ClassVar[Collection[str]] = frozenset( [ "loadContents", "position", @@ -9540,28 +9589,6 @@ class CommandOutputBinding(LoadContents): """ - def __init__( - self, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - glob: Optional[Any] = None, - outputEval: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputBinding): return bool( @@ -9581,8 +9608,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9777,7 +9804,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9856,30 +9883,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents", "loadListing", "glob", "outputEval"]) - - -class CommandLineBindable(Saveable): - pass - - -class CommandInputRecordField(InputRecordField, CommandLineBindable): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + glob: None | Sequence[str] | str = None, + outputEval: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -9889,16 +9900,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format self.loadContents = loadContents self.loadListing = loadListing - self.inputBinding = inputBinding + self.glob = glob + self.outputEval = outputEval + + attrs: ClassVar[Collection[str]] = frozenset( + ["loadContents", "loadListing", "glob", "outputEval"] + ) + + +@trait +class CommandLineBindable(Saveable): + pass + + +class CommandInputRecordField(InputRecordField, CommandLineBindable): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9938,8 +9956,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10426,7 +10444,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10451,8 +10469,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -10540,7 +10558,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -10561,32 +10613,6 @@ class CommandInputRecordSchema( ): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordSchema): return bool( @@ -10617,8 +10643,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10917,7 +10943,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10942,11 +10968,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -11000,22 +11026,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name", "inputBinding"]) - - -class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[CommandInputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11025,13 +11045,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name", "inputBinding"] + ) + + +class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): return bool( @@ -11062,8 +11090,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11363,7 +11391,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11388,7 +11416,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -11445,24 +11473,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc", "inputBinding"]) - - -class CommandInputArraySchema( - InputArraySchema, CommandInputSchema, CommandLineBindable -): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11472,13 +11492,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc", "inputBinding"] + ) + + +class CommandInputArraySchema( + InputArraySchema, CommandInputSchema, CommandLineBindable +): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -11502,8 +11532,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11803,7 +11833,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11828,11 +11858,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -11885,24 +11915,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name", "inputBinding"]) - - -class CommandOutputRecordField(OutputRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11912,14 +11934,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.outputBinding = outputBinding + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name", "inputBinding"] + ) + + +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11955,8 +11983,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12349,7 +12377,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12374,8 +12402,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -12447,7 +12475,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -12464,30 +12522,6 @@ def save( class CommandOutputRecordSchema(OutputRecordSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordSchema): return bool( @@ -12508,8 +12542,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12761,7 +12795,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12786,11 +12820,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -12836,21 +12870,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class CommandOutputEnumSchema(OutputEnumSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[CommandOutputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12860,11 +12888,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -12886,8 +12922,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13140,7 +13176,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13165,7 +13201,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -13214,21 +13250,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class CommandOutputArraySchema(OutputArraySchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13238,11 +13268,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class CommandOutputArraySchema(OutputArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): @@ -13264,8 +13302,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13518,7 +13556,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13543,11 +13581,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -13592,31 +13630,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class CommandInputParameter(InputParameter): - """ - An input parameter for a CommandLineTool. - """ - - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13626,17 +13648,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +class CommandInputParameter(InputParameter): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -13678,8 +13706,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -14213,7 +14241,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14238,11 +14266,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -14332,7 +14360,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + default: CWLObjectType | None = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -14356,36 +14420,6 @@ class CommandOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ - self.outputBinding = outputBinding - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputParameter): return bool( @@ -14420,8 +14454,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -14814,7 +14848,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14839,11 +14873,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, outputBinding=outputBinding, @@ -14912,7 +14946,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -14934,53 +14998,6 @@ class CommandLineTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - baseCommand: Optional[Any] = None, - arguments: Optional[Any] = None, - stdin: Optional[Any] = None, - stderr: Optional[Any] = None, - stdout: Optional[Any] = None, - successCodes: Optional[Any] = None, - temporaryFailCodes: Optional[Any] = None, - permanentFailCodes: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_ = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineTool): return bool( @@ -15033,8 +15050,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15820,7 +15837,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15845,7 +15862,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -15972,7 +15989,54 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[int] = None, + temporaryFailCodes: None | Sequence[int] = None, + permanentFailCodes: None | Sequence[int] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -16051,33 +16115,6 @@ class DockerRequirement(ProcessRequirement): """ - def __init__( - self, - dockerPull: Optional[Any] = None, - dockerLoad: Optional[Any] = None, - dockerFile: Optional[Any] = None, - dockerImport: Optional[Any] = None, - dockerImageId: Optional[Any] = None, - dockerOutputDirectory: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory - def __eq__(self, other: Any) -> bool: if isinstance(other, DockerRequirement): return bool( @@ -16110,8 +16147,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "DockerRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16416,7 +16453,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16522,7 +16559,34 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "dockerPull", @@ -16542,23 +16606,6 @@ class SoftwareRequirement(ProcessRequirement): """ - def __init__( - self, - packages: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SoftwareRequirement" - self.packages = packages - def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwareRequirement): return bool(self.class_ == other.class_ and self.packages == other.packages) @@ -16573,8 +16620,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwareRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16645,7 +16692,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16708,17 +16755,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "packages"]) - - -class SoftwarePackage(Saveable): def __init__( self, - package: Any, - version: Optional[Any] = None, - specs: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + packages: Sequence[SoftwarePackage], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16728,10 +16769,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.packages = packages + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + + +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -16750,8 +16794,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwarePackage": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16900,7 +16944,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16964,25 +17008,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["package", "version", "specs"]) - - -class Dirent(Saveable): - """ - Define a file or subdirectory that must be placed in the designated output - directory prior to executing the command line tool. May be the result of - executing an expression, such as building a configuration file from a - template. - - """ - def __init__( self, - entry: Any, - entryname: Optional[Any] = None, - writable: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16992,9 +17024,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.package = package + self.version = version + self.specs = specs + + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) + + +class Dirent(Saveable): + """ + Define a file or subdirectory that must be placed in the designated output + directory prior to executing the command line tool. May be the result of + executing an expression, such as building a configuration file from a + template. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, Dirent): @@ -17014,8 +17058,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Dirent": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17164,7 +17208,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17232,19 +17276,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["entryname", "entry", "writable"]) - - -class InitialWorkDirRequirement(ProcessRequirement): - """ - Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. - """ - def __init__( self, - listing: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + entry: str, + entryname: None | str = None, + writable: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17254,8 +17292,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InitialWorkDirRequirement" - self.listing = listing + self.entryname = entryname + self.entry = entry + self.writable = writable + + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + + +class InitialWorkDirRequirement(ProcessRequirement): + """ + Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. + """ def __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -17271,8 +17318,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InitialWorkDirRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17343,7 +17390,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17406,21 +17453,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "listing"]) - - -class EnvVarRequirement(ProcessRequirement): - """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. - - """ - def __init__( self, - envDef: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17430,8 +17467,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + + +class EnvVarRequirement(ProcessRequirement): + """ + Define a list of environment variables which will be set in the + execution environment of the tool. See `EnvironmentDef` for details. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -17447,8 +17494,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvVarRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17519,7 +17566,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17582,7 +17629,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "envDef"]) + def __init__( + self, + envDef: Sequence[EnvironmentDef], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.envDef = envDef + + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) class ShellCommandRequirement(ProcessRequirement): @@ -17597,21 +17661,6 @@ class ShellCommandRequirement(ProcessRequirement): """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ShellCommandRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, ShellCommandRequirement): return bool(self.class_ == other.class_) @@ -17626,8 +17675,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShellCommandRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17650,7 +17699,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17706,7 +17755,22 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) class ResourceRequirement(ProcessRequirement): @@ -17734,37 +17798,6 @@ class ResourceRequirement(ProcessRequirement): """ - def __init__( - self, - coresMin: Optional[Any] = None, - coresMax: Optional[Any] = None, - ramMin: Optional[Any] = None, - ramMax: Optional[Any] = None, - tmpdirMin: Optional[Any] = None, - tmpdirMax: Optional[Any] = None, - outdirMin: Optional[Any] = None, - outdirMax: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax - def __eq__(self, other: Any) -> bool: if isinstance(other, ResourceRequirement): return bool( @@ -17801,8 +17834,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ResourceRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17830,7 +17863,7 @@ def fromDoc( try: coresMin = load_field( _doc.get("coresMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMin") @@ -17877,7 +17910,7 @@ def fromDoc( try: coresMax = load_field( _doc.get("coresMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMax") @@ -17924,7 +17957,7 @@ def fromDoc( try: ramMin = load_field( _doc.get("ramMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMin") @@ -17971,7 +18004,7 @@ def fromDoc( try: ramMax = load_field( _doc.get("ramMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMax") @@ -18018,7 +18051,7 @@ def fromDoc( try: tmpdirMin = load_field( _doc.get("tmpdirMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMin") @@ -18065,7 +18098,7 @@ def fromDoc( try: tmpdirMax = load_field( _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMax") @@ -18112,7 +18145,7 @@ def fromDoc( try: outdirMin = load_field( _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMin") @@ -18159,7 +18192,7 @@ def fromDoc( try: outdirMax = load_field( _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMax") @@ -18201,7 +18234,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18311,7 +18344,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | int | str = None, + coresMax: None | int | str = None, + ramMin: None | int | str = None, + ramMax: None | int | str = None, + tmpdirMin: None | int | str = None, + tmpdirMax: None | int | str = None, + outdirMin: None | int | str = None, + outdirMax: None | int | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "coresMin", @@ -18340,23 +18404,6 @@ class WorkReuse(ProcessRequirement): """ - def __init__( - self, - enableReuse: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "WorkReuse" - self.enableReuse = enableReuse - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkReuse): return bool( @@ -18373,8 +18420,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkReuse": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18445,7 +18492,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18511,7 +18558,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "enableReuse"]) + def __init__( + self, + enableReuse: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) class NetworkAccess(ProcessRequirement): @@ -18534,23 +18598,6 @@ class NetworkAccess(ProcessRequirement): """ - def __init__( - self, - networkAccess: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "NetworkAccess" - self.networkAccess = networkAccess - def __eq__(self, other: Any) -> bool: if isinstance(other, NetworkAccess): return bool( @@ -18568,8 +18615,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "NetworkAccess": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18640,7 +18687,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18706,7 +18753,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "networkAccess"]) + def __init__( + self, + networkAccess: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) class InplaceUpdateRequirement(ProcessRequirement): @@ -18744,23 +18808,6 @@ class InplaceUpdateRequirement(ProcessRequirement): """ - def __init__( - self, - inplaceUpdate: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate - def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): return bool( @@ -18778,8 +18825,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InplaceUpdateRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18850,7 +18897,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18916,7 +18963,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "inplaceUpdate"]) + def __init__( + self, + inplaceUpdate: bool, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) class ToolTimeLimit(ProcessRequirement): @@ -18931,23 +18995,6 @@ class ToolTimeLimit(ProcessRequirement): """ - def __init__( - self, - timelimit: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ToolTimeLimit" - self.timelimit = timelimit - def __eq__(self, other: Any) -> bool: if isinstance(other, ToolTimeLimit): return bool( @@ -18964,8 +19011,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ToolTimeLimit": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18994,7 +19041,7 @@ def fromDoc( timelimit = load_field( _doc.get("timelimit"), - union_of_inttype_or_ExpressionLoader, + union_of_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("timelimit") @@ -19036,7 +19083,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19102,23 +19149,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "timelimit"]) - - -class ExpressionToolOutputParameter(OutputParameter): - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + timelimit: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19128,13 +19163,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ToolTimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + + +class ExpressionToolOutputParameter(OutputParameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionToolOutputParameter): @@ -19168,8 +19204,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionToolOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19515,7 +19551,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19540,11 +19576,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, @@ -19603,31 +19639,19 @@ def save( r["$namespaces"] = self.loadingOptions.namespaces if self.loadingOptions.schemas: r["$schemas"] = self.loadingOptions.schemas - return r - - attrs = frozenset( - ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] - ) - - -class WorkflowInputParameter(InputParameter): - id: str + return r def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + id: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19641,13 +19665,17 @@ def __init__( self.secondaryFiles = secondaryFiles self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.id = id self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default self.type_ = type_ - self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] + ) + + +class WorkflowInputParameter(InputParameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowInputParameter): @@ -19689,8 +19717,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -20224,7 +20252,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20249,11 +20277,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -20343,7 +20371,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + default: CWLObjectType | None = None, + inputBinding: InputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -20374,39 +20438,6 @@ class ExpressionTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - expression: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_ = "ExpressionTool" - self.expression = expression - def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionTool): return bool( @@ -20445,8 +20476,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -20904,7 +20935,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20929,7 +20960,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -21012,7 +21043,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -21039,38 +21103,6 @@ class WorkflowOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - outputSource: Optional[Any] = None, - linkMerge: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowOutputParameter): return bool( @@ -21107,8 +21139,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21548,7 +21580,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21573,11 +21605,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, outputSource=outputSource, linkMerge=linkMerge, @@ -21647,7 +21679,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -21662,6 +21726,7 @@ def save( ) +@trait class Sink(Saveable): pass @@ -21716,36 +21781,6 @@ class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): id: str - def __init__( - self, - id: Any, - source: Optional[Any] = None, - linkMerge: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - label: Optional[Any] = None, - default: Optional[Any] = None, - valueFrom: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.source = source - self.linkMerge = linkMerge - self.loadContents = loadContents - self.loadListing = loadListing - self.label = label - self.default = default - self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepInput): return bool( @@ -21780,8 +21815,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepInput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22173,7 +22208,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22198,7 +22233,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), source=source, linkMerge=linkMerge, loadContents=loadContents, @@ -22268,7 +22303,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + label: None | str = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.source = source + self.linkMerge = linkMerge + self.loadContents = loadContents + self.loadListing = loadListing + self.label = label + self.default = default + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "source", @@ -22297,22 +22362,6 @@ class WorkflowStepOutput(IdentifierRequired): id: str - def __init__( - self, - id: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepOutput): return bool(self.id == other.id) @@ -22327,8 +22376,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepOutput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22391,7 +22440,7 @@ def fromDoc( _errors__.append(ValidationException("missing id")) if not __original_id_is_none: baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22414,7 +22463,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -22444,7 +22493,23 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["id"]) + def __init__( + self, + id: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + + attrs: ClassVar[Collection[str]] = frozenset(["id"]) class WorkflowStep(IdentifierRequired, Labeled, Documented): @@ -22509,40 +22574,6 @@ class WorkflowStep(IdentifierRequired, Labeled, Documented): id: str - def __init__( - self, - id: Any, - in_: Any, - out: Any, - run: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - scatter: Optional[Any] = None, - scatterMethod: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.run = run - self.scatter = scatter - self.scatterMethod = scatterMethod - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStep): return bool( @@ -22581,8 +22612,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStep": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23073,7 +23104,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23098,7 +23129,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, in_=in_, @@ -23174,7 +23205,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any] = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.label = label + self.doc = doc + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.run = run + self.scatter = scatter + self.scatterMethod = scatterMethod + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -23242,39 +23307,6 @@ class Workflow(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - steps: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_ = "Workflow" - self.steps = steps - def __eq__(self, other: Any) -> bool: if isinstance(other, Workflow): return bool( @@ -23313,8 +23345,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Workflow": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23772,7 +23804,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23797,7 +23829,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -23877,7 +23909,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -23900,21 +23965,6 @@ class SubworkflowFeatureRequirement(ProcessRequirement): """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -23929,8 +23979,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SubworkflowFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23953,7 +24003,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24009,20 +24059,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class ScatterFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24032,7 +24072,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class ScatterFeatureRequirement(ProcessRequirement): + """ + Indicates that the workflow platform must support the `scatter` and + `scatterMethod` fields of [WorkflowStep](#WorkflowStep). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, ScatterFeatureRequirement): @@ -24048,8 +24098,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ScatterFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24072,7 +24122,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24128,20 +24178,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class MultipleInputFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24151,7 +24191,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class MultipleInputFeatureRequirement(ProcessRequirement): + """ + Indicates that the workflow platform must support multiple inbound data links + listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -24167,8 +24217,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MultipleInputFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24191,7 +24241,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24247,20 +24297,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class StepInputExpressionRequirement(ProcessRequirement): - """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24270,7 +24310,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class StepInputExpressionRequirement(ProcessRequirement): + """ + Indicate that the workflow platform must support the `valueFrom` field + of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, StepInputExpressionRequirement): @@ -24286,8 +24336,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "StepInputExpressionRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24310,7 +24360,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24366,15 +24416,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class Secrets(ProcessRequirement): def __init__( self, - secrets: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24384,9 +24429,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "Secrets" - self.secrets = secrets + self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + +class Secrets(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -24401,8 +24449,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Secrets": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24473,7 +24521,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24535,25 +24583,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "secrets"]) - - -class ProcessGenerator(Process): - id: str - def __init__( self, - inputs: Any, - outputs: Any, - run: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + secrets: Sequence[str], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24563,16 +24597,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_ = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + + +class ProcessGenerator(Process): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -24612,8 +24644,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ProcessGenerator": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25073,7 +25105,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25098,7 +25130,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -25177,7 +25209,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter | WorkflowInputParameter], + outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter], + run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -25199,23 +25264,6 @@ class MPIRequirement(ProcessRequirement): """ - def __init__( - self, - processes: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "MPIRequirement" - self.processes = processes - def __eq__(self, other: Any) -> bool: if isinstance(other, MPIRequirement): return bool( @@ -25232,8 +25280,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MPIRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25304,7 +25352,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25370,23 +25418,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "processes"]) - - -class CUDARequirement(ProcessRequirement): - """ - Require support for NVIDA CUDA (GPU hardware acceleration). - - """ - def __init__( self, - cudaComputeCapability: Any, - cudaVersionMin: Any, - cudaDeviceCountMax: Optional[Any] = None, - cudaDeviceCountMin: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + processes: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -25396,11 +25432,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +class CUDARequirement(ProcessRequirement): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -25430,8 +25472,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CUDARequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25644,7 +25686,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25734,23 +25776,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - [ - "class", - "cudaComputeCapability", - "cudaDeviceCountMax", - "cudaDeviceCountMin", - "cudaVersionMin", - ] - ) - - -class ShmSize(ProcessRequirement): def __init__( self, - shmSize: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + cudaComputeCapability: Sequence[str] | str, + cudaVersionMin: str, + cudaDeviceCountMax: None | int | str = None, + cudaDeviceCountMin: None | int | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -25760,9 +25793,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "cudaComputeCapability", + "cudaDeviceCountMax", + "cudaDeviceCountMin", + "cudaVersionMin", + ] + ) + +class ShmSize(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -25777,8 +25825,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShmSize": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25849,7 +25897,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25912,10 +25960,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "shmSize"]) + def __init__( + self, + shmSize: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.shmSize = shmSize + + attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) -_vocab = { +_vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", @@ -26050,8 +26115,8 @@ def save( "v1.0.dev4": "https://w3id.org/cwl/cwl#v1.0.dev4", "v1.1": "https://w3id.org/cwl/cwl#v1.1", "v1.1.0-dev1": "https://w3id.org/cwl/cwl#v1.1.0-dev1", -} -_rvocab = { +}) +_rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", @@ -26186,15 +26251,15 @@ def save( "https://w3id.org/cwl/cwl#v1.0.dev4": "v1.0.dev4", "https://w3id.org/cwl/cwl#v1.1": "v1.1", "https://w3id.org/cwl/cwl#v1.1.0-dev1": "v1.1.0-dev1", -} - -strtype = _PrimitiveLoader(str) -inttype = _PrimitiveLoader(int) -floattype = _PrimitiveLoader(float) -booltype = _PrimitiveLoader(bool) -None_type = _PrimitiveLoader(type(None)) -Any_type = _AnyLoader() -PrimitiveTypeLoader = _EnumLoader( +}) + +strtype: Final = _PrimitiveLoader(str) +inttype: Final = _PrimitiveLoader(int) +floattype: Final = _PrimitiveLoader(float) +booltype: Final = _PrimitiveLoader(bool) +None_type: Final = _PrimitiveLoader(type(None)) +Any_type: Final = _AnyLoader() +PrimitiveTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -26220,17 +26285,17 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +AnyLoader: Final = _EnumLoader(("Any",), "Any") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader = _RecordLoader(RecordField, None, None) -RecordSchemaLoader = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader = _EnumLoader( +RecordFieldLoader: Final = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) +EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -26249,54 +26314,64 @@ def save( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader = _RecordLoader(CWLRecordSchema, None, None) -FileLoader = _RecordLoader(File, None, None) -DirectoryLoader = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader = _UnionLoader( +CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) +CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) +CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) +FileLoader: Final = _RecordLoader(File, None, None) +DirectoryLoader: Final = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( ( None_type, CWLObjectTypeLoader, ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( union_of_None_type_or_CWLObjectTypeLoader ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( union_of_None_type_or_CWLObjectTypeLoader, "None", None, None ) -InlineJavascriptRequirementLoader = _RecordLoader( +InlineJavascriptRequirementLoader: Final = _RecordLoader( InlineJavascriptRequirement, None, None ) -SchemaDefRequirementLoader = _RecordLoader(SchemaDefRequirement, None, None) -LoadListingRequirementLoader = _RecordLoader(LoadListingRequirement, None, None) -DockerRequirementLoader = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader = _RecordLoader(SoftwareRequirement, None, None) -InitialWorkDirRequirementLoader = _RecordLoader(InitialWorkDirRequirement, None, None) -EnvVarRequirementLoader = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader = _RecordLoader(ShellCommandRequirement, None, None) -ResourceRequirementLoader = _RecordLoader(ResourceRequirement, None, None) -WorkReuseLoader = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader = _RecordLoader(NetworkAccess, None, None) -InplaceUpdateRequirementLoader = _RecordLoader(InplaceUpdateRequirement, None, None) -ToolTimeLimitLoader = _RecordLoader(ToolTimeLimit, None, None) -SubworkflowFeatureRequirementLoader = _RecordLoader( +SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) +LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) +DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) +SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) +InitialWorkDirRequirementLoader: Final = _RecordLoader( + InitialWorkDirRequirement, None, None +) +EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) +ShellCommandRequirementLoader: Final = _RecordLoader( + ShellCommandRequirement, None, None +) +ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) +WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) +InplaceUpdateRequirementLoader: Final = _RecordLoader( + InplaceUpdateRequirement, None, None +) +ToolTimeLimitLoader: Final = _RecordLoader(ToolTimeLimit, None, None) +SubworkflowFeatureRequirementLoader: Final = _RecordLoader( SubworkflowFeatureRequirement, None, None ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( +ScatterFeatureRequirementLoader: Final = _RecordLoader( + ScatterFeatureRequirement, None, None +) +MultipleInputFeatureRequirementLoader: Final = _RecordLoader( MultipleInputFeatureRequirement, None, None ) -StepInputExpressionRequirementLoader = _RecordLoader( +StepInputExpressionRequirementLoader: Final = _RecordLoader( StepInputExpressionRequirement, None, None ) -SecretsLoader = _RecordLoader(Secrets, None, None) -MPIRequirementLoader = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader = _RecordLoader(CUDARequirement, None, None) -ShmSizeLoader = _RecordLoader(ShmSize, None, None) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _UnionLoader( +SecretsLoader: Final = _RecordLoader(Secrets, None, None) +MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) +CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) +ShmSizeLoader: Final = _RecordLoader(ShmSize, None, None) +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( + Final +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -26321,24 +26396,32 @@ def save( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( + Final +) = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, CWLObjectTypeLoader, ) ) -map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: ( + Final +) = _MapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True, ) -CWLInputFileLoader = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader -CWLVersionLoader = _EnumLoader( +CWLInputFileLoader: Final = ( + map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader +) +CWLVersionLoader: Final = _EnumLoader( ( "draft-2", "draft-3.dev1", @@ -26360,7 +26443,7 @@ def save( """ Version symbols for published CWL document versions. """ -LoadListingEnumLoader = _EnumLoader( +LoadListingEnumLoader: Final = _EnumLoader( ( "no_listing", "shallow_listing", @@ -26376,31 +26459,45 @@ def save( shallow_listing: Only load the top level listing, do not recurse into subdirectories. deep_listing: Load the directory listing and recursively load all subdirectories as well. """ -ExpressionLoader = _ExpressionLoader(str) -InputBindingLoader = _RecordLoader(InputBinding, None, None) -InputRecordFieldLoader = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader = _RecordLoader(OutputArraySchema, None, None) -SecondaryFileSchemaLoader = _RecordLoader(SecondaryFileSchema, None, None) -EnvironmentDefLoader = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader = _RecordLoader(CommandInputRecordField, None, None) -CommandInputRecordSchemaLoader = _RecordLoader(CommandInputRecordSchema, None, None) -CommandInputEnumSchemaLoader = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader = _RecordLoader(CommandInputArraySchema, None, None) -CommandOutputRecordFieldLoader = _RecordLoader(CommandOutputRecordField, None, None) -CommandOutputRecordSchemaLoader = _RecordLoader(CommandOutputRecordSchema, None, None) -CommandOutputEnumSchemaLoader = _RecordLoader(CommandOutputEnumSchema, None, None) -CommandOutputArraySchemaLoader = _RecordLoader(CommandOutputArraySchema, None, None) -CommandInputParameterLoader = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader = _RecordLoader(CommandOutputParameter, None, None) -stdinLoader = _EnumLoader(("stdin",), "stdin") +ExpressionLoader: Final = _ExpressionLoader(str) +InputBindingLoader: Final = _RecordLoader(InputBinding, None, None) +InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) +InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) +InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) +InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) +OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) +OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) +OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) +OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) +SecondaryFileSchemaLoader: Final = _RecordLoader(SecondaryFileSchema, None, None) +EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) +CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) +CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) +CommandInputRecordFieldLoader: Final = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final = _RecordLoader( + CommandInputRecordSchema, None, None +) +CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) +CommandInputArraySchemaLoader: Final = _RecordLoader( + CommandInputArraySchema, None, None +) +CommandOutputRecordFieldLoader: Final = _RecordLoader( + CommandOutputRecordField, None, None +) +CommandOutputRecordSchemaLoader: Final = _RecordLoader( + CommandOutputRecordSchema, None, None +) +CommandOutputEnumSchemaLoader: Final = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final = _RecordLoader( + CommandOutputArraySchema, None, None +) +CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) +CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) +stdinLoader: Final = _EnumLoader(("stdin",), "stdin") """ Only valid as a `type` for a `CommandLineTool` input with no `inputBinding` set. `stdin` must not be specified at the `CommandLineTool` @@ -26422,7 +26519,7 @@ def save( stdin: ${inputs.an_input_name.path} ``` """ -stdoutLoader = _EnumLoader(("stdout",), "stdout") +stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26466,7 +26563,7 @@ def save( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26510,15 +26607,15 @@ def save( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader = _RecordLoader(CommandLineTool, None, None) -SoftwarePackageLoader = _RecordLoader(SoftwarePackage, None, None) -DirentLoader = _RecordLoader(Dirent, None, None) -ExpressionToolOutputParameterLoader = _RecordLoader( +CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) +SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) +DirentLoader: Final = _RecordLoader(Dirent, None, None) +ExpressionToolOutputParameterLoader: Final = _RecordLoader( ExpressionToolOutputParameter, None, None ) -WorkflowInputParameterLoader = _RecordLoader(WorkflowInputParameter, None, None) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +WorkflowInputParameterLoader: Final = _RecordLoader(WorkflowInputParameter, None, None) +ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) +LinkMergeMethodLoader: Final = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -26528,10 +26625,12 @@ def save( """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader = _RecordLoader(WorkflowOutputParameter, None, None) -WorkflowStepInputLoader = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader = _EnumLoader( +WorkflowOutputParameterLoader: Final = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) +WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) +ScatterMethodLoader: Final = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -26542,19 +26641,21 @@ def save( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader = _RecordLoader(Workflow, None, None) -ProcessGeneratorLoader = _RecordLoader(ProcessGenerator, None, None) -array_of_strtype = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype = _UnionLoader( +WorkflowStepLoader: Final = _RecordLoader(WorkflowStep, None, None) +WorkflowLoader: Final = _RecordLoader(Workflow, None, None) +ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) +array_of_strtype: Final = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +uri_strtype_True_False_None_None: Final = _URILoader(strtype, True, False, None, None) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -26565,10 +26666,14 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -26580,51 +26685,57 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader = _UnionLoader( +array_of_RecordFieldLoader: Final = _ArrayLoader(RecordFieldLoader) +union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") +union_of_None_type_or_strtype: Final = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_None: Final = _URILoader( union_of_None_type_or_strtype, True, False, None, None ) -uri_array_of_strtype_True_False_None_None = _URILoader( +uri_array_of_strtype_True_False_None_None: Final = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2 = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None = _URILoader( +Enum_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2 = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2 = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2 = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +Array_nameLoader: Final = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") +Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") +Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -26633,10 +26744,14 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -26646,57 +26761,66 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader = _UnionLoader( +array_of_CWLRecordFieldLoader: Final = _ArrayLoader(CWLRecordFieldLoader) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" ) -File_classLoader = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None = _URILoader( +File_classLoader: Final = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_False_False_None_None: Final = _URILoader( union_of_None_type_or_strtype, False, False, None, None ) -union_of_None_type_or_inttype = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader ) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( + _UnionLoader( + ( + None_type, + array_of_union_of_FileLoader_or_DirectoryLoader, + ) ) ) -secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( + Final +) = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader @@ -26704,34 +26828,38 @@ def save( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -uri_union_of_None_type_or_strtype_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_True: Final = _URILoader( union_of_None_type_or_strtype, True, False, None, True ) -Directory_classLoader = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None = _URILoader( +Directory_classLoader: Final = _EnumLoader(("Directory",), "Directory_class") +uri_Directory_classLoader_False_True_None_None: Final = _URILoader( Directory_classLoader, False, True, None, None ) -union_of_None_type_or_booltype = _UnionLoader( +union_of_None_type_or_booltype: Final = _UnionLoader( ( None_type, booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader = _UnionLoader( +union_of_None_type_or_LoadListingEnumLoader: Final = _UnionLoader( ( None_type, LoadListingEnumLoader, ) ) -array_of_SecondaryFileSchemaLoader = _ArrayLoader(SecondaryFileSchemaLoader) -union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +array_of_SecondaryFileSchemaLoader: Final = _ArrayLoader(SecondaryFileSchemaLoader) +union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( + Final +) = _UnionLoader( ( None_type, SecondaryFileSchemaLoader, array_of_SecondaryFileSchemaLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( + Final +) = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader @@ -26739,32 +26867,40 @@ def save( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, ) ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: ( + Final +) = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, strtype, ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( + _URILoader( + union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True + ) ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -26773,10 +26909,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -26786,29 +26926,35 @@ def save( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_InputRecordFieldLoader = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader = _UnionLoader( +array_of_InputRecordFieldLoader: Final = _ArrayLoader(InputRecordFieldLoader) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( + _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") ) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -26817,10 +26963,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -26830,69 +26980,89 @@ def save( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_OutputRecordFieldLoader = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader = _UnionLoader( +array_of_OutputRecordFieldLoader: Final = _ArrayLoader(OutputRecordFieldLoader) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( + _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") ) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader = _UnionLoader( - ( - CommandInputParameterLoader, - WorkflowInputParameterLoader, +union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final = ( + _UnionLoader( + ( + CommandInputParameterLoader, + WorkflowInputParameterLoader, + ) ) ) -array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader = ( +array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final = ( _ArrayLoader(union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader) ) -idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader = _IdMapLoader( +idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: ( + Final +) = _IdMapLoader( array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader, "id", "type", ) -union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader = _UnionLoader( +union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: ( + Final +) = _UnionLoader( ( CommandOutputParameterLoader, ExpressionToolOutputParameterLoader, WorkflowOutputParameterLoader, ) ) -array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader = _ArrayLoader( +array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: ( + Final +) = _ArrayLoader( union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader ) -idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: ( + Final +) = _IdMapLoader( array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader, "id", "type", ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( + Final +) = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -26918,104 +27088,118 @@ def save( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader = _UnionLoader( +union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( ( None_type, CWLVersionLoader, ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_CWLVersionLoader, False, True, None, None ) -InlineJavascriptRequirement_classLoader = _EnumLoader( +InlineJavascriptRequirement_classLoader: Final = _EnumLoader( ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" ) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( InlineJavascriptRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_array_of_strtype: Final = _UnionLoader( ( None_type, array_of_strtype, ) ) -SchemaDefRequirement_classLoader = _EnumLoader( +SchemaDefRequirement_classLoader: Final = _EnumLoader( ("SchemaDefRequirement",), "SchemaDefRequirement_class" ) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( SchemaDefRequirement_classLoader, False, True, None, None ) -union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _UnionLoader( +union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( + Final +) = _UnionLoader( ( CommandInputRecordSchemaLoader, CommandInputEnumSchemaLoader, CommandInputArraySchemaLoader, ) ) -array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _ArrayLoader( +array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( + Final +) = _ArrayLoader( union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, ) ) -union_of_None_type_or_booltype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_booltype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, booltype, ExpressionLoader, ) ) -LoadListingRequirement_classLoader = _EnumLoader( +LoadListingRequirement_classLoader: Final = _EnumLoader( ("LoadListingRequirement",), "LoadListingRequirement_class" ) -uri_LoadListingRequirement_classLoader_False_True_None_None = _URILoader( +uri_LoadListingRequirement_classLoader_False_True_None_None: Final = _URILoader( LoadListingRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, inttype, ExpressionLoader, ) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, - array_of_strtype, +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + array_of_strtype, + ) ) ) -union_of_None_type_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_ExpressionLoader: Final = _UnionLoader( ( None_type, ExpressionLoader, ) ) -union_of_None_type_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -27024,10 +27208,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -27037,31 +27225,39 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader = _ArrayLoader(CommandInputRecordFieldLoader) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final = _ArrayLoader( + CommandInputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( _IdMapLoader( union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -27070,10 +27266,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -27083,37 +27283,45 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_CommandOutputRecordFieldLoader = _ArrayLoader(CommandOutputRecordFieldLoader) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final = _ArrayLoader( + CommandOutputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( _IdMapLoader( union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, stdinLoader, @@ -27124,12 +27332,16 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, stdoutLoader, @@ -27141,72 +27353,82 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader = _EnumLoader(("CommandLineTool",), "CommandLineTool_class") -uri_CommandLineTool_classLoader_False_True_None_None = _URILoader( +CommandLineTool_classLoader: Final = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" +) +uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( CommandLineTool_classLoader, False, True, None, None ) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( +array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( array_of_CommandInputParameterLoader, "id", "type" ) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( +array_of_CommandOutputParameterLoader: Final = _ArrayLoader( + CommandOutputParameterLoader +) +idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( array_of_CommandOutputParameterLoader, "id", "type" ) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) ) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype = _UnionLoader( +array_of_inttype: Final = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final = _UnionLoader( ( None_type, array_of_inttype, ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_classLoader: Final = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( +uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( DockerRequirement_classLoader, False, True, None, None ) -SoftwareRequirement_classLoader = _EnumLoader( +SoftwareRequirement_classLoader: Final = _EnumLoader( ("SoftwareRequirement",), "SoftwareRequirement_class" ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( +uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( SoftwareRequirement_classLoader, False, True, None, None ) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( +array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) +idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( array_of_SoftwarePackageLoader, "package", "specs" ) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( union_of_None_type_or_array_of_strtype, False, False, None, True ) -InitialWorkDirRequirement_classLoader = _EnumLoader( +InitialWorkDirRequirement_classLoader: Final = _EnumLoader( ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" ) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _URILoader( InitialWorkDirRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: ( + Final +) = _UnionLoader( ( None_type, FileLoader, @@ -27216,133 +27438,158 @@ def save( ExpressionLoader, ) ) -array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader = _ArrayLoader( +array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: ( + Final +) = _ArrayLoader( union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader ) -union_of_array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader_or_ExpressionLoader = _UnionLoader( +union_of_array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader_or_ExpressionLoader: ( + Final +) = _UnionLoader( ( array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader, ExpressionLoader, ) ) -EnvVarRequirement_classLoader = _EnumLoader( +EnvVarRequirement_classLoader: Final = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( +uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( EnvVarRequirement_classLoader, False, True, None, None ) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( +array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) +idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( array_of_EnvironmentDefLoader, "envName", "envValue" ) -ShellCommandRequirement_classLoader = _EnumLoader( +ShellCommandRequirement_classLoader: Final = _EnumLoader( ("ShellCommandRequirement",), "ShellCommandRequirement_class" ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( ShellCommandRequirement_classLoader, False, True, None, None ) -ResourceRequirement_classLoader = _EnumLoader( +ResourceRequirement_classLoader: Final = _EnumLoader( ("ResourceRequirement",), "ResourceRequirement_class" ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( ResourceRequirement_classLoader, False, True, None, None ) -WorkReuse_classLoader = _EnumLoader(("WorkReuse",), "WorkReuse_class") -uri_WorkReuse_classLoader_False_True_None_None = _URILoader( +union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( + ( + None_type, + inttype, + inttype, + ExpressionLoader, + ) +) +WorkReuse_classLoader: Final = _EnumLoader(("WorkReuse",), "WorkReuse_class") +uri_WorkReuse_classLoader_False_True_None_None: Final = _URILoader( WorkReuse_classLoader, False, True, None, None ) -union_of_booltype_or_ExpressionLoader = _UnionLoader( +union_of_booltype_or_ExpressionLoader: Final = _UnionLoader( ( booltype, ExpressionLoader, ) ) -NetworkAccess_classLoader = _EnumLoader(("NetworkAccess",), "NetworkAccess_class") -uri_NetworkAccess_classLoader_False_True_None_None = _URILoader( +NetworkAccess_classLoader: Final = _EnumLoader( + ("NetworkAccess",), "NetworkAccess_class" +) +uri_NetworkAccess_classLoader_False_True_None_None: Final = _URILoader( NetworkAccess_classLoader, False, True, None, None ) -InplaceUpdateRequirement_classLoader = _EnumLoader( +InplaceUpdateRequirement_classLoader: Final = _EnumLoader( ("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class" ) -uri_InplaceUpdateRequirement_classLoader_False_True_None_None = _URILoader( +uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final = _URILoader( InplaceUpdateRequirement_classLoader, False, True, None, None ) -ToolTimeLimit_classLoader = _EnumLoader(("ToolTimeLimit",), "ToolTimeLimit_class") -uri_ToolTimeLimit_classLoader_False_True_None_None = _URILoader( +ToolTimeLimit_classLoader: Final = _EnumLoader( + ("ToolTimeLimit",), "ToolTimeLimit_class" +) +uri_ToolTimeLimit_classLoader_False_True_None_None: Final = _URILoader( ToolTimeLimit_classLoader, False, True, None, None ) -union_of_inttype_or_ExpressionLoader = _UnionLoader( +union_of_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( + inttype, inttype, ExpressionLoader, ) ) -union_of_None_type_or_InputBindingLoader = _UnionLoader( +union_of_None_type_or_InputBindingLoader: Final = _UnionLoader( ( None_type, InputBindingLoader, ) ) -ExpressionTool_classLoader = _EnumLoader(("ExpressionTool",), "ExpressionTool_class") -uri_ExpressionTool_classLoader_False_True_None_None = _URILoader( +ExpressionTool_classLoader: Final = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" +) +uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( ExpressionTool_classLoader, False, True, None, None ) -array_of_WorkflowInputParameterLoader = _ArrayLoader(WorkflowInputParameterLoader) -idmap_inputs_array_of_WorkflowInputParameterLoader = _IdMapLoader( +array_of_WorkflowInputParameterLoader: Final = _ArrayLoader( + WorkflowInputParameterLoader +) +idmap_inputs_array_of_WorkflowInputParameterLoader: Final = _IdMapLoader( array_of_WorkflowInputParameterLoader, "id", "type" ) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( +array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( ExpressionToolOutputParameterLoader ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _IdMapLoader( array_of_ExpressionToolOutputParameterLoader, "id", "type" ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) ) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( +union_of_None_type_or_LinkMergeMethodLoader: Final = _UnionLoader( ( None_type, LinkMergeMethodLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) ) -array_of_WorkflowStepInputLoader = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader = _IdMapLoader( +array_of_WorkflowStepInputLoader: Final = _ArrayLoader(WorkflowStepInputLoader) +idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( array_of_WorkflowStepInputLoader, "id", "source" ) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( union_of_strtype_or_WorkflowStepOutputLoader ) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) ) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( + Final +) = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type = _UnionLoader( +array_of_Any_type: Final = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( ( None_type, array_of_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _IdMapLoader( union_of_None_type_or_array_of_Any_type, "class", "None" ) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -27351,73 +27598,87 @@ def save( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: ( + Final +) = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) ) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( +union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_ScatterMethodLoader, False, True, None, None ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( +Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") +uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( Workflow_classLoader, False, True, None, None ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( +array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( + WorkflowOutputParameterLoader +) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( array_of_WorkflowOutputParameterLoader, "id", "type" ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( +array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) +union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( + (array_of_WorkflowStepLoader,) +) +idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( union_of_array_of_WorkflowStepLoader, "id", "None" ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( SubworkflowFeatureRequirement_classLoader, False, True, None, None ) -ScatterFeatureRequirement_classLoader = _EnumLoader( +ScatterFeatureRequirement_classLoader: Final = _EnumLoader( ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" ) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( ScatterFeatureRequirement_classLoader, False, True, None, None ) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( + _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) ) -StepInputExpressionRequirement_classLoader = _EnumLoader( +StepInputExpressionRequirement_classLoader: Final = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( StepInputExpressionRequirement_classLoader, False, True, None, None ) -uri_strtype_False_True_None_None = _URILoader(strtype, False, True, None, None) -uri_array_of_strtype_False_False_0_None = _URILoader( +uri_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) +uri_array_of_strtype_False_False_0_None: Final = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_strtype_or_array_of_strtype = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( + ( + inttype, + ExpressionLoader, + ) +) +union_of_strtype_or_array_of_strtype: Final = _UnionLoader( ( strtype, array_of_strtype, ) ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -27425,10 +27686,14 @@ def save( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -27450,12 +27715,15 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" +) def load_document( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -27472,9 +27740,9 @@ def load_document( def load_document_with_metadata( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -27492,7 +27760,7 @@ def load_document_with_metadata( def load_document_by_string( string: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: yaml = yaml_no_ts() result = yaml.load(string) @@ -27513,7 +27781,7 @@ def load_document_by_string( def load_document_by_yaml( yaml: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """ Shortcut to load via a YAML object. diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index d1aa7169..5247ccdb 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -205,7 +205,7 @@ def check_all_types( for parm_id in sourceField: srcs_of_sink += [src_dict[parm_id]] else: - parm_id = cast(str, sourceField) + parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( f"{sourceName} not found: {parm_id}" @@ -307,8 +307,7 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None: ) else: clt.stdin = ( - "$(inputs.%s.path)" - % cast(str, inp.id).rpartition("#")[2].split("/")[-1] + "$(inputs.%s.path)" % inp.id.rpartition("#")[2].split("/")[-1] ) inp.type_ = "File" @@ -391,7 +390,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] == in_.id.split("#")[-1]: + if 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") diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index 85f744fc..77a7c937 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -3,18 +3,24 @@ # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. +from __future__ import annotations + import copy import logging import os import pathlib +import sys import tempfile import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec -from abc import ABC, abstractmethod +from abc import ABCMeta, abstractmethod from collections.abc import MutableMapping, MutableSequence, Sequence +from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from typing import Any, Final, Optional, Union, cast +from mypy_extensions import trait +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -27,22 +33,28 @@ from schema_salad.sourceline import SourceLine, add_lc_filename from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ -_vocab: dict[str, str] = {} -_rvocab: dict[str, str] = {} +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} _logger: Final = logging.getLogger("salad") -IdxType = MutableMapping[str, tuple[Any, "LoadingOptions"]] +IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +S = TypeVar("S", bound="Saveable") class LoadingOptions: idx: Final[IdxType] - fileuri: Final[Optional[str]] + fileuri: Final[str | None] baseuri: Final[str] namespaces: Final[MutableMapping[str, str]] schemas: Final[MutableSequence[str]] - original_doc: Final[Optional[Any]] + original_doc: Final[Any | None] addl_metadata: Final[MutableMapping[str, Any]] fetcher: Final[Fetcher] vocab: Final[dict[str, str]] @@ -50,24 +62,24 @@ class LoadingOptions: cache: Final[CacheType] imports: Final[list[str]] includes: Final[list[str]] - no_link_check: Final[Optional[bool]] - container: Final[Optional[str]] + no_link_check: Final[bool | None] + container: Final[str | None] def __init__( self, - fetcher: Optional[Fetcher] = None, - namespaces: Optional[dict[str, str]] = None, - schemas: Optional[list[str]] = None, - fileuri: Optional[str] = None, - copyfrom: Optional["LoadingOptions"] = None, - original_doc: Optional[Any] = None, - addl_metadata: Optional[dict[str, str]] = None, - baseuri: Optional[str] = None, - idx: Optional[IdxType] = None, - imports: Optional[list[str]] = None, - includes: Optional[list[str]] = None, - no_link_check: Optional[bool] = None, - container: Optional[str] = None, + fetcher: Fetcher | None = None, + namespaces: dict[str, str] | None = None, + schemas: list[str] | None = None, + fileuri: str | None = None, + copyfrom: LoadingOptions | None = None, + original_doc: Any | None = None, + addl_metadata: dict[str, str] | None = None, + baseuri: str | None = None, + idx: IdxType | None = None, + imports: list[str] | None = None, + includes: list[str] | None = None, + no_link_check: bool | None = None, + container: str | None = None, ) -> None: """Create a LoadingOptions object.""" self.original_doc = original_doc @@ -79,7 +91,7 @@ def __init__( self.idx = temp_idx if fileuri is not None: - temp_fileuri: Optional[str] = fileuri + temp_fileuri: str | None = fileuri else: temp_fileuri = copyfrom.fileuri if copyfrom is not None else None self.fileuri = temp_fileuri @@ -121,13 +133,13 @@ def __init__( self.includes = temp_includes if no_link_check is not None: - temp_no_link_check: Optional[bool] = no_link_check + temp_no_link_check: bool | None = no_link_check else: temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False self.no_link_check = temp_no_link_check if container is not None: - temp_container: Optional[str] = container + temp_container: str | None = container else: temp_container = copyfrom.container if copyfrom is not None else None self.container = temp_container @@ -201,7 +213,8 @@ def graph(self) -> Graph: return graph -class Saveable(ABC): +@trait +class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @classmethod @@ -211,8 +224,8 @@ def fromDoc( _doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - ) -> "Saveable": + docRoot: str | None = None, + ) -> Self: """Construct this object from the result of yaml.load().""" @abstractmethod @@ -223,11 +236,11 @@ def save( def load_field( - val: Union[str, dict[str, str]], + val: Any | None, fieldtype: "_Loader", baseuri: str, loadingOptions: LoadingOptions, - lc: Optional[list[Any]] = None, + lc: Any | None = None, ) -> Any: """Load field.""" if isinstance(val, MutableMapping): @@ -251,7 +264,9 @@ def load_field( return fieldtype.load(val, baseuri, loadingOptions, lc=lc) -save_type = Optional[Union[MutableMapping[str, Any], MutableSequence[Any], int, float, bool, str]] +save_type: TypeAlias = ( + None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str +) def extract_type(val_type: type[Any]) -> str: @@ -367,7 +382,7 @@ def expand_url( loadingOptions: LoadingOptions, scoped_id: bool = False, vocab_term: bool = False, - scoped_ref: Optional[int] = None, + scoped_ref: int | None = None, ) -> str: if url in ("@id", "@type"): return url @@ -434,9 +449,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> Any | None: pass @@ -446,8 +461,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if doc is not None: return doc @@ -455,7 +470,7 @@ def load( class _PrimitiveLoader(_Loader): - def __init__(self, tp: Union[type, tuple[type[str], type[str]]]) -> None: + def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: self.tp: Final = tp def load( @@ -463,8 +478,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") @@ -483,9 +498,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> list[Any]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -535,9 +550,9 @@ class _MapLoader(_Loader): def __init__( self, values: _Loader, - name: Optional[str] = None, - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + name: str | None = None, + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.values: Final = values self.name: Final = name @@ -549,9 +564,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> dict[str, Any]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -584,11 +599,11 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if doc in self.symbols: - return doc + return cast(str, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -604,75 +619,76 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: r: Final[list[dict[str, Any]]] = [] - if isinstance(doc, MutableSequence): - for d in doc: - if isinstance(d, str): - if d.endswith("?"): - r.append({"pattern": d[:-1], "required": False}) - else: - r.append({"pattern": d}) - elif isinstance(d, dict): - new_dict1: dict[str, Any] = {} - dict_copy = copy.deepcopy(d) - if "pattern" in dict_copy: - new_dict1["pattern"] = dict_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {d}" + match doc: + case MutableSequence() as dlist: + for d in dlist: + if isinstance(d, str): + if d.endswith("?"): + r.append({"pattern": d[:-1], "required": False}) + else: + r.append({"pattern": d}) + elif isinstance(d, dict): + new_dict1: dict[str, Any] = {} + dict_copy = copy.deepcopy(d) + if "pattern" in dict_copy: + new_dict1["pattern"] = dict_copy.pop("pattern") + else: + raise ValidationException( + f"Missing pattern in secondaryFiles specification entry: {d}" + ) + new_dict1["required"] = ( + dict_copy.pop("required") if "required" in dict_copy else None ) - new_dict1["required"] = ( - dict_copy.pop("required") if "required" in dict_copy else None - ) - if len(dict_copy): - raise ValidationException( - "Unallowed values in secondaryFiles specification entry: {}".format( - dict_copy + if len(dict_copy): + raise ValidationException( + "Unallowed values in secondaryFiles specification entry: {}".format( + dict_copy + ) ) - ) - r.append(new_dict1) + r.append(new_dict1) + else: + raise ValidationException( + "Expected a string or sequence of (strings or mappings)." + ) + case MutableMapping() as decl: + new_dict2 = {} + doc_copy = copy.deepcopy(decl) + if "pattern" in doc_copy: + new_dict2["pattern"] = doc_copy.pop("pattern") else: raise ValidationException( - "Expected a string or sequence of (strings or mappings)." + f"Missing pattern in secondaryFiles specification entry: {decl}" ) - elif isinstance(doc, MutableMapping): - new_dict2: Final = {} - doc_copy: Final = copy.deepcopy(doc) - if "pattern" in doc_copy: - new_dict2["pattern"] = doc_copy.pop("pattern") - else: - raise ValidationException( - f"Missing pattern in secondaryFiles specification entry: {doc}" - ) - new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None + new_dict2["required"] = doc_copy.pop("required") if "required" in doc_copy else None - if len(doc_copy): - raise ValidationException( - f"Unallowed values in secondaryFiles specification entry: {doc_copy}" - ) - r.append(new_dict2) + if len(doc_copy): + raise ValidationException( + f"Unallowed values in secondaryFiles specification entry: {doc_copy}" + ) + r.append(new_dict2) - elif isinstance(doc, str): - if doc.endswith("?"): - r.append({"pattern": doc[:-1], "required": False}) - else: - r.append({"pattern": doc}) - else: - raise ValidationException("Expected str or sequence of str") + case str(decl): + if decl.endswith("?"): + r.append({"pattern": decl[:-1], "required": False}) + else: + r.append({"pattern": decl}) + case _: + raise ValidationException("Expected str or sequence of str") return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader): +class _RecordLoader(_Loader, Generic[S]): def __init__( self, - classtype: type[Saveable], - container: Optional[str] = None, - no_link_check: Optional[bool] = None, + classtype: type[S], + container: str | None = None, + no_link_check: bool | None = None, ) -> None: self.classtype: Final = classtype self.container: Final = container @@ -683,9 +699,9 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> S: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -710,19 +726,20 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, - ) -> Any: + docRoot: str | None = None, + lc: Any | None = None, + ) -> str: if not isinstance(doc, str): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " f"but valid type for this field is a str." ) - return doc + else: + return doc class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: Optional[str] = None) -> None: + def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name @@ -734,8 +751,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: errors: Final = [] @@ -817,8 +834,8 @@ def __init__( inner: _Loader, scoped_id: bool, vocab_term: bool, - scoped_ref: Optional[int], - no_link_check: Optional[bool], + scoped_ref: int | None, + no_link_check: bool | None, ) -> None: self.inner: Final = inner self.scoped_id: Final = scoped_id @@ -831,39 +848,40 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check ) - if isinstance(doc, MutableSequence): - newdoc: Final = [] - for i in doc: - if isinstance(i, str): - newdoc.append( - expand_url( - i, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) - ) - else: - newdoc.append(i) - doc = newdoc - elif isinstance(doc, str): - doc = expand_url( - doc, - baseuri, - loadingOptions, - self.scoped_id, - self.vocab_term, - self.scoped_ref, - ) + match doc: + case MutableSequence() as decl: + newdoc: Final = [] + for i in decl: + if isinstance(i, str): + newdoc.append( + expand_url( + i, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) + ) + else: + newdoc.append(i) + doc = newdoc + case str(decl): + doc = expand_url( + decl, + baseuri, + loadingOptions, + self.scoped_id, + self.vocab_term, + self.scoped_ref, + ) if isinstance(doc, str): if not loadingOptions.no_link_check: errors: Final = [] @@ -880,7 +898,7 @@ def load( class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: Optional[int], salad_version: str) -> None: + def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -890,7 +908,7 @@ def resolve( doc: str, baseuri: str, loadingOptions: LoadingOptions, - ) -> Union[list[Union[dict[str, Any], str]], dict[str, Any], str]: + ) -> list[dict[str, Any] | str] | dict[str, Any] | str: doc_ = doc optional = False if doc_.endswith("?"): @@ -899,7 +917,7 @@ def resolve( if doc_.endswith("[]"): salad_versions: Final = [int(v) for v in self.salad_version[1:].split(".")] - items: Union[list[Union[dict[str, Any], str]], dict[str, Any], str] = "" + items: list[dict[str, Any] | str] | dict[str, Any] | str = "" rest: Final = doc_[0:-2] if salad_versions < [1, 3]: if rest.endswith("[]"): @@ -911,7 +929,7 @@ def resolve( items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) - expanded: Union[dict[str, Any], str] = {"type": "array", "items": items} + expanded: dict[str, Any] | str = {"type": "array", "items": items} else: expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) @@ -925,8 +943,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] @@ -950,7 +968,7 @@ def load( class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: Optional[str]) -> None: + def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -960,8 +978,8 @@ def load( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None, - lc: Optional[list[Any]] = None, + docRoot: str | None = None, + lc: Any | None = None, ) -> Any: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] @@ -990,10 +1008,10 @@ def load( def _document_load( loader: _Loader, - doc: Union[str, MutableMapping[str, Any], MutableSequence[Any]], + doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( @@ -1062,7 +1080,7 @@ def _document_load_by_url( loader: _Loader, url: str, loadingOptions: LoadingOptions, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> tuple[Any, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1117,7 +1135,7 @@ def save_relative_uri( uri: Any, base_url: str, scoped_id: bool, - ref_scope: Optional[int], + ref_scope: int | None, relative_uris: bool, ) -> Any: """Convert any URI to a relative one, obeying the scoping rules.""" @@ -1168,6 +1186,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_2" +@trait class Documented(Saveable): pass @@ -1179,26 +1198,6 @@ class RecordField(Documented): name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, RecordField): return bool( @@ -1217,8 +1216,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1376,7 +1375,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1401,8 +1400,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -1441,16 +1440,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class RecordSchema(Saveable): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1460,9 +1456,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -1477,8 +1478,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "RecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1580,7 +1581,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1640,24 +1641,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) - - -class EnumSchema(Saveable): - """ - Define an enumerated type. - - """ - - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[RecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1667,10 +1656,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + + +class EnumSchema(Saveable): + """ + Define an enumerated type. + + """ + + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, EnumSchema): return bool( @@ -1689,8 +1688,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -1849,7 +1848,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -1874,7 +1873,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, extension_fields=extension_fields, @@ -1913,16 +1912,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type"]) - - -class ArraySchema(Saveable): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -1932,9 +1928,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) + + +class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -1949,8 +1950,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2053,7 +2054,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2112,16 +2113,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class MapSchema(Saveable): def __init__( self, - type_: Any, - values: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2131,9 +2128,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items self.type_ = type_ - self.values = values + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): return bool(self.type_ == other.type_ and self.values == other.values) @@ -2148,8 +2149,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MapSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2252,7 +2253,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2311,16 +2312,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["type", "values"]) - - -class UnionSchema(Saveable): def __init__( self, - names: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["map"], + values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2330,9 +2327,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names self.type_ = type_ + self.values = values + + attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + +class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): return bool(self.names == other.names and self.type_ == other.type_) @@ -2347,8 +2348,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "UnionSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2451,7 +2452,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2510,16 +2511,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["names", "type"]) - - -class CWLArraySchema(ArraySchema): def __init__( self, - items: Any, - type_: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Literal["union"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2529,9 +2526,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.names = names self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + + +class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): return bool(self.items == other.items and self.type_ == other.type_) @@ -2546,8 +2547,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2650,7 +2651,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2709,19 +2710,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type"]) - - -class CWLRecordField(RecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: Literal["array"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2731,10 +2725,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +class CWLRecordField(RecordField): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordField): return bool( @@ -2753,8 +2752,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -2912,7 +2911,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -2937,8 +2936,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -2977,16 +2976,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["doc", "name", "type"]) - - -class CWLRecordSchema(RecordSchema): def __init__( self, - type_: Any, - fields: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -2996,9 +2992,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + + +class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) @@ -3013,8 +3014,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CWLRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3116,7 +3117,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3176,7 +3177,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type"]) + def __init__( + self, + type_: Literal["record"], + fields: None | Sequence[CWLRecordField] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.fields = fields + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) class File(Saveable): @@ -3250,43 +3269,6 @@ class File(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - dirname: Optional[Any] = None, - nameroot: Optional[Any] = None, - nameext: Optional[Any] = None, - checksum: Optional[Any] = None, - size: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - format: Optional[Any] = None, - contents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents - def __eq__(self, other: Any) -> bool: if isinstance(other, File): return bool( @@ -3329,8 +3311,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "File": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -3687,7 +3669,7 @@ def fromDoc( try: size = load_field( _doc.get("size"), - union_of_None_type_or_inttype, + union_of_None_type_or_inttype_or_inttype, baseuri, loadingOptions, lc=_doc.get("size") @@ -3870,7 +3852,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -3983,7 +3965,44 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | int = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "location", @@ -4049,29 +4068,6 @@ class Directory(Saveable): """ - def __init__( - self, - location: Optional[Any] = None, - path: Optional[Any] = None, - basename: Optional[Any] = None, - listing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing - def __eq__(self, other: Any) -> bool: if isinstance(other, Directory): return bool( @@ -4094,8 +4090,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Directory": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4306,7 +4302,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4382,37 +4378,70 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "location", "path", "basename", "listing"]) + def __init__( + self, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) +@trait class Labeled(Saveable): pass +@trait class Identified(Saveable): pass +@trait class IdentifierRequired(Identified): pass +@trait class LoadContents(Saveable): pass +@trait class FieldBase(Labeled): pass +@trait class InputFormat(Saveable): pass +@trait class OutputFormat(Saveable): pass +@trait class Parameter(FieldBase, Documented, IdentifierRequired): """ Define an input or output parameter to a process. @@ -4423,22 +4452,6 @@ class Parameter(FieldBase, Documented, IdentifierRequired): class InputBinding(Saveable): - def __init__( - self, - loadContents: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - def __eq__(self, other: Any) -> bool: if isinstance(other, InputBinding): return bool(self.loadContents == other.loadContents) @@ -4453,8 +4466,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -4508,7 +4521,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -4566,17 +4579,36 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents"]) - - -class IOSchema(Labeled, Documented): + def __init__( + self, + loadContents: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.loadContents = loadContents + + attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) + + +@trait +class IOSchema(Labeled, Documented): pass +@trait class InputSchema(IOSchema): pass +@trait class OutputSchema(IOSchema): pass @@ -4584,38 +4616,6 @@ class OutputSchema(IOSchema): class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): name: str - def __init__( - self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordField): return bool( @@ -4652,8 +4652,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5093,7 +5093,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5118,8 +5118,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -5199,7 +5199,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -5217,30 +5249,6 @@ def save( class InputRecordSchema(CWLRecordSchema, InputSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, InputRecordSchema): return bool( @@ -5261,8 +5269,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5514,7 +5522,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5539,11 +5547,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5589,21 +5597,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class InputEnumSchema(EnumSchema, InputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5613,11 +5615,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +class InputEnumSchema(EnumSchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputEnumSchema): @@ -5639,8 +5649,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -5893,7 +5903,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -5918,7 +5928,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -5967,21 +5977,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class InputArraySchema(CWLArraySchema, InputSchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -5991,11 +5995,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class InputArraySchema(CWLArraySchema, InputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): @@ -6017,8 +6029,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6271,7 +6283,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6296,11 +6308,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -6345,23 +6357,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6371,13 +6375,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordField): @@ -6411,8 +6421,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -6758,7 +6768,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -6783,8 +6793,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -6848,23 +6858,17 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] - ) - - -class OutputRecordSchema(CWLRecordSchema, OutputSchema): - name: str - def __init__( self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + name: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -6874,11 +6878,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] + ) + + +class OutputRecordSchema(CWLRecordSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): @@ -6900,8 +6914,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7153,7 +7167,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7178,11 +7192,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7228,21 +7242,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class OutputEnumSchema(EnumSchema, OutputSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[OutputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7252,11 +7260,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +class OutputEnumSchema(EnumSchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputEnumSchema): @@ -7278,8 +7294,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7532,7 +7548,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7557,7 +7573,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -7606,21 +7622,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class OutputArraySchema(CWLArraySchema, OutputSchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -7630,11 +7640,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class OutputArraySchema(CWLArraySchema, OutputSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): @@ -7656,8 +7674,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -7910,7 +7928,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -7935,11 +7953,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7984,17 +8002,46 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) + def __init__( + self, + items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Literal["array"], + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) +@trait class InputParameter(Parameter, InputFormat, LoadContents): pass +@trait class OutputParameter(Parameter, OutputFormat): pass +@trait class ProcessRequirement(Saveable): """ A process requirement declares a prerequisite that may or must be fulfilled @@ -8009,6 +8056,7 @@ class ProcessRequirement(Saveable): pass +@trait class Process(Identified, Labeled, Documented): """ @@ -8029,23 +8077,6 @@ class InlineJavascriptRequirement(ProcessRequirement): """ - def __init__( - self, - expressionLib: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "InlineJavascriptRequirement" - self.expressionLib = expressionLib - def __eq__(self, other: Any) -> bool: if isinstance(other, InlineJavascriptRequirement): return bool( @@ -8063,8 +8094,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InlineJavascriptRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8134,7 +8165,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8200,9 +8231,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "expressionLib"]) + def __init__( + self, + expressionLib: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.expressionLib = expressionLib + + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) +@trait class CommandInputSchema(Saveable): pass @@ -8224,23 +8273,6 @@ class SchemaDefRequirement(ProcessRequirement): """ - def __init__( - self, - types: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SchemaDefRequirement" - self.types = types - def __eq__(self, other: Any) -> bool: if isinstance(other, SchemaDefRequirement): return bool(self.class_ == other.class_ and self.types == other.types) @@ -8255,8 +8287,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SchemaDefRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8327,7 +8359,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8390,7 +8422,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "types"]) + def __init__( + self, + types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) class SecondaryFileSchema(Saveable): @@ -8411,24 +8460,6 @@ class SecondaryFileSchema(Saveable): """ - def __init__( - self, - pattern: Any, - required: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required - def __eq__(self, other: Any) -> bool: if isinstance(other, SecondaryFileSchema): return bool( @@ -8445,8 +8476,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SecondaryFileSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8548,7 +8579,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8608,21 +8639,12 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["pattern", "required"]) - - -class LoadListingRequirement(ProcessRequirement): - """ - Specify the desired behavior for loading the `listing` field of - a Directory object for use by expressions. - - """ - def __init__( self, - loadListing: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + pattern: str, + required: None | bool | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8632,8 +8654,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "LoadListingRequirement" - self.loadListing = loadListing + self.pattern = pattern + self.required = required + + attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) + + +class LoadListingRequirement(ProcessRequirement): + """ + Specify the desired behavior for loading the `listing` field of + a Directory object for use by expressions. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, LoadListingRequirement): @@ -8651,8 +8683,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "LoadListingRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8722,7 +8754,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8788,23 +8820,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "loadListing"]) - - -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ - def __init__( self, - envName: Any, - envValue: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -8814,8 +8834,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.class_: Final[str] = "https://w3id.org/cwl/cwl#LoadListingRequirement" + self.loadListing = loadListing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) + + +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment + by the workflow platform when executing the command line tool. May be the + result of executing an expression, such as getting a parameter from input. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvironmentDef): @@ -8833,8 +8864,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvironmentDef": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -8937,7 +8968,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -8997,7 +9028,25 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["envName", "envValue"]) + def __init__( + self, + envName: str, + envValue: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.envName = envName + self.envValue = envValue + + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) class CommandLineBinding(InputBinding): @@ -9040,34 +9089,6 @@ class CommandLineBinding(InputBinding): """ - def __init__( - self, - loadContents: Optional[Any] = None, - position: Optional[Any] = None, - prefix: Optional[Any] = None, - separate: Optional[Any] = None, - itemSeparator: Optional[Any] = None, - valueFrom: Optional[Any] = None, - shellQuote: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineBinding): return bool( @@ -9100,8 +9121,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9437,7 +9458,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9534,7 +9555,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + loadContents: None | bool = None, + position: None | int | str = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote + + attrs: ClassVar[Collection[str]] = frozenset( [ "loadContents", "position", @@ -9562,28 +9611,6 @@ class CommandOutputBinding(LoadContents): """ - def __init__( - self, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - glob: Optional[Any] = None, - outputEval: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputBinding): return bool( @@ -9603,8 +9630,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputBinding": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -9799,7 +9826,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -9878,30 +9905,14 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["loadContents", "loadListing", "glob", "outputEval"]) - - -class CommandLineBindable(Saveable): - pass - - -class CommandInputRecordField(InputRecordField, CommandLineBindable): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + glob: None | Sequence[str] | str = None, + outputEval: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -9911,16 +9922,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format self.loadContents = loadContents self.loadListing = loadListing - self.inputBinding = inputBinding + self.glob = glob + self.outputEval = outputEval + + attrs: ClassVar[Collection[str]] = frozenset( + ["loadContents", "loadListing", "glob", "outputEval"] + ) + + +@trait +class CommandLineBindable(Saveable): + pass + + +class CommandInputRecordField(InputRecordField, CommandLineBindable): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordField): @@ -9960,8 +9978,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10448,7 +10466,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10473,8 +10491,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -10562,7 +10580,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -10583,32 +10635,6 @@ class CommandInputRecordSchema( ): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputRecordSchema): return bool( @@ -10639,8 +10665,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -10939,7 +10965,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -10964,11 +10990,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -11022,22 +11048,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name", "inputBinding"]) - - -class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[CommandInputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11047,13 +11067,21 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name", "inputBinding"] + ) + + +class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputEnumSchema): return bool( @@ -11084,8 +11112,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11385,7 +11413,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11410,7 +11438,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -11467,24 +11495,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc", "inputBinding"]) - - -class CommandInputArraySchema( - InputArraySchema, CommandInputSchema, CommandLineBindable -): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11494,13 +11514,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc", "inputBinding"] + ) + + +class CommandInputArraySchema( + InputArraySchema, CommandInputSchema, CommandLineBindable +): + name: str + def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): return bool( @@ -11524,8 +11554,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -11825,7 +11855,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -11850,11 +11880,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -11907,24 +11937,16 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name", "inputBinding"]) - - -class CommandOutputRecordField(OutputRecordField): - name: str - def __init__( self, - name: Any, - type_: Any, - doc: Optional[Any] = None, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - format: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -11934,14 +11956,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.outputBinding = outputBinding + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name", "inputBinding"] + ) + + +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordField): @@ -11977,8 +12005,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordField": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12371,7 +12399,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12396,8 +12424,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), doc=doc, - name=name, type_=type_, label=label, secondaryFiles=secondaryFiles, @@ -12469,7 +12497,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + name: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "doc", "name", @@ -12486,30 +12544,6 @@ def save( class CommandOutputRecordSchema(OutputRecordSchema): name: str - def __init__( - self, - type_: Any, - fields: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputRecordSchema): return bool( @@ -12530,8 +12564,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputRecordSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -12783,7 +12817,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -12808,11 +12842,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), fields=fields, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -12858,21 +12892,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["fields", "type", "label", "doc", "name"]) - - -class CommandOutputEnumSchema(OutputEnumSchema): - name: str - def __init__( self, - symbols: Any, - type_: Any, - name: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + type_: Literal["record"], + fields: None | Sequence[CommandOutputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -12882,11 +12910,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) + + +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputEnumSchema): @@ -12908,8 +12944,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputEnumSchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13162,7 +13198,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13187,7 +13223,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + name=cast(str, name), symbols=symbols, type_=type_, label=label, @@ -13236,21 +13272,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["name", "symbols", "type", "label", "doc"]) - - -class CommandOutputArraySchema(OutputArraySchema): - name: str - def __init__( self, - items: Any, - type_: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - name: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + symbols: Sequence[str], + type_: Literal["enum"], + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13260,11 +13290,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +class CommandOutputArraySchema(OutputArraySchema): + name: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): @@ -13286,8 +13324,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputArraySchema": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -13540,7 +13578,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -13565,11 +13603,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=cast(str, name), items=items, type_=type_, label=label, doc=doc, - name=name, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -13614,31 +13652,15 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["items", "type", "label", "doc", "name"]) - - -class CommandInputParameter(InputParameter): - """ - An input parameter for a CommandLineTool. - """ - - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: Literal["array"], + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -13648,17 +13670,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "doc", "name"] + ) + + +class CommandInputParameter(InputParameter): + """ + An input parameter for a CommandLineTool. + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputParameter): @@ -13700,8 +13728,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -14235,7 +14263,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14260,11 +14288,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -14354,7 +14382,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + default: CWLObjectType | None = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -14378,36 +14442,6 @@ class CommandOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - outputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ - self.outputBinding = outputBinding - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputParameter): return bool( @@ -14442,8 +14476,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -14836,7 +14870,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -14861,11 +14895,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, outputBinding=outputBinding, @@ -14934,7 +14968,37 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -14956,55 +15020,6 @@ class CommandLineTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - baseCommand: Optional[Any] = None, - arguments: Optional[Any] = None, - stdin: Optional[Any] = None, - stderr: Optional[Any] = None, - stdout: Optional[Any] = None, - successCodes: Optional[Any] = None, - temporaryFailCodes: Optional[Any] = None, - permanentFailCodes: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes - def __eq__(self, other: Any) -> bool: if isinstance(other, CommandLineTool): return bool( @@ -15059,8 +15074,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CommandLineTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -15893,7 +15908,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -15918,7 +15933,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -16049,7 +16064,56 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + intent: None | Sequence[str] = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[int] = None, + temporaryFailCodes: None | Sequence[int] = None, + permanentFailCodes: None | Sequence[int] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -16129,33 +16193,6 @@ class DockerRequirement(ProcessRequirement): """ - def __init__( - self, - dockerPull: Optional[Any] = None, - dockerLoad: Optional[Any] = None, - dockerFile: Optional[Any] = None, - dockerImport: Optional[Any] = None, - dockerImageId: Optional[Any] = None, - dockerOutputDirectory: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory - def __eq__(self, other: Any) -> bool: if isinstance(other, DockerRequirement): return bool( @@ -16188,8 +16225,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "DockerRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16494,7 +16531,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16600,7 +16637,34 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "dockerPull", @@ -16620,23 +16684,6 @@ class SoftwareRequirement(ProcessRequirement): """ - def __init__( - self, - packages: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SoftwareRequirement" - self.packages = packages - def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwareRequirement): return bool(self.class_ == other.class_ and self.packages == other.packages) @@ -16651,8 +16698,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwareRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16723,7 +16770,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -16786,17 +16833,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "packages"]) - - -class SoftwarePackage(Saveable): def __init__( self, - package: Any, - version: Optional[Any] = None, - specs: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + packages: Sequence[SoftwarePackage], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -16806,10 +16847,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.packages = packages + + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): return bool( @@ -16828,8 +16872,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SoftwarePackage": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -16978,7 +17022,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17042,7 +17086,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["package", "version", "specs"]) + def __init__( + self, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.package = package + self.version = version + self.specs = specs + + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) class Dirent(Saveable): @@ -17058,26 +17122,6 @@ class Dirent(Saveable): """ - def __init__( - self, - entry: Any, - entryname: Optional[Any] = None, - writable: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable - def __eq__(self, other: Any) -> bool: if isinstance(other, Dirent): return bool( @@ -17096,8 +17140,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Dirent": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17246,7 +17290,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17314,20 +17358,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["entryname", "entry", "writable"]) - - -class InitialWorkDirRequirement(ProcessRequirement): - """ - Define a list of files and subdirectories that must be staged by the workflow platform prior to executing the command line tool. - Normally files are staged within the designated output directory. However, when running inside containers, files may be staged at arbitrary locations, see discussion for [`Dirent.entryname`](#Dirent). Together with `DockerRequirement.dockerOutputDirectory` it is possible to control the locations of both input and output files when running in containers. - """ - def __init__( self, - listing: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + entry: str, + entryname: None | str = None, + writable: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17337,8 +17374,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "InitialWorkDirRequirement" - self.listing = listing + self.entryname = entryname + self.entry = entry + self.writable = writable + + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + + +class InitialWorkDirRequirement(ProcessRequirement): + """ + Define a list of files and subdirectories that must be staged by the workflow platform prior to executing the command line tool. + Normally files are staged within the designated output directory. However, when running inside containers, files may be staged at arbitrary locations, see discussion for [`Dirent.entryname`](#Dirent). Together with `DockerRequirement.dockerOutputDirectory` it is possible to control the locations of both input and output files when running in containers. + """ def __eq__(self, other: Any) -> bool: if isinstance(other, InitialWorkDirRequirement): @@ -17354,8 +17401,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InitialWorkDirRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17426,7 +17473,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17489,21 +17536,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "listing"]) - - -class EnvVarRequirement(ProcessRequirement): - """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. - - """ - def __init__( self, - envDef: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -17513,8 +17550,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + + +class EnvVarRequirement(ProcessRequirement): + """ + Define a list of environment variables which will be set in the + execution environment of the tool. See `EnvironmentDef` for details. + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, EnvVarRequirement): @@ -17530,8 +17577,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "EnvVarRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17602,7 +17649,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17665,7 +17712,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "envDef"]) + def __init__( + self, + envDef: Sequence[EnvironmentDef], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.envDef = envDef + + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) class ShellCommandRequirement(ProcessRequirement): @@ -17680,21 +17744,6 @@ class ShellCommandRequirement(ProcessRequirement): """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ShellCommandRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, ShellCommandRequirement): return bool(self.class_ == other.class_) @@ -17709,8 +17758,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShellCommandRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17733,7 +17782,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -17789,7 +17838,22 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) class ResourceRequirement(ProcessRequirement): @@ -17822,37 +17886,6 @@ class ResourceRequirement(ProcessRequirement): """ - def __init__( - self, - coresMin: Optional[Any] = None, - coresMax: Optional[Any] = None, - ramMin: Optional[Any] = None, - ramMax: Optional[Any] = None, - tmpdirMin: Optional[Any] = None, - tmpdirMax: Optional[Any] = None, - outdirMin: Optional[Any] = None, - outdirMax: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax - def __eq__(self, other: Any) -> bool: if isinstance(other, ResourceRequirement): return bool( @@ -17889,8 +17922,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ResourceRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -17918,7 +17951,7 @@ def fromDoc( try: coresMin = load_field( _doc.get("coresMin"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMin") @@ -17965,7 +17998,7 @@ def fromDoc( try: coresMax = load_field( _doc.get("coresMax"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("coresMax") @@ -18012,7 +18045,7 @@ def fromDoc( try: ramMin = load_field( _doc.get("ramMin"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMin") @@ -18059,7 +18092,7 @@ def fromDoc( try: ramMax = load_field( _doc.get("ramMax"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("ramMax") @@ -18106,7 +18139,7 @@ def fromDoc( try: tmpdirMin = load_field( _doc.get("tmpdirMin"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMin") @@ -18153,7 +18186,7 @@ def fromDoc( try: tmpdirMax = load_field( _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("tmpdirMax") @@ -18200,7 +18233,7 @@ def fromDoc( try: outdirMin = load_field( _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMin") @@ -18247,7 +18280,7 @@ def fromDoc( try: outdirMax = load_field( _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader, + union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("outdirMax") @@ -18289,7 +18322,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18399,7 +18432,38 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + coresMin: None | float | int | str = None, + coresMax: None | float | int | str = None, + ramMin: None | float | int | str = None, + ramMax: None | float | int | str = None, + tmpdirMin: None | float | int | str = None, + tmpdirMax: None | float | int | str = None, + outdirMin: None | float | int | str = None, + outdirMax: None | float | int | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "coresMin", @@ -18428,23 +18492,6 @@ class WorkReuse(ProcessRequirement): """ - def __init__( - self, - enableReuse: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "WorkReuse" - self.enableReuse = enableReuse - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkReuse): return bool( @@ -18461,8 +18508,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkReuse": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18533,7 +18580,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18599,7 +18646,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "enableReuse"]) + def __init__( + self, + enableReuse: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#WorkReuse" + self.enableReuse = enableReuse + + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) class NetworkAccess(ProcessRequirement): @@ -18622,23 +18686,6 @@ class NetworkAccess(ProcessRequirement): """ - def __init__( - self, - networkAccess: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "NetworkAccess" - self.networkAccess = networkAccess - def __eq__(self, other: Any) -> bool: if isinstance(other, NetworkAccess): return bool( @@ -18656,8 +18703,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "NetworkAccess": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18728,7 +18775,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -18794,7 +18841,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "networkAccess"]) + def __init__( + self, + networkAccess: bool | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#NetworkAccess" + self.networkAccess = networkAccess + + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) class InplaceUpdateRequirement(ProcessRequirement): @@ -18832,23 +18896,6 @@ class InplaceUpdateRequirement(ProcessRequirement): """ - def __init__( - self, - inplaceUpdate: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate - def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): return bool( @@ -18866,8 +18913,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "InplaceUpdateRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -18938,7 +18985,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19004,7 +19051,24 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "inplaceUpdate"]) + def __init__( + self, + inplaceUpdate: bool, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "https://w3id.org/cwl/cwl#InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate + + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) class ToolTimeLimit(ProcessRequirement): @@ -19019,23 +19083,6 @@ class ToolTimeLimit(ProcessRequirement): """ - def __init__( - self, - timelimit: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "ToolTimeLimit" - self.timelimit = timelimit - def __eq__(self, other: Any) -> bool: if isinstance(other, ToolTimeLimit): return bool( @@ -19052,8 +19099,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ToolTimeLimit": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19082,7 +19129,7 @@ def fromDoc( timelimit = load_field( _doc.get("timelimit"), - union_of_inttype_or_ExpressionLoader, + union_of_inttype_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, lc=_doc.get("timelimit") @@ -19124,7 +19171,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19190,23 +19237,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "timelimit"]) - - -class ExpressionToolOutputParameter(OutputParameter): - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + timelimit: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19216,13 +19251,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ToolTimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + + +class ExpressionToolOutputParameter(OutputParameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionToolOutputParameter): @@ -19256,8 +19292,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionToolOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -19603,7 +19639,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -19628,11 +19664,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, @@ -19693,29 +19729,17 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( - ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] - ) - - -class WorkflowInputParameter(InputParameter): - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - inputBinding: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + id: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -19729,13 +19753,17 @@ def __init__( self.secondaryFiles = secondaryFiles self.streamable = streamable self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.id = id self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default self.type_ = type_ - self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] + ) + + +class WorkflowInputParameter(InputParameter): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowInputParameter): @@ -19777,8 +19805,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -20312,7 +20340,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -20337,11 +20365,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -20431,7 +20459,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + default: CWLObjectType | None = None, + inputBinding: InputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -20462,41 +20526,6 @@ class ExpressionTool(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - expression: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "ExpressionTool" - self.expression = expression - def __eq__(self, other: Any) -> bool: if isinstance(other, ExpressionTool): return bool( @@ -20537,8 +20566,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ExpressionTool": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21043,7 +21072,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21068,7 +21097,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -21155,7 +21184,42 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + intent: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -21186,40 +21250,6 @@ class WorkflowOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - outputSource: Optional[Any] = None, - linkMerge: Optional[Any] = None, - pickValue: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.pickValue = pickValue - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowOutputParameter): return bool( @@ -21258,8 +21288,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -21746,7 +21776,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -21771,11 +21801,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, outputSource=outputSource, linkMerge=linkMerge, @@ -21850,7 +21880,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.pickValue = pickValue + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -21866,6 +21930,7 @@ def save( ) +@trait class Sink(Saveable): pass @@ -21985,38 +22050,6 @@ class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): id: str - def __init__( - self, - id: Any, - source: Optional[Any] = None, - linkMerge: Optional[Any] = None, - pickValue: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - label: Optional[Any] = None, - default: Optional[Any] = None, - valueFrom: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.source = source - self.linkMerge = linkMerge - self.pickValue = pickValue - self.loadContents = loadContents - self.loadListing = loadListing - self.label = label - self.default = default - self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepInput): return bool( @@ -22053,8 +22086,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepInput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22493,7 +22526,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22518,7 +22551,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), source=source, linkMerge=linkMerge, pickValue=pickValue, @@ -22593,7 +22626,39 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + label: None | str = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.source = source + self.linkMerge = linkMerge + self.pickValue = pickValue + self.loadContents = loadContents + self.loadListing = loadListing + self.label = label + self.default = default + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "source", @@ -22623,22 +22688,6 @@ class WorkflowStepOutput(IdentifierRequired): id: str - def __init__( - self, - id: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStepOutput): return bool(self.id == other.id) @@ -22653,8 +22702,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStepOutput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -22717,7 +22766,7 @@ def fromDoc( _errors__.append(ValidationException("missing id")) if not __original_id_is_none: baseuri = cast(str, id) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -22740,7 +22789,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -22770,7 +22819,23 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["id"]) + def __init__( + self, + id: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + + attrs: ClassVar[Collection[str]] = frozenset(["id"]) class WorkflowStep(IdentifierRequired, Labeled, Documented): @@ -22848,53 +22913,17 @@ class WorkflowStep(IdentifierRequired, Labeled, Documented): # Subworkflows - To specify a nested workflow as part of a workflow step, - [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be - specified in the workflow or workflow step requirements. - - It is a fatal error if a workflow directly or indirectly invokes itself as - a subworkflow (recursive workflows are not allowed). - - """ - - id: str - - def __init__( - self, - id: Any, - in_: Any, - out: Any, - run: Any, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - when: Optional[Any] = None, - scatter: Optional[Any] = None, - scatterMethod: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.run = run - self.when = when - self.scatter = scatter - self.scatterMethod = scatterMethod - + To specify a nested workflow as part of a workflow step, + [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be + specified in the workflow or workflow step requirements. + + It is a fatal error if a workflow directly or indirectly invokes itself as + a subworkflow (recursive workflows are not allowed). + + """ + + id: str + def __eq__(self, other: Any) -> bool: if isinstance(other, WorkflowStep): return bool( @@ -22935,8 +22964,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "WorkflowStep": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -23474,7 +23503,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -23499,7 +23528,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, in_=in_, @@ -23580,7 +23609,43 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any] = None, + when: None | str = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.label = label + self.doc = doc + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.run = run + self.when = when + self.scatter = scatter + self.scatterMethod = scatterMethod + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -23655,41 +23720,6 @@ class Workflow(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - steps: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "Workflow" - self.steps = steps - def __eq__(self, other: Any) -> bool: if isinstance(other, Workflow): return bool( @@ -23730,8 +23760,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Workflow": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24236,7 +24266,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24261,7 +24291,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -24345,7 +24375,42 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + intent: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.steps = steps + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -24369,21 +24434,6 @@ class SubworkflowFeatureRequirement(ProcessRequirement): """ - def __init__( - self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "SubworkflowFeatureRequirement" - def __eq__(self, other: Any) -> bool: if isinstance(other, SubworkflowFeatureRequirement): return bool(self.class_ == other.class_) @@ -24398,8 +24448,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "SubworkflowFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24422,7 +24472,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24478,20 +24528,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class ScatterFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24501,7 +24541,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ScatterFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class ScatterFeatureRequirement(ProcessRequirement): + """ + Indicates that the workflow platform must support the `scatter` and + `scatterMethod` fields of [WorkflowStep](#WorkflowStep). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, ScatterFeatureRequirement): @@ -24517,8 +24567,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ScatterFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24541,7 +24591,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24597,20 +24647,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class MultipleInputFeatureRequirement(ProcessRequirement): - """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24620,7 +24660,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "MultipleInputFeatureRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class MultipleInputFeatureRequirement(ProcessRequirement): + """ + Indicates that the workflow platform must support multiple inbound data links + listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, MultipleInputFeatureRequirement): @@ -24636,8 +24686,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MultipleInputFeatureRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24660,7 +24710,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24716,20 +24766,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class StepInputExpressionRequirement(ProcessRequirement): - """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). - - """ - def __init__( self, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24739,7 +24779,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "StepInputExpressionRequirement" + self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class StepInputExpressionRequirement(ProcessRequirement): + """ + Indicate that the workflow platform must support the `valueFrom` field + of [WorkflowStepInput](#WorkflowStepInput). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, StepInputExpressionRequirement): @@ -24755,8 +24805,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "StepInputExpressionRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -24779,7 +24829,7 @@ def fromDoc( raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: raise e - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -24835,31 +24885,10 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class"]) - - -class OperationInputParameter(InputParameter): - """ - Describe an input parameter of an operation. - - """ - - id: str - def __init__( self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - loadContents: Optional[Any] = None, - loadListing: Optional[Any] = None, - default: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -24869,16 +24898,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ + self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +class OperationInputParameter(InputParameter): + """ + Describe an input parameter of an operation. + + """ + + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, OperationInputParameter): @@ -24918,8 +24949,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OperationInputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25406,7 +25437,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25431,11 +25462,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, loadContents=loadContents, loadListing=loadListing, @@ -25517,7 +25548,41 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + default: CWLObjectType | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( [ "label", "secondaryFiles", @@ -25541,34 +25606,6 @@ class OperationOutputParameter(OutputParameter): id: str - def __init__( - self, - id: Any, - type_: Any, - label: Optional[Any] = None, - secondaryFiles: Optional[Any] = None, - streamable: Optional[Any] = None, - doc: Optional[Any] = None, - format: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.format = format - self.type_ = type_ - def __eq__(self, other: Any) -> bool: if isinstance(other, OperationOutputParameter): return bool( @@ -25601,8 +25638,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "OperationOutputParameter": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -25948,7 +25985,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -25973,11 +26010,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), label=label, secondaryFiles=secondaryFiles, streamable=streamable, doc=doc, - id=id, format=format, type_=type_, extension_fields=extension_fields, @@ -26038,7 +26075,35 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + id: str, + type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ + + attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] ) @@ -26057,39 +26122,6 @@ class Operation(Process): id: str - def __init__( - self, - inputs: Any, - outputs: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "Operation" - def __eq__(self, other: Any) -> bool: if isinstance(other, Operation): return bool( @@ -26128,8 +26160,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Operation": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -26586,7 +26618,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -26611,7 +26643,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -26690,7 +26722,40 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[OperationInputParameter], + outputs: Sequence[OperationOutputParameter], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + intent: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "https://w3id.org/cwl/cwl#Operation" + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -26707,23 +26772,6 @@ def save( class Secrets(ProcessRequirement): - def __init__( - self, - secrets: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Secrets" - self.secrets = secrets - def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -26738,8 +26786,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Secrets": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -26810,7 +26858,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -26872,26 +26920,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "secrets"]) - - -class ProcessGenerator(Process): - id: str - def __init__( self, - inputs: Any, - outputs: Any, - run: Any, - id: Optional[Any] = None, - label: Optional[Any] = None, - doc: Optional[Any] = None, - requirements: Optional[Any] = None, - hints: Optional[Any] = None, - cwlVersion: Optional[Any] = None, - intent: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + secrets: Sequence[str], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -26901,17 +26934,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_ = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.secrets = secrets + + attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + + +class ProcessGenerator(Process): + id: str def __eq__(self, other: Any) -> bool: if isinstance(other, ProcessGenerator): @@ -26953,8 +26983,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ProcessGenerator": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -27461,7 +27491,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -27486,7 +27516,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + id=cast(str, id), label=label, doc=doc, inputs=inputs, @@ -27569,7 +27599,42 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + inputs: Sequence[CommandInputParameter | OperationInputParameter | WorkflowInputParameter], + outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter], + run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + intent: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.run = run + + attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", @@ -27592,23 +27657,6 @@ class MPIRequirement(ProcessRequirement): """ - def __init__( - self, - processes: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "MPIRequirement" - self.processes = processes - def __eq__(self, other: Any) -> bool: if isinstance(other, MPIRequirement): return bool( @@ -27625,8 +27673,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "MPIRequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -27697,7 +27745,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -27763,23 +27811,11 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "processes"]) - - -class CUDARequirement(ProcessRequirement): - """ - Require support for NVIDA CUDA (GPU hardware acceleration). - - """ - def __init__( self, - cudaComputeCapability: Any, - cudaVersionMin: Any, - cudaDeviceCountMax: Optional[Any] = None, - cudaDeviceCountMin: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + processes: int | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -27789,11 +27825,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.processes = processes + + attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + + +class CUDARequirement(ProcessRequirement): + """ + Require support for NVIDA CUDA (GPU hardware acceleration). + + """ def __eq__(self, other: Any) -> bool: if isinstance(other, CUDARequirement): @@ -27823,8 +27865,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "CUDARequirement": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -28037,7 +28079,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -28127,7 +28169,30 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + cudaComputeCapability: Sequence[str] | str, + cudaVersionMin: str, + cudaDeviceCountMax: None | int | str = None, + cudaDeviceCountMin: None | int | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin + + attrs: ClassVar[Collection[str]] = frozenset( [ "class", "cudaComputeCapability", @@ -28141,32 +28206,6 @@ def save( class LoopInput(Saveable): id: str - def __init__( - self, - default: Optional[Any] = None, - id: Optional[Any] = None, - linkMerge: Optional[Any] = None, - loopSource: Optional[Any] = None, - pickValue: Optional[Any] = None, - valueFrom: Optional[Any] = None, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.default = default - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.linkMerge = linkMerge - self.loopSource = loopSource - self.pickValue = pickValue - self.valueFrom = valueFrom - def __eq__(self, other: Any) -> bool: if isinstance(other, LoopInput): return bool( @@ -28197,8 +28236,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "LoopInput": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -28496,7 +28535,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -28521,8 +28560,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=cast(str, id), default=default, - id=id, linkMerge=linkMerge, loopSource=loopSource, pickValue=pickValue, @@ -28575,7 +28614,33 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset( + def __init__( + self, + default: Any | None = None, + id: None | str = None, + linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + loopSource: None | Sequence[str] | str = None, + pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.default = default + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.linkMerge = linkMerge + self.loopSource = loopSource + self.pickValue = pickValue + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( ["default", "id", "linkMerge", "loopSource", "pickValue", "valueFrom"] ) @@ -28597,27 +28662,6 @@ class Loop(ProcessRequirement): """ - def __init__( - self, - loop: Any, - loopWhen: Any, - outputMethod: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_ = "Loop" - self.loop = loop - self.loopWhen = loopWhen - self.outputMethod = outputMethod - def __eq__(self, other: Any) -> bool: if isinstance(other, Loop): return bool( @@ -28637,8 +28681,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "Loop": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -28805,7 +28849,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -28881,15 +28925,13 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "loop", "loopWhen", "outputMethod"]) - - -class ShmSize(ProcessRequirement): def __init__( self, - shmSize: Any, - extension_fields: Optional[dict[str, Any]] = None, - loadingOptions: Optional[LoadingOptions] = None, + loop: Sequence[LoopInput], + loopWhen: str, + outputMethod: Literal["last", "all"], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -28899,9 +28941,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_ = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "http://commonwl.org/cwltool#Loop" + self.loop = loop + self.loopWhen = loopWhen + self.outputMethod = outputMethod + + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "loop", "loopWhen", "outputMethod"] + ) + +class ShmSize(ProcessRequirement): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -28916,8 +28966,8 @@ def fromDoc( doc: Any, baseuri: str, loadingOptions: LoadingOptions, - docRoot: Optional[str] = None - ) -> "ShmSize": + docRoot: str | None = None + ) -> Self: _doc = copy.copy(doc) if hasattr(doc, "lc"): @@ -28988,7 +29038,7 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: dict[str, Any] = {} + extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: if not k: @@ -29051,10 +29101,27 @@ def save( r["$schemas"] = self.loadingOptions.schemas return r - attrs = frozenset(["class", "shmSize"]) + def __init__( + self, + shmSize: str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.shmSize = shmSize + + attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) -_vocab = { +_vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", @@ -29206,8 +29273,8 @@ def save( "v1.2.0-dev3": "https://w3id.org/cwl/cwl#v1.2.0-dev3", "v1.2.0-dev4": "https://w3id.org/cwl/cwl#v1.2.0-dev4", "v1.2.0-dev5": "https://w3id.org/cwl/cwl#v1.2.0-dev5", -} -_rvocab = { +}) +_rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", @@ -29359,15 +29426,15 @@ def save( "https://w3id.org/cwl/cwl#v1.2.0-dev3": "v1.2.0-dev3", "https://w3id.org/cwl/cwl#v1.2.0-dev4": "v1.2.0-dev4", "https://w3id.org/cwl/cwl#v1.2.0-dev5": "v1.2.0-dev5", -} - -strtype = _PrimitiveLoader(str) -inttype = _PrimitiveLoader(int) -floattype = _PrimitiveLoader(float) -booltype = _PrimitiveLoader(bool) -None_type = _PrimitiveLoader(type(None)) -Any_type = _AnyLoader() -PrimitiveTypeLoader = _EnumLoader( +}) + +strtype: Final = _PrimitiveLoader(str) +inttype: Final = _PrimitiveLoader(int) +floattype: Final = _PrimitiveLoader(float) +booltype: Final = _PrimitiveLoader(bool) +None_type: Final = _PrimitiveLoader(type(None)) +Any_type: Final = _AnyLoader() +PrimitiveTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -29393,17 +29460,17 @@ def save( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader = _EnumLoader(("Any",), "Any") +AnyLoader: Final = _EnumLoader(("Any",), "Any") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader = _RecordLoader(RecordField, None, None) -RecordSchemaLoader = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader = _EnumLoader( +RecordFieldLoader: Final = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) +EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final = _EnumLoader( ( "null", "boolean", @@ -29422,55 +29489,65 @@ def save( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader = _RecordLoader(CWLRecordSchema, None, None) -FileLoader = _RecordLoader(File, None, None) -DirectoryLoader = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader = _UnionLoader( +CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) +CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) +CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) +FileLoader: Final = _RecordLoader(File, None, None) +DirectoryLoader: Final = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( ( None_type, CWLObjectTypeLoader, ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader = _ArrayLoader( +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( union_of_None_type_or_CWLObjectTypeLoader ) -map_of_union_of_None_type_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( union_of_None_type_or_CWLObjectTypeLoader, "None", None, None ) -InlineJavascriptRequirementLoader = _RecordLoader( +InlineJavascriptRequirementLoader: Final = _RecordLoader( InlineJavascriptRequirement, None, None ) -SchemaDefRequirementLoader = _RecordLoader(SchemaDefRequirement, None, None) -LoadListingRequirementLoader = _RecordLoader(LoadListingRequirement, None, None) -DockerRequirementLoader = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader = _RecordLoader(SoftwareRequirement, None, None) -InitialWorkDirRequirementLoader = _RecordLoader(InitialWorkDirRequirement, None, None) -EnvVarRequirementLoader = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader = _RecordLoader(ShellCommandRequirement, None, None) -ResourceRequirementLoader = _RecordLoader(ResourceRequirement, None, None) -WorkReuseLoader = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader = _RecordLoader(NetworkAccess, None, None) -InplaceUpdateRequirementLoader = _RecordLoader(InplaceUpdateRequirement, None, None) -ToolTimeLimitLoader = _RecordLoader(ToolTimeLimit, None, None) -SubworkflowFeatureRequirementLoader = _RecordLoader( +SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) +LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) +DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) +SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) +InitialWorkDirRequirementLoader: Final = _RecordLoader( + InitialWorkDirRequirement, None, None +) +EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) +ShellCommandRequirementLoader: Final = _RecordLoader( + ShellCommandRequirement, None, None +) +ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) +WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) +InplaceUpdateRequirementLoader: Final = _RecordLoader( + InplaceUpdateRequirement, None, None +) +ToolTimeLimitLoader: Final = _RecordLoader(ToolTimeLimit, None, None) +SubworkflowFeatureRequirementLoader: Final = _RecordLoader( SubworkflowFeatureRequirement, None, None ) -ScatterFeatureRequirementLoader = _RecordLoader(ScatterFeatureRequirement, None, None) -MultipleInputFeatureRequirementLoader = _RecordLoader( +ScatterFeatureRequirementLoader: Final = _RecordLoader( + ScatterFeatureRequirement, None, None +) +MultipleInputFeatureRequirementLoader: Final = _RecordLoader( MultipleInputFeatureRequirement, None, None ) -StepInputExpressionRequirementLoader = _RecordLoader( +StepInputExpressionRequirementLoader: Final = _RecordLoader( StepInputExpressionRequirement, None, None ) -SecretsLoader = _RecordLoader(Secrets, None, None) -MPIRequirementLoader = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader = _RecordLoader(CUDARequirement, None, None) -LoopLoader = _RecordLoader(Loop, None, None) -ShmSizeLoader = _RecordLoader(ShmSize, None, None) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader = _UnionLoader( +SecretsLoader: Final = _RecordLoader(Secrets, None, None) +MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) +CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) +LoopLoader: Final = _RecordLoader(Loop, None, None) +ShmSizeLoader: Final = _RecordLoader(ShmSize, None, None) +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: ( + Final +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -29496,24 +29573,32 @@ def save( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: ( + Final +) = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, CWLObjectTypeLoader, ) ) -map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader = _MapLoader( +map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: ( + Final +) = _MapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True, ) -CWLInputFileLoader = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader -CWLVersionLoader = _EnumLoader( +CWLInputFileLoader: Final = ( + map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader +) +CWLVersionLoader: Final = _EnumLoader( ( "draft-2", "draft-3.dev1", @@ -29541,7 +29626,7 @@ def save( """ Version symbols for published CWL document versions. """ -LoadListingEnumLoader = _EnumLoader( +LoadListingEnumLoader: Final = _EnumLoader( ( "no_listing", "shallow_listing", @@ -29557,31 +29642,45 @@ def save( shallow_listing: Only load the top level listing, do not recurse into subdirectories. deep_listing: Load the directory listing and recursively load all subdirectories as well. """ -ExpressionLoader = _ExpressionLoader(str) -InputBindingLoader = _RecordLoader(InputBinding, None, None) -InputRecordFieldLoader = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader = _RecordLoader(OutputArraySchema, None, None) -SecondaryFileSchemaLoader = _RecordLoader(SecondaryFileSchema, None, None) -EnvironmentDefLoader = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader = _RecordLoader(CommandInputRecordField, None, None) -CommandInputRecordSchemaLoader = _RecordLoader(CommandInputRecordSchema, None, None) -CommandInputEnumSchemaLoader = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader = _RecordLoader(CommandInputArraySchema, None, None) -CommandOutputRecordFieldLoader = _RecordLoader(CommandOutputRecordField, None, None) -CommandOutputRecordSchemaLoader = _RecordLoader(CommandOutputRecordSchema, None, None) -CommandOutputEnumSchemaLoader = _RecordLoader(CommandOutputEnumSchema, None, None) -CommandOutputArraySchemaLoader = _RecordLoader(CommandOutputArraySchema, None, None) -CommandInputParameterLoader = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader = _RecordLoader(CommandOutputParameter, None, None) -stdinLoader = _EnumLoader(("stdin",), "stdin") +ExpressionLoader: Final = _ExpressionLoader(str) +InputBindingLoader: Final = _RecordLoader(InputBinding, None, None) +InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) +InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) +InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) +InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) +OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) +OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) +OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) +OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) +SecondaryFileSchemaLoader: Final = _RecordLoader(SecondaryFileSchema, None, None) +EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) +CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) +CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) +CommandInputRecordFieldLoader: Final = _RecordLoader( + CommandInputRecordField, None, None +) +CommandInputRecordSchemaLoader: Final = _RecordLoader( + CommandInputRecordSchema, None, None +) +CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) +CommandInputArraySchemaLoader: Final = _RecordLoader( + CommandInputArraySchema, None, None +) +CommandOutputRecordFieldLoader: Final = _RecordLoader( + CommandOutputRecordField, None, None +) +CommandOutputRecordSchemaLoader: Final = _RecordLoader( + CommandOutputRecordSchema, None, None +) +CommandOutputEnumSchemaLoader: Final = _RecordLoader( + CommandOutputEnumSchema, None, None +) +CommandOutputArraySchemaLoader: Final = _RecordLoader( + CommandOutputArraySchema, None, None +) +CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) +CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) +stdinLoader: Final = _EnumLoader(("stdin",), "stdin") """ Only valid as a `type` for a `CommandLineTool` input with no `inputBinding` set. `stdin` must not be specified at the `CommandLineTool` @@ -29603,7 +29702,7 @@ def save( stdin: $(inputs.an_input_name.path) ``` """ -stdoutLoader = _EnumLoader(("stdout",), "stdout") +stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29651,7 +29750,7 @@ def save( (e.g. `echo a && echo b`) `stdout` must include the output of every command. """ -stderrLoader = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29695,15 +29794,15 @@ def save( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader = _RecordLoader(CommandLineTool, None, None) -SoftwarePackageLoader = _RecordLoader(SoftwarePackage, None, None) -DirentLoader = _RecordLoader(Dirent, None, None) -ExpressionToolOutputParameterLoader = _RecordLoader( +CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) +SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) +DirentLoader: Final = _RecordLoader(Dirent, None, None) +ExpressionToolOutputParameterLoader: Final = _RecordLoader( ExpressionToolOutputParameter, None, None ) -WorkflowInputParameterLoader = _RecordLoader(WorkflowInputParameter, None, None) -ExpressionToolLoader = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader = _EnumLoader( +WorkflowInputParameterLoader: Final = _RecordLoader(WorkflowInputParameter, None, None) +ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) +LinkMergeMethodLoader: Final = _EnumLoader( ( "merge_nested", "merge_flattened", @@ -29713,7 +29812,7 @@ def save( """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -PickValueMethodLoader = _EnumLoader( +PickValueMethodLoader: Final = _EnumLoader( ( "first_non_null", "the_only_non_null", @@ -29724,10 +29823,12 @@ def save( """ Picking non-null values among inbound data links, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader = _RecordLoader(WorkflowOutputParameter, None, None) -WorkflowStepInputLoader = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader = _EnumLoader( +WorkflowOutputParameterLoader: Final = _RecordLoader( + WorkflowOutputParameter, None, None +) +WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) +WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) +ScatterMethodLoader: Final = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -29738,23 +29839,29 @@ def save( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader = _RecordLoader(Workflow, None, None) -OperationInputParameterLoader = _RecordLoader(OperationInputParameter, None, None) -OperationOutputParameterLoader = _RecordLoader(OperationOutputParameter, None, None) -OperationLoader = _RecordLoader(Operation, None, None) -ProcessGeneratorLoader = _RecordLoader(ProcessGenerator, None, None) -LoopInputLoader = _RecordLoader(LoopInput, None, None) -array_of_strtype = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype = _UnionLoader( +WorkflowStepLoader: Final = _RecordLoader(WorkflowStep, None, None) +WorkflowLoader: Final = _RecordLoader(Workflow, None, None) +OperationInputParameterLoader: Final = _RecordLoader( + OperationInputParameter, None, None +) +OperationOutputParameterLoader: Final = _RecordLoader( + OperationOutputParameter, None, None +) +OperationLoader: Final = _RecordLoader(Operation, None, None) +ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) +LoopInputLoader: Final = _RecordLoader(LoopInput, None, None) +array_of_strtype: Final = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +uri_strtype_True_False_None_None: Final = _URILoader(strtype, True, False, None, None) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -29765,10 +29872,14 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -29780,51 +29891,57 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader = _UnionLoader( +array_of_RecordFieldLoader: Final = _ArrayLoader(RecordFieldLoader) +union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" ) -Record_nameLoader = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2 = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype = _UnionLoader( +Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") +union_of_None_type_or_strtype: Final = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_None: Final = _URILoader( union_of_None_type_or_strtype, True, False, None, None ) -uri_array_of_strtype_True_False_None_None = _URILoader( +uri_array_of_strtype_True_False_None_None: Final = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2 = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None = _URILoader( +Enum_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2 = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2 = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2 = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +Array_nameLoader: Final = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") +Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") +Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -29833,10 +29950,14 @@ def save( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -29846,57 +29967,66 @@ def save( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader = _UnionLoader( +array_of_CWLRecordFieldLoader: Final = _ArrayLoader(CWLRecordFieldLoader) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader = _IdMapLoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _IdMapLoader( union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" ) -File_classLoader = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None = _URILoader( +File_classLoader: Final = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None = _URILoader( +uri_union_of_None_type_or_strtype_False_False_None_None: Final = _URILoader( union_of_None_type_or_strtype, False, False, None, None ) -union_of_None_type_or_inttype = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final = _UnionLoader( ( None_type, inttype, + inttype, ) ) -union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader ) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( + _UnionLoader( + ( + None_type, + array_of_union_of_FileLoader_or_DirectoryLoader, + ) ) ) -secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( + Final +) = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader @@ -29904,34 +30034,38 @@ def save( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -uri_union_of_None_type_or_strtype_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_True_False_None_True: Final = _URILoader( union_of_None_type_or_strtype, True, False, None, True ) -Directory_classLoader = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None = _URILoader( +Directory_classLoader: Final = _EnumLoader(("Directory",), "Directory_class") +uri_Directory_classLoader_False_True_None_None: Final = _URILoader( Directory_classLoader, False, True, None, None ) -union_of_None_type_or_booltype = _UnionLoader( +union_of_None_type_or_booltype: Final = _UnionLoader( ( None_type, booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader = _UnionLoader( +union_of_None_type_or_LoadListingEnumLoader: Final = _UnionLoader( ( None_type, LoadListingEnumLoader, ) ) -array_of_SecondaryFileSchemaLoader = _ArrayLoader(SecondaryFileSchemaLoader) -union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +array_of_SecondaryFileSchemaLoader: Final = _ArrayLoader(SecondaryFileSchemaLoader) +union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( + Final +) = _UnionLoader( ( None_type, SecondaryFileSchemaLoader, array_of_SecondaryFileSchemaLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( + Final +) = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader @@ -29939,32 +30073,40 @@ def save( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, ) ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: ( + Final +) = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_strtype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, strtype, ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True = _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( + _URILoader( + union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True + ) ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -29973,10 +30115,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -29986,29 +30132,35 @@ def save( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_InputRecordFieldLoader = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader = _UnionLoader( +array_of_InputRecordFieldLoader: Final = _ArrayLoader(InputRecordFieldLoader) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( + _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") ) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -30017,10 +30169,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -30030,44 +30186,56 @@ def save( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_OutputRecordFieldLoader = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader = _UnionLoader( +array_of_OutputRecordFieldLoader: Final = _ArrayLoader(OutputRecordFieldLoader) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader = _IdMapLoader( - union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( + _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") ) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader = _UnionLoader( +union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: ( + Final +) = _UnionLoader( ( CommandInputParameterLoader, WorkflowInputParameterLoader, OperationInputParameterLoader, ) ) -array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader = _ArrayLoader( +array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: ( + Final +) = _ArrayLoader( union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader ) -idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader = _IdMapLoader( +idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: ( + Final +) = _IdMapLoader( array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader, "id", "type", ) -union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader = _UnionLoader( +union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: ( + Final +) = _UnionLoader( ( CommandOutputParameterLoader, ExpressionToolOutputParameterLoader, @@ -30075,26 +30243,36 @@ def save( OperationOutputParameterLoader, ) ) -array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader = _ArrayLoader( +array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: ( + Final +) = _ArrayLoader( union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader ) -idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: ( + Final +) = _IdMapLoader( array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader, "id", "type", ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: ( + Final +) = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -30121,107 +30299,121 @@ def save( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: ( + Final +) = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader = _UnionLoader( +union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( ( None_type, CWLVersionLoader, ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_CWLVersionLoader, False, True, None, None ) -union_of_None_type_or_array_of_strtype = _UnionLoader( +union_of_None_type_or_array_of_strtype: Final = _UnionLoader( ( None_type, array_of_strtype, ) ) -uri_union_of_None_type_or_array_of_strtype_True_False_None_None = _URILoader( +uri_union_of_None_type_or_array_of_strtype_True_False_None_None: Final = _URILoader( union_of_None_type_or_array_of_strtype, True, False, None, None ) -InlineJavascriptRequirement_classLoader = _EnumLoader( +InlineJavascriptRequirement_classLoader: Final = _EnumLoader( ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" ) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None = _URILoader( +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( InlineJavascriptRequirement_classLoader, False, True, None, None ) -SchemaDefRequirement_classLoader = _EnumLoader( +SchemaDefRequirement_classLoader: Final = _EnumLoader( ("SchemaDefRequirement",), "SchemaDefRequirement_class" ) -uri_SchemaDefRequirement_classLoader_False_True_None_None = _URILoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( SchemaDefRequirement_classLoader, False, True, None, None ) -union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _UnionLoader( +union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( + Final +) = _UnionLoader( ( CommandInputRecordSchemaLoader, CommandInputEnumSchemaLoader, CommandInputArraySchemaLoader, ) ) -array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader = _ArrayLoader( +array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( + Final +) = _ArrayLoader( union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader ) -union_of_strtype_or_ExpressionLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, ) ) -union_of_None_type_or_booltype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_booltype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, booltype, ExpressionLoader, ) ) -LoadListingRequirement_classLoader = _EnumLoader( +LoadListingRequirement_classLoader: Final = _EnumLoader( ("LoadListingRequirement",), "LoadListingRequirement_class" ) -uri_LoadListingRequirement_classLoader_False_True_None_None = _URILoader( +uri_LoadListingRequirement_classLoader_False_True_None_None: Final = _URILoader( LoadListingRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_inttype_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( None_type, inttype, ExpressionLoader, ) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, - array_of_strtype, +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + array_of_strtype, + ) ) ) -union_of_None_type_or_ExpressionLoader = _UnionLoader( +union_of_None_type_or_ExpressionLoader: Final = _UnionLoader( ( None_type, ExpressionLoader, ) ) -union_of_None_type_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -30230,10 +30422,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -30243,31 +30439,39 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader = _ArrayLoader(CommandInputRecordFieldLoader) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final = _ArrayLoader( + CommandInputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( _IdMapLoader( union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -30276,10 +30480,14 @@ def save( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -30289,37 +30497,45 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_CommandOutputRecordFieldLoader = _ArrayLoader(CommandOutputRecordFieldLoader) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final = _ArrayLoader( + CommandOutputRecordFieldLoader +) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader = ( +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( _IdMapLoader( union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: ( + Final +) = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, stdinLoader, @@ -30330,12 +30546,16 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype = _UnionLoader( +union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( + Final +) = _UnionLoader( ( CWLTypeLoader, stdoutLoader, @@ -30347,72 +30567,82 @@ def save( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2 = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( + Final +) = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader = _EnumLoader(("CommandLineTool",), "CommandLineTool_class") -uri_CommandLineTool_classLoader_False_True_None_None = _URILoader( +CommandLineTool_classLoader: Final = _EnumLoader( + ("CommandLineTool",), "CommandLineTool_class" +) +uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( CommandLineTool_classLoader, False, True, None, None ) -array_of_CommandInputParameterLoader = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader = _IdMapLoader( +array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( array_of_CommandInputParameterLoader, "id", "type" ) -array_of_CommandOutputParameterLoader = _ArrayLoader(CommandOutputParameterLoader) -idmap_outputs_array_of_CommandOutputParameterLoader = _IdMapLoader( +array_of_CommandOutputParameterLoader: Final = _ArrayLoader( + CommandOutputParameterLoader +) +idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( array_of_CommandOutputParameterLoader, "id", "type" ) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = ( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) ) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader = _UnionLoader( +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( + Final +) = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype = _UnionLoader( +array_of_inttype: Final = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final = _UnionLoader( ( None_type, array_of_inttype, ) ) -DockerRequirement_classLoader = _EnumLoader( +DockerRequirement_classLoader: Final = _EnumLoader( ("DockerRequirement",), "DockerRequirement_class" ) -uri_DockerRequirement_classLoader_False_True_None_None = _URILoader( +uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( DockerRequirement_classLoader, False, True, None, None ) -SoftwareRequirement_classLoader = _EnumLoader( +SoftwareRequirement_classLoader: Final = _EnumLoader( ("SoftwareRequirement",), "SoftwareRequirement_class" ) -uri_SoftwareRequirement_classLoader_False_True_None_None = _URILoader( +uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( SoftwareRequirement_classLoader, False, True, None, None ) -array_of_SoftwarePackageLoader = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader = _IdMapLoader( +array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) +idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( array_of_SoftwarePackageLoader, "package", "specs" ) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True = _URILoader( +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( union_of_None_type_or_array_of_strtype, False, False, None, True ) -InitialWorkDirRequirement_classLoader = _EnumLoader( +InitialWorkDirRequirement_classLoader: Final = _EnumLoader( ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" ) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None = _URILoader( +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _URILoader( InitialWorkDirRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( + Final +) = _UnionLoader( ( None_type, DirentLoader, @@ -30422,147 +30652,167 @@ def save( array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader = _ArrayLoader( +array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( + Final +) = _ArrayLoader( union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader ) -union_of_ExpressionLoader_or_array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader = _UnionLoader( +union_of_ExpressionLoader_or_array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( + Final +) = _UnionLoader( ( ExpressionLoader, array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -EnvVarRequirement_classLoader = _EnumLoader( +EnvVarRequirement_classLoader: Final = _EnumLoader( ("EnvVarRequirement",), "EnvVarRequirement_class" ) -uri_EnvVarRequirement_classLoader_False_True_None_None = _URILoader( +uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( EnvVarRequirement_classLoader, False, True, None, None ) -array_of_EnvironmentDefLoader = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader = _IdMapLoader( +array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) +idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( array_of_EnvironmentDefLoader, "envName", "envValue" ) -ShellCommandRequirement_classLoader = _EnumLoader( +ShellCommandRequirement_classLoader: Final = _EnumLoader( ("ShellCommandRequirement",), "ShellCommandRequirement_class" ) -uri_ShellCommandRequirement_classLoader_False_True_None_None = _URILoader( +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( ShellCommandRequirement_classLoader, False, True, None, None ) -ResourceRequirement_classLoader = _EnumLoader( +ResourceRequirement_classLoader: Final = _EnumLoader( ("ResourceRequirement",), "ResourceRequirement_class" ) -uri_ResourceRequirement_classLoader_False_True_None_None = _URILoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( ResourceRequirement_classLoader, False, True, None, None ) -union_of_None_type_or_inttype_or_floattype_or_ExpressionLoader = _UnionLoader( - ( - None_type, - inttype, - floattype, - ExpressionLoader, +union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader: Final = ( + _UnionLoader( + ( + None_type, + inttype, + inttype, + floattype, + ExpressionLoader, + ) ) ) -WorkReuse_classLoader = _EnumLoader(("WorkReuse",), "WorkReuse_class") -uri_WorkReuse_classLoader_False_True_None_None = _URILoader( +WorkReuse_classLoader: Final = _EnumLoader(("WorkReuse",), "WorkReuse_class") +uri_WorkReuse_classLoader_False_True_None_None: Final = _URILoader( WorkReuse_classLoader, False, True, None, None ) -union_of_booltype_or_ExpressionLoader = _UnionLoader( +union_of_booltype_or_ExpressionLoader: Final = _UnionLoader( ( booltype, ExpressionLoader, ) ) -NetworkAccess_classLoader = _EnumLoader(("NetworkAccess",), "NetworkAccess_class") -uri_NetworkAccess_classLoader_False_True_None_None = _URILoader( +NetworkAccess_classLoader: Final = _EnumLoader( + ("NetworkAccess",), "NetworkAccess_class" +) +uri_NetworkAccess_classLoader_False_True_None_None: Final = _URILoader( NetworkAccess_classLoader, False, True, None, None ) -InplaceUpdateRequirement_classLoader = _EnumLoader( +InplaceUpdateRequirement_classLoader: Final = _EnumLoader( ("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class" ) -uri_InplaceUpdateRequirement_classLoader_False_True_None_None = _URILoader( +uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final = _URILoader( InplaceUpdateRequirement_classLoader, False, True, None, None ) -ToolTimeLimit_classLoader = _EnumLoader(("ToolTimeLimit",), "ToolTimeLimit_class") -uri_ToolTimeLimit_classLoader_False_True_None_None = _URILoader( +ToolTimeLimit_classLoader: Final = _EnumLoader( + ("ToolTimeLimit",), "ToolTimeLimit_class" +) +uri_ToolTimeLimit_classLoader_False_True_None_None: Final = _URILoader( ToolTimeLimit_classLoader, False, True, None, None ) -union_of_inttype_or_ExpressionLoader = _UnionLoader( +union_of_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( ( + inttype, inttype, ExpressionLoader, ) ) -union_of_None_type_or_InputBindingLoader = _UnionLoader( +union_of_None_type_or_InputBindingLoader: Final = _UnionLoader( ( None_type, InputBindingLoader, ) ) -ExpressionTool_classLoader = _EnumLoader(("ExpressionTool",), "ExpressionTool_class") -uri_ExpressionTool_classLoader_False_True_None_None = _URILoader( +ExpressionTool_classLoader: Final = _EnumLoader( + ("ExpressionTool",), "ExpressionTool_class" +) +uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( ExpressionTool_classLoader, False, True, None, None ) -array_of_WorkflowInputParameterLoader = _ArrayLoader(WorkflowInputParameterLoader) -idmap_inputs_array_of_WorkflowInputParameterLoader = _IdMapLoader( +array_of_WorkflowInputParameterLoader: Final = _ArrayLoader( + WorkflowInputParameterLoader +) +idmap_inputs_array_of_WorkflowInputParameterLoader: Final = _IdMapLoader( array_of_WorkflowInputParameterLoader, "id", "type" ) -array_of_ExpressionToolOutputParameterLoader = _ArrayLoader( +array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( ExpressionToolOutputParameterLoader ) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader = _IdMapLoader( +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _IdMapLoader( array_of_ExpressionToolOutputParameterLoader, "id", "type" ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) ) -union_of_None_type_or_LinkMergeMethodLoader = _UnionLoader( +union_of_None_type_or_LinkMergeMethodLoader: Final = _UnionLoader( ( None_type, LinkMergeMethodLoader, ) ) -union_of_None_type_or_PickValueMethodLoader = _UnionLoader( +union_of_None_type_or_PickValueMethodLoader: Final = _UnionLoader( ( None_type, PickValueMethodLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) ) -array_of_WorkflowStepInputLoader = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader = _IdMapLoader( +array_of_WorkflowStepInputLoader: Final = _ArrayLoader(WorkflowStepInputLoader) +idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( array_of_WorkflowStepInputLoader, "id", "source" ) -union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader = _ArrayLoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( union_of_strtype_or_WorkflowStepOutputLoader ) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader = _UnionLoader( +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) ) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None = _URILoader( +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( + Final +) = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type = _UnionLoader( +array_of_Any_type: Final = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( ( None_type, array_of_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _IdMapLoader( union_of_None_type_or_array_of_Any_type, "class", "None" ) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -30572,102 +30822,120 @@ def save( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None: ( + Final +) = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None = _URILoader( - union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( + _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) ) -union_of_None_type_or_ScatterMethodLoader = _UnionLoader( +union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None = _URILoader( +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( union_of_None_type_or_ScatterMethodLoader, False, True, None, None ) -Workflow_classLoader = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None = _URILoader( +Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") +uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( Workflow_classLoader, False, True, None, None ) -array_of_WorkflowOutputParameterLoader = _ArrayLoader(WorkflowOutputParameterLoader) -idmap_outputs_array_of_WorkflowOutputParameterLoader = _IdMapLoader( +array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( + WorkflowOutputParameterLoader +) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( array_of_WorkflowOutputParameterLoader, "id", "type" ) -array_of_WorkflowStepLoader = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader = _UnionLoader((array_of_WorkflowStepLoader,)) -idmap_steps_union_of_array_of_WorkflowStepLoader = _IdMapLoader( +array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) +union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( + (array_of_WorkflowStepLoader,) +) +idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( union_of_array_of_WorkflowStepLoader, "id", "None" ) -SubworkflowFeatureRequirement_classLoader = _EnumLoader( +SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( SubworkflowFeatureRequirement_classLoader, False, True, None, None ) -ScatterFeatureRequirement_classLoader = _EnumLoader( +ScatterFeatureRequirement_classLoader: Final = _EnumLoader( ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" ) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None = _URILoader( +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( ScatterFeatureRequirement_classLoader, False, True, None, None ) -MultipleInputFeatureRequirement_classLoader = _EnumLoader( +MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None = _URILoader( - MultipleInputFeatureRequirement_classLoader, False, True, None, None +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( + _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) ) -StepInputExpressionRequirement_classLoader = _EnumLoader( +StepInputExpressionRequirement_classLoader: Final = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None = _URILoader( +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( StepInputExpressionRequirement_classLoader, False, True, None, None ) -Operation_classLoader = _EnumLoader(("Operation",), "Operation_class") -uri_Operation_classLoader_False_True_None_None = _URILoader( +Operation_classLoader: Final = _EnumLoader(("Operation",), "Operation_class") +uri_Operation_classLoader_False_True_None_None: Final = _URILoader( Operation_classLoader, False, True, None, None ) -array_of_OperationInputParameterLoader = _ArrayLoader(OperationInputParameterLoader) -idmap_inputs_array_of_OperationInputParameterLoader = _IdMapLoader( +array_of_OperationInputParameterLoader: Final = _ArrayLoader( + OperationInputParameterLoader +) +idmap_inputs_array_of_OperationInputParameterLoader: Final = _IdMapLoader( array_of_OperationInputParameterLoader, "id", "type" ) -array_of_OperationOutputParameterLoader = _ArrayLoader(OperationOutputParameterLoader) -idmap_outputs_array_of_OperationOutputParameterLoader = _IdMapLoader( +array_of_OperationOutputParameterLoader: Final = _ArrayLoader( + OperationOutputParameterLoader +) +idmap_outputs_array_of_OperationOutputParameterLoader: Final = _IdMapLoader( array_of_OperationOutputParameterLoader, "id", "type" ) -uri_strtype_False_True_None_None = _URILoader(strtype, False, True, None, None) -uri_array_of_strtype_False_False_0_None = _URILoader( +uri_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) +uri_array_of_strtype_False_False_0_None: Final = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_strtype_or_array_of_strtype = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( + ( + inttype, + ExpressionLoader, + ) +) +union_of_strtype_or_array_of_strtype: Final = _UnionLoader( ( strtype, array_of_strtype, ) ) -union_of_None_type_or_Any_type = _UnionLoader( +union_of_None_type_or_Any_type: Final = _UnionLoader( ( None_type, Any_type, ) ) -array_of_LoopInputLoader = _ArrayLoader(LoopInputLoader) -idmap_loop_array_of_LoopInputLoader = _IdMapLoader( +array_of_LoopInputLoader: Final = _ArrayLoader(LoopInputLoader) +idmap_loop_array_of_LoopInputLoader: Final = _IdMapLoader( array_of_LoopInputLoader, "id", "loopSource" ) -LoopOutputModesLoader = _EnumLoader( +LoopOutputModesLoader: Final = _EnumLoader( ( "last", "all", ), "LoopOutputModes", ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -30676,10 +30944,14 @@ def save( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( + Final +) = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( + Final +) = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -30702,12 +30974,15 @@ def save( map_of_union_of_None_type_or_CWLObjectTypeLoader, ) ) +CWLObjectType: TypeAlias = ( + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" +) def load_document( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -30724,9 +30999,9 @@ def load_document( def load_document_with_metadata( doc: Any, - baseuri: Optional[str] = None, - loadingOptions: Optional[LoadingOptions] = None, - addl_metadata_fields: Optional[MutableSequence[str]] = None, + baseuri: str | None = None, + loadingOptions: LoadingOptions | None = None, + addl_metadata_fields: MutableSequence[str] | None = None, ) -> Any: if baseuri is None: baseuri = file_uri(os.getcwd()) + "/" @@ -30744,7 +31019,7 @@ def load_document_with_metadata( def load_document_by_string( string: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: yaml = yaml_no_ts() result = yaml.load(string) @@ -30765,7 +31040,7 @@ def load_document_by_string( def load_document_by_yaml( yaml: Any, uri: str, - loadingOptions: Optional[LoadingOptions] = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """ Shortcut to load via a YAML object. diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index c0e5bf50..684b81d4 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -405,8 +405,7 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None: ) else: clt.stdin = ( - "$(inputs.%s.path)" - % cast(str, inp.id).rpartition("#")[2].split("/")[-1] + "$(inputs.%s.path)" % inp.id.rpartition("#")[2].split("/")[-1] ) inp.type_ = "File" @@ -489,7 +488,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] == in_.id.split("#")[-1]: + if 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") diff --git a/src/cwl_utils/parser/utils.py b/src/cwl_utils/parser/utils.py index 967beb12..cfbdc95d 100644 --- a/src/cwl_utils/parser/utils.py +++ b/src/cwl_utils/parser/utils.py @@ -160,9 +160,7 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: param_to_step.update({s.id: step for s in step.in_}) type_dict.update( { - cast(str, s.id): type_for_step_input( - step, s, cast(str, workflow.cwlVersion) - ) + s.id: type_for_step_input(step, s, cast(str, workflow.cwlVersion)) for s in step.in_ } ) @@ -483,12 +481,7 @@ def param_for_source_id( ) case "v1.2": return cwl_utils.parser.cwl_v1_2_utils.param_for_source_id( - cast( - cwl_utils.parser.cwl_v1_2.CommandLineTool - | cwl_utils.parser.cwl_v1_2.Workflow - | cwl_utils.parser.cwl_v1_2.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_utils.parser.cwl_v1_2.Workflow, parent), scatter_context, diff --git a/src/cwl_utils/tests/test_parser_utils.py b/src/cwl_utils/tests/test_parser_utils.py index d977ec75..2f2610bb 100644 --- a/src/cwl_utils/tests/test_parser_utils.py +++ b/src/cwl_utils/tests/test_parser_utils.py @@ -199,6 +199,7 @@ def test_v1_0_stdout_to_file() -> None: ) cwl_utils.parser.cwl_v1_0_utils.convert_stdstreams_to_files(clt) assert clt.stdout is not None + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -231,6 +232,7 @@ def test_v1_0_stdout_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_0_utils.convert_stdstreams_to_files(clt) assert clt.stdout == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -244,6 +246,7 @@ def test_v1_0_stderr_to_file() -> None: ) cwl_utils.parser.cwl_v1_0_utils.convert_stdstreams_to_files(clt) assert clt.stderr is not None + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -276,6 +279,7 @@ def test_v1_0_stderr_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_0_utils.convert_stdstreams_to_files(clt) assert clt.stderr == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -505,6 +509,7 @@ def test_v1_1_stdout_to_file() -> None: ) cwl_utils.parser.cwl_v1_1_utils.convert_stdstreams_to_files(clt) assert clt.stdout is not None + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -537,6 +542,7 @@ def test_v1_1_stdout_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_1_utils.convert_stdstreams_to_files(clt) assert clt.stdout == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -550,6 +556,7 @@ def test_v1_1_stderr_to_file() -> None: ) cwl_utils.parser.cwl_v1_1_utils.convert_stdstreams_to_files(clt) assert clt.stderr is not None + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -582,6 +589,7 @@ def test_v1_1_stderr_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_1_utils.convert_stdstreams_to_files(clt) assert clt.stderr == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -855,6 +863,7 @@ def test_v1_2_stdout_to_file() -> None: ) cwl_utils.parser.cwl_v1_2_utils.convert_stdstreams_to_files(clt) assert clt.stdout is not None + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -887,6 +896,7 @@ def test_v1_2_stdout_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_2_utils.convert_stdstreams_to_files(clt) assert clt.stdout == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stdout == clt.outputs[0].outputBinding.glob @@ -900,6 +910,7 @@ def test_v1_2_stderr_to_file() -> None: ) cwl_utils.parser.cwl_v1_2_utils.convert_stdstreams_to_files(clt) assert clt.stderr is not None + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob @@ -932,6 +943,7 @@ def test_v1_2_stderr_to_file_preserve_original() -> None: ) cwl_utils.parser.cwl_v1_2_utils.convert_stdstreams_to_files(clt) assert clt.stderr == "original.txt" + assert clt.outputs[0].outputBinding is not None assert clt.stderr == clt.outputs[0].outputBinding.glob diff --git a/src/cwl_utils/tests/test_subscope.py b/src/cwl_utils/tests/test_subscope.py index d50bf958..48a68c98 100644 --- a/src/cwl_utils/tests/test_subscope.py +++ b/src/cwl_utils/tests/test_subscope.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 """Test that scoping of identifiers in Workflow.steps[].run is correct.""" -from cwl_utils.parser import Workflow, load_document_by_uri +from cwl_utils.parser import Process, Workflow, load_document_by_uri from .util import get_path @@ -10,6 +10,7 @@ def test_workflow_step_process_scope_v1_0() -> None: """CWL v1.0 IDs under Workflow.steps[].run should not be scoped in the "run" scope.""" uri = get_path("testdata/workflow_input_format_expr.cwl").as_uri() cwl_obj: Workflow = load_document_by_uri(uri) + assert isinstance(cwl_obj.steps[0].run, Process) assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/target") @@ -17,6 +18,7 @@ def test_workflow_step_process_scope_v1_1() -> None: """CWL v1.1 IDs under Workflow.steps[].run should be scoped in the "run" scope.""" uri = get_path("testdata/workflow_input_format_expr_v1_1.cwl").as_uri() cwl_obj: Workflow = load_document_by_uri(uri) + assert isinstance(cwl_obj.steps[0].run, Process) assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/run/target") @@ -24,4 +26,5 @@ def test_workflow_step_process_scope_v1_2() -> None: """CWL v1.2 IDs under Workflow.steps[].run should be scoped in the "run" scope.""" uri = get_path("testdata/workflow_input_format_expr_v1_2.cwl").as_uri() cwl_obj: Workflow = load_document_by_uri(uri) + assert isinstance(cwl_obj.steps[0].run, Process) assert cwl_obj.steps[0].run.inputs[0].id.endswith("#format_extract/run/target") From 9a4657fbda7cf5014d2aba30ec66fe8bded2d5e7 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Fri, 19 Dec 2025 17:29:29 +0100 Subject: [PATCH 02/23] WIP expression_refactor type fixes --- src/cwl_utils/cwl_v1_0_expression_refactor.py | 1010 +++++++++++++---- src/cwl_utils/parser/cwl_v1_0_utils.py | 14 +- 2 files changed, 794 insertions(+), 230 deletions(-) diff --git a/src/cwl_utils/cwl_v1_0_expression_refactor.py b/src/cwl_utils/cwl_v1_0_expression_refactor.py index 1a21aac8..03628bb7 100755 --- a/src/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_0_expression_refactor.py @@ -8,7 +8,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, cast +from typing import Any, Literal, TypeAlias, TypeVar, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -56,33 +56,111 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -def clean_type_ids( - cwltype: cwl.ArraySchema | cwl.InputRecordSchema, -) -> cwl.ArraySchema | cwl.InputRecordSchema: - """Simplify type identifiers.""" - result = copy.deepcopy(cwltype) - if isinstance(result, cwl.ArraySchema): - if isinstance(result.items, MutableSequence): - for item in result.items: +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +InputTypeSchemas: TypeAlias = ( + BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] | None +) +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] | None +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype.items, Sequence): + for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(result.items, cwl.InputRecordSchema): - if result.items.name: - result.items.name = result.items.name.split("/")[-1] - if result.items.fields: - for field in result.items.fields: + elif isinstance(cwltype.items, cwl.RecordSchema): + if ( + isinstance( + cwltype.items, + (cwl.InputRecordSchema, cwl.CommandOutputRecordSchema), + ) + and cwltype.items.name + ): + cwltype.items.name = cwltype.items.name.split("/")[-1] + if cwltype.items.fields: + for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(result, cwl.InputRecordSchema): - if result.name: - result.name = result.name.split("/")[-1] - if result.fields: - for field in result.fields: + elif isinstance(cwltype, cwl.RecordSchema): + if cwltype.name: + cwltype.name = cwltype.name.split("/")[-1] + if cwltype.fields: + for field in cwltype.fields: field.name = field.name.split("/")[-1] + + +def clean_type_ids( + cwltype: AnyTypeSchema, +) -> AnyTypeSchema: + """Simplify type identifiers.""" + result = copy.deepcopy(cwltype) + if isinstance(result, Sequence): + for item in result: + _clean_type_ids(item) + else: + _clean_type_ids(result) return result +def _has_expression(string: str) -> bool: + if "${" in string: + return True + if "$(" in string: + return True + return False + + +def has_expression(field: str | Sequence[str]) -> bool: + if isinstance(field, Sequence): + for entry in field: + if _has_expression(entry): + return True + return False + return _has_expression(field) + + def get_expression( - string: str, inputs: CWLObjectType, self: CWLOutputType | None + string: Any, inputs: CWLObjectType, self: CWLOutputType | None ) -> str | None: """ Find and return a normalized CWL expression, if any. @@ -137,6 +215,439 @@ def get_expression( return None +def _plain_input_type_to_clt_input( + input_type: ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ), +) -> ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str +): + match input_type: + case cwl.InputArraySchema(): + return cwl.CommandInputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.CommandInputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.CommandInputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_type_to_clt_input( + input_type: ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ), +) -> ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str +): + if isinstance(input_type, Sequence): + return [ + _plain_input_type_to_clt_input(input_type_item) + for input_type_item in input_type + ] + if input_type is None: + return None + return _plain_input_type_to_clt_input(input_type) + + +def _plain_input_type_to_plain_output( + input_type: ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ), +) -> ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str +): + match input_type: + case cwl.InputArraySchema(): + return cwl.OutputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_type_to_plain_output( + input_type: ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ), +) -> ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str +): + if isinstance(input_type, Sequence): + return [ + _plain_input_type_to_plain_output(input_type_item) + for input_type_item in input_type + ] + if input_type is None: + return None + return _plain_input_type_to_plain_output(input_type) + + +def _plain_output_type_to_clt_output( + output_type: ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ), +) -> ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str +): + match output_type: + case cwl.OutputArraySchema(): + return cwl.CommandOutputArraySchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputEnumSchema(): + return cwl.CommandOutputEnumSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputRecordSchema(): + return cwl.CommandOutputRecordSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case str(): + return output_type + raise WorkflowException(f"Unexpected ExpressionTool output type: {output_type}.") + + +def plain_output_type_to_clt_output( + output_type: ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ), +) -> ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str +): + if isinstance(output_type, Sequence): + return [ + _plain_output_type_to_clt_output(output_type_item) + for output_type_item in output_type + ] + if output_type is None: + return None + return _plain_output_type_to_clt_output(output_type) + + +def parameters_to_plain_input_paramaters( + parameters: Sequence[ + cwl.InputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter + ], +) -> Sequence[cwl.InputParameter]: + return [ + cwl.InputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) + for parameter in parameters + ] + + def etool_to_cltool( etool: cwl.ExpressionTool, expressionLib: list[str] | None = None ) -> cwl.CommandLineTool: @@ -152,7 +663,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=inp.type_, + type_=plain_input_type_to_clt_input(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -167,7 +678,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=outp.type_, + type_=plain_output_type_to_clt_output(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -338,16 +849,20 @@ def generate_etool_from_expr( if not no_inputs: if not self_type: self_type = target - if isinstance(self_type, list): - new_type: ( - list[cwl.ArraySchema | cwl.InputRecordSchema] - | cwl.ArraySchema - | cwl.InputRecordSchema - ) = [clean_type_ids(t.type_) for t in self_type if t.type_] - elif self_type.type_: - new_type = clean_type_ids(self_type.type_) + new_type: InputTypeSchemas + if isinstance(self_type, Sequence): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if isinstance(clean_type, Sequence): + new_type_list.extend(clean_type) + elif clean_type is None: + pass + else: + new_type_list.append(clean_type) + new_type = new_type_list else: - raise WorkflowException(f"Don't know how to make type from {self_type!r}.") + new_type = clean_type_ids(self_type.type_) inputs.append( cwl.InputParameter( id="self", @@ -383,8 +898,8 @@ def generate_etool_from_expr( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_type_to_plain_output(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -413,18 +928,24 @@ def generate_etool_from_expr( def get_input_for_id( - name: str, tool: cwl.CommandLineTool | cwl.Workflow + name: str, + tool: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ProcessGenerator | cwl.ExpressionTool + ), ) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] - for inp in cast(list[cwl.CommandInputParameter], tool.inputs): + for inp in cast(list[cwl.InputParameter], tool.inputs): if inp.id and inp.id.split("#")[-1].split("/")[-1] == name: - return inp + return cwl.CommandInputParameter.fromDoc( + inp.save(), inp.loadingOptions.baseuri, inp.loadingOptions + ) if isinstance(tool, cwl.Workflow) and "/" in name: stepname, stem = name.split("/", 1) for step in tool.steps: if step.id == stepname: + assert not isinstance(step.run, str) result = get_input_for_id(stem, step.run) if result: return result @@ -433,7 +954,11 @@ def get_input_for_id( def find_expressionLib( processes: Sequence[ - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.Workflow + | cwl.ExpressionTool + | cwl.WorkflowStep + | cwl.ProcessGenerator ], ) -> list[str] | None: """ @@ -485,14 +1010,16 @@ def replace_expr_with_etool( inps = [] if source: inps.append(cwl.WorkflowStepInput(id="self", source=source)) - workflow.steps.append( + new_steps: list[cwl.WorkflowStep] = [ cwl.WorkflowStep( id=name, in_=inps, out=[cwl.WorkflowStepOutput("result")], run=final_tool, ) - ) + ] + new_steps.extend(workflow.steps) + workflow.steps = new_steps def replace_wf_input_ref_with_step_output( @@ -530,19 +1057,22 @@ def empty_inputs( """Produce a mock input object for the given inputs.""" result = {} if isinstance(process_or_step, cwl.Process): - for param in process_or_step.inputs: - result[param.id.split("#")[-1]] = example_input(param.type_) + for param1 in process_or_step.inputs: + result[param1.id.split("#")[-1]] = example_input(param1.type_) else: - for param in process_or_step.in_: - param_id = param.id.split("/")[-1] - if param.source is None and param.valueFrom: - result[param_id] = example_input("string") - elif param.source is None and param.default: - result[param_id] = param.default - else: + for param2 in process_or_step.in_: + param2_id = param2.id.split("/")[-1] + if param2.source is None and param2.valueFrom: + result[param2_id] = example_input("string") + elif param2.source is None and param2.default: + result[param2_id] = param2.default + elif param2.source is not None: with suppress(WorkflowException): - result[param_id] = example_input( - utils.type_for_source(process_or_step.run, param.source, parent) + assert not isinstance(process_or_step.run, str) + result[param2_id] = example_input( + utils.type_for_source( + process_or_step.run, param2.source, parent + ) ) return result @@ -619,33 +1149,22 @@ def process_workflow_inputs_and_outputs( ) -> bool: """Do any needed conversions on the given Workflow's inputs and outputs.""" modified = False - inputs = empty_inputs(workflow) for index, param in enumerate(workflow.inputs): with SourceLine(workflow.inputs, index, WorkflowException): - if param.format and get_expression(param.format, inputs, None): + if param.format is not None and has_expression(param.format): raise SourceLine( param.loadingOptions.original_doc, "format", raise_type=WorkflowException, ).makeError(TOPLEVEL_FORMAT_EXPR_ERROR.format(param.id.split("#")[-1])) - if param.secondaryFiles: - if get_expression(param.secondaryFiles, inputs, EMPTY_FILE): - raise SourceLine( - param.loadingOptions.original_doc, - "secondaryFiles", - raise_type=WorkflowException, - ).makeError(TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1])) - elif isinstance(param.secondaryFiles, MutableSequence): - for index2, entry in enumerate(param.secondaryFiles): - if get_expression(entry, inputs, EMPTY_FILE): - raise SourceLine( - param.loadingOptions.original_doc, - index2, - raise_type=WorkflowException, - ).makeError( - f"Entry {index}," - + TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1]) - ) + if param.secondaryFiles is not None and has_expression( + param.secondaryFiles + ): + raise SourceLine( + param.loadingOptions.original_doc, + "secondaryFiles", + raise_type=WorkflowException, + ).makeError(TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1])) return modified @@ -690,7 +1209,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -711,7 +1230,9 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.EnvVarRequirement,) newEnvDef = copy.deepcopy(envDef) newEnvDef.envValue = f"$(inputs._envDef{index})" - envVarReq.envDef[index] = newEnvDef + new_envDef = list(envVarReq.envDef) + new_envDef[index] = newEnvDef + envVarReq.envDef = new_envDef generated_envVar_reqs.append((etool_id, index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -720,7 +1241,7 @@ def process_workflow_reqs_and_hints( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.InputParameter(id=None, type_="long") + target = cwl.InputParameter(id="", type_="long") etool_id = "_expression_workflow_ResourceRequirement_{}".format( attr ) @@ -745,7 +1266,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), @@ -766,18 +1287,18 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.InitialWorkDirRequirement,) else: iwdr = copy.deepcopy(req) - for index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for index1, entry1 in enumerate(req.listing): + expression = get_expression(entry1, inputs, None) if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expression, @@ -787,17 +1308,19 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = f"$(inputs._iwdr_listing_{index}" - generated_iwdr_reqs.append((etool_id, index)) - elif isinstance(entry, cwl.Dirent): - if entry.entry: + new_listing = list(iwdr.listing) + new_listing[index1] = f"$(inputs._iwdr_listing_{index1}" + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) + elif isinstance(entry1, cwl.Dirent): + if entry1.entry: expression = get_expression( - entry.entry, inputs, None + entry1.entry, inputs, None ) if expression: expr: str = expression expr_result = do_eval( - ex=entry.entry, + ex=entry1.entry, jobinput=inputs, requirements=[], outdir="", @@ -807,7 +1330,7 @@ def process_workflow_reqs_and_hints( modified = True if is_file_or_directory(expr_result): target = cwl.InputParameter( - id=None, + id="", type_=expr_result["class"], ) replace_expr_with_etool( @@ -818,38 +1341,38 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - "$(inputs._iwdr_listing_{}".format( - index - ) + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) + iwdr.listing = new_listing generated_iwdr_reqs.append( - (etool_id, index) + (etool_id, index1) ) elif isinstance(expr_result, str): target = cwl.InputParameter( - id=None, + id="", type_=["File"], ) - if entry.entryname is None: + if entry1.entryname is None: raise SourceLine( - entry.loadingOptions.original_doc, - index, + entry1.loadingOptions.original_doc, + index1, raise_type=WorkflowException, ).makeError( - f"Entry {index}," + f"Entry {index1}," + "Invalid CWL, if 'entry' " "is a string, then entryName must be specified." ) expr = ( '${return {"class": "File", "basename": "' - + entry.entryname + + entry1.entryname + '", "contents": (function(){' + expr[2:-1] + "})() }; }" ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expr, @@ -859,24 +1382,24 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) - elif entry.entryname: + elif entry1.entryname: expression = get_expression( - entry.entryname, inputs, None + entry1.entryname, inputs, None ) if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_="string", ) - etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index - ) + etool_id = f"_expression_workflow_InitialWorkDirRequirement_{index1}" replace_expr_with_etool( expression, etool_id, @@ -885,10 +1408,12 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) if generated_iwdr_reqs: prop_reqs += (cwl.InitialWorkDirRequirement,) else: @@ -903,14 +1428,18 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(envVarReq) - for entry in generated_envVar_reqs: - step.in_.append( + new_requirements = list(step.requirements) + new_requirements.append(envVarReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry2 in generated_envVar_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_envDef{entry[1]}", - source=f"{entry[0]}/result", + id=f"_envDef{entry2[1]}", + source=f"{entry2[0]}/result", ) ) + step.in_ = new_ins if resourceReq and workflow.steps: for step in workflow.steps: @@ -921,15 +1450,19 @@ def process_workflow_reqs_and_hints( if isinstance(req, cwl.ResourceRequirement): continue else: - step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(resourceReq) - for entry in generated_res_reqs: - step.in_.append( + step.requirements = [] + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry3 in generated_res_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_{entry[1]}", - source=f"{entry[0]}/result", + id=f"_{entry3[1]}", + source=f"{entry3[0]}/result", ) ) + step.in_ = new_ins if iwdr and workflow.steps: for step in workflow.steps: @@ -941,32 +1474,39 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(iwdr) + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + new_requirements.append(iwdr) + step.requirements = new_requirements + new_ins = list(step.in_) if generated_iwdr_reqs: - for entry in generated_iwdr_reqs: - step.in_.append( + for entry4 in generated_iwdr_reqs: + new_ins.append( cwl.WorkflowStepInput( id=f"_iwdr_listing_{index}", - source=f"{entry[0]}/result", + source=f"{entry4[0]}/result", ) ) else: - step.in_.append( + new_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source="_expression_workflow_InitialWorkDirRequirement/result", ) ) + step.in_ = new_ins if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance(x, prop_reqs) ] return modified def process_level_reqs( - process: cwl.CommandLineTool, + process: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -1002,7 +1542,7 @@ def process_level_reqs( expression = get_expression(envDef.envValue, inputs, None) if expression: modified = True - target = cwl.InputParameter(id=None, type_="string") + target = cwl.InputParameter(id="", type_="string") etool_id = "_expression_{}_EnvVarRequirement_{}".format( step_name, env_index ) @@ -1015,9 +1555,11 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index][ + new_requirements = list(target_process.requirements) + new_requirements[req_index][ env_index ].envValue = f"$(inputs._envDef{env_index})" + target_process.requirements = new_requirements generated_envVar_reqs.append((etool_id, env_index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -1026,7 +1568,7 @@ def process_level_reqs( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.InputParameter(id=None, type_="long") + target = cwl.InputParameter(id="", type_="long") etool_id = "_expression_{}_ResourceRequirement_{}".format( step_name, attr ) @@ -1055,7 +1597,7 @@ def process_level_reqs( target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) - target = cwl.InputParameter(id=None, type_=target_type) + target = cwl.InputParameter(id="", type_=target_type) etool_id = "_expression_{}_InitialWorkDirRequirement".format( step_name ) @@ -1084,15 +1626,15 @@ def process_level_reqs( process.loadingOptions, ) else: - for listing_index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for listing_index, entry5 in enumerate(req.listing): + expression = get_expression(entry5, inputs, None) if expression: modified = True target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) target = cwl.InputParameter( - id=None, + id="", type_=target_type, ) etool_id = ( @@ -1115,25 +1657,25 @@ def process_level_reqs( generated_iwdr_reqs.append( (etool_id, listing_index, target_type) ) - elif isinstance(entry, cwl.Dirent): - if entry.entry: - expression = get_expression(entry.entry, inputs, None) + elif isinstance(entry5, cwl.Dirent): + if entry5.entry: + expression = get_expression(entry5.entry, inputs, None) if expression: modified = True - if entry.entryname is not None: + if entry5.entryname is not None: entryname_expr = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) entryname = ( - entry.entryname + entry5.entryname if entryname_expr - else f'"{entry.entryname}"' # noqa: B907 + else f'"{entry5.entryname}"' # noqa: B907 ) new_expression = ( "${var result; var entryname = " + entryname + "; var entry = " - + entry.entry[2:-1] + + entry5.entry[2:-1] + """; if (typeof entry === 'string' || entry instanceof String) { result = {"class": "File", "basename": entryname, "contents": entry} ; @@ -1149,7 +1691,7 @@ def process_level_reqs( new_expression = expression d_target_type = ["File", "Directory"] target = cwl.InputParameter( - id=None, + id="", type_=d_target_type, ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( @@ -1172,14 +1714,14 @@ def process_level_reqs( generated_iwdr_reqs.append( (etool_id, listing_index, d_target_type) ) - elif entry.entryname: + elif entry5.entryname: expression = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) if expression: modified = True target = cwl.InputParameter( - id=None, + id="", type_="string", ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( @@ -1256,7 +1798,7 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.InputParameter(id=None, type_=target_type) + target = cwl.InputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) @@ -1282,7 +1824,7 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.InputParameter(id=None, type_=target_type) + target = cwl.InputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) @@ -1308,7 +1850,7 @@ def traverse_CommandLineTool( inp_id = f"_{streamtype}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "string" - target = cwl.InputParameter(id=None, type_=target_type) + target = cwl.InputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) @@ -1348,7 +1890,7 @@ def traverse_CommandLineTool( inp_id = "_{}_glob".format(outp.id.split("#")[-1]) etool_id = f"_expression_{step_id}{inp_id}" glob_target_type = ["string", cwl.ArraySchema("string", "array")] - target = cwl.InputParameter(id=None, type_=glob_target_type) + target = cwl.InputParameter(id="", type_=glob_target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) @@ -1385,7 +1927,7 @@ def traverse_CommandLineTool( step, etool_id, outp_id ) self_type = cwl.InputParameter( - id=None, + id="", type_=cwl.InputArraySchema("File", "array", None, None), ) etool = generate_etool_from_expr( @@ -1658,7 +2200,7 @@ def cltool_inputs_to_etool_inputs( def cltool_step_outputs_to_workflow_outputs( cltool_step: cwl.WorkflowStep, etool_step_id: str, etool_out_id: str -) -> list[cwl.OutputParameter]: +) -> list[cwl.WorkflowOutputParameter]: """ Copy CommandLineTool outputs into the equivalent Workflow output parameters. @@ -1701,7 +2243,13 @@ def generate_etool_from_expr2( cwl.InputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], self_name: str | None = None, - process: cwl.CommandLineTool | cwl.ExpressionTool | None = None, + process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator + | None + ) = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -1715,8 +2263,8 @@ def generate_etool_from_expr2( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_type_to_plain_output(target.type_), ) ) expression = "${" @@ -1731,19 +2279,47 @@ def generate_etool_from_expr2( ) hints = None procs: list[ - cwl.CommandLineTool | cwl.ExpressionTool | cwl.Workflow | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.WorkflowStep + | cwl.ProcessGenerator ] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs = [inlineJSReq] + reqs: MutableSequence[ + cwl.CUDARequirement + | cwl.DockerRequirement + | cwl.EnvVarRequirement + | cwl.InitialWorkDirRequirement + | cwl.InlineJavascriptRequirement + | cwl.InplaceUpdateRequirement + | cwl.LoadListingRequirement + | cwl.MPIRequirement + | cwl.MultipleInputFeatureRequirement + | cwl.NetworkAccess + | cwl.ResourceRequirement + | cwl.ScatterFeatureRequirement + | cwl.SchemaDefRequirement + | cwl.Secrets + | cwl.ShellCommandRequirement + | cwl.ShmSize + | cwl.SoftwareRequirement + | cwl.StepInputExpressionRequirement + | cwl.SubworkflowFeatureRequirement + | cwl.TimeLimit + | cwl.WorkReuse + ] = [inlineJSReq] if process: if process.hints: hints = copy.deepcopy(process.hints) - hints[:] = [ - x for x in hints if not isinstance(x, cwl.InitialWorkDirRequirement) + hints = [ + x + for x in copy.deepcopy(hints) + if not isinstance(x, cwl.InitialWorkDirRequirement) ] if process.requirements: reqs.extend(copy.deepcopy(process.requirements)) @@ -1752,7 +2328,7 @@ def generate_etool_from_expr2( ] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), - inputs=inputs, + inputs=parameters_to_plain_input_paramaters(inputs), outputs=outputs, expression=expression, requirements=reqs, @@ -1774,43 +2350,29 @@ def traverse_step( return False step_id = step.id.split("#")[-1] original_process = copy.deepcopy(step.run) + assert not isinstance(original_process, str) + assert not isinstance(step.run, str) original_step_ins = copy.deepcopy(step.in_) for inp in step.in_: if inp.valueFrom: if not inp.source: self = None else: - if isinstance(inp.source, MutableSequence): - self = [] - for source in inp.source: - if not step.scatter: - self.append( - example_input( - utils.type_for_source(parent, source.split("#")[-1]) - ) - ) - else: - scattered_source_type = utils.type_for_source( - parent, source - ) - if isinstance(scattered_source_type, list): - for stype in scattered_source_type: - self.append(example_input(stype.type_)) - else: - self.append(example_input(scattered_source_type.type_)) - else: + self = [] + for source in inp.source: if not step.scatter: - self = example_input( - utils.type_for_source(parent, inp.source.split("#")[-1]) + self.append( + example_input( + utils.type_for_source(parent, source.split("#")[-1]) + ) ) else: - scattered_source_type2 = utils.type_for_source( - parent, inp.source - ) - if isinstance(scattered_source_type2, list): - self = example_input(scattered_source_type2[0].type_) + scattered_source_type = utils.type_for_source(parent, source) + if isinstance(scattered_source_type, list): + for stype in scattered_source_type: + self.append(example_input(stype.type_)) else: - self = example_input(scattered_source_type2.type_) + self.append(example_input(scattered_source_type.type_)) expression = get_expression(inp.valueFrom, inputs, self) if expression: modified = True @@ -1826,31 +2388,23 @@ def traverse_step( | cwl.CommandOutputParameter ) = None if inp.source: - if isinstance(inp.source, MutableSequence): - input_source_id = [] - source_types: list[cwl.InputParameter] = [] - for source in inp.source: - source_id = source.split("#")[-1] - input_source_id.append(source_id) - temp_type = utils.type_for_source( - step.run, source_id, parent - ) - if isinstance(temp_type, list): - for ttype in temp_type: - if ttype not in source_types: - source_types.append(ttype) - else: - if temp_type not in source_types: - source_types.append(temp_type) - source_type = cwl.InputParameter( - id=None, - type_=cwl.ArraySchema(source_types, "array"), - ) - else: - input_source_id = inp.source.split("#")[-1] - source_type = utils.param_for_source_id( - step.run, input_source_id, parent - ) + input_source_id = [] + source_types: list[BasicInputTypeSchemas] = [] + for source in inp.source: + source_id = source.split("#")[-1] + input_source_id.append(source_id) + temp_type = utils.type_for_source(step.run, source_id, parent) + if isinstance(temp_type, list): + for ttype in temp_type: + if ttype not in source_types: + source_types.append(ttype) + else: + if temp_type not in source_types: + source_types.append(temp_type) + source_type = cwl.InputParameter( + id="", + type_=cwl.InputArraySchema(source_types, "array"), + ) # target.id = target.id.split('#')[-1] if isinstance(original_process, cwl.ExpressionTool): found_JSReq = False @@ -1866,9 +2420,11 @@ def traverse_step( if not step.run.requirements: step.run.requirements = [] expr_lib = find_expressionLib([parent]) - step.run.requirements.append( + new_step_run_requirements = list(step.run.requirements) + new_step_run_requirements.append( cwl.InlineJavascriptRequirement(expr_lib) ) + step.run.requirements = new_step_run_requirements replace_step_valueFrom_expr_with_etool( expression, etool_id, @@ -1885,6 +2441,7 @@ def traverse_step( inp.valueFrom = None inp.source = f"{etool_id}/result" # TODO: skip or special process for sub workflows? + assert not isinstance(original_process, str) process_modified = process_level_reqs( original_process, step, @@ -1910,7 +2467,7 @@ def traverse_step( def workflow_step_to_InputParameters( - step_ins: list[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str + step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str ) -> list[cwl.InputParameter | cwl.CommandOutputParameter]: """Create InputParameters to match the given WorkflowStep inputs.""" params = [] @@ -1949,8 +2506,10 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.InputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: cwl.CommandLineTool | cwl.ExpressionTool, - original_step_ins: list[cwl.WorkflowStepInput], + original_process: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), + original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, source_type: ( @@ -1990,7 +2549,7 @@ def replace_step_valueFrom_expr_with_etool( etool: cwl.ExpressionTool | cwl.CommandLineTool = cltool else: etool = temp_etool - wf_step_inputs = copy.deepcopy(original_step_ins) + wf_step_inputs = list(original_step_ins) if source: wf_step_inputs.append(cwl.WorkflowStepInput(id="self", source=step_inp.source)) for wf_step_input in wf_step_inputs: @@ -1998,12 +2557,11 @@ def replace_step_valueFrom_expr_with_etool( if wf_step_input.valueFrom: wf_step_input.valueFrom = None if wf_step_input.source: - if isinstance(wf_step_input.source, MutableSequence): - for index, inp_source in enumerate(wf_step_input.source): - wf_step_input.source[index] = inp_source.split("#")[-1] - else: - wf_step_input.source = wf_step_input.source.split("#")[-1] - wf_step_inputs[:] = [ + new_source = list(wf_step_input.source) + for index, inp_source in enumerate(wf_step_input.source): + new_source[index] = inp_source.split("#")[-1] + wf_step_input.source = new_source + wf_step_inputs = [ x for x in wf_step_inputs if x.id and not (x.id.startswith("_") or x.id.endswith(step_inp_id)) @@ -2019,7 +2577,8 @@ def replace_step_valueFrom_expr_with_etool( # do we still need to scatter? else: scatter = None - workflow.steps.append( + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -2029,6 +2588,7 @@ def replace_step_valueFrom_expr_with_etool( scatterMethod=step.scatterMethod, ) ) + workflow.steps = new_steps def traverse_workflow( @@ -2061,7 +2621,7 @@ def traverse_workflow( if process_workflow_reqs_and_hints(workflow, replace_etool): modified = True if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance( diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index 0f0e3b7a..e74e3895 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -2,7 +2,7 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path from typing import IO, Any, cast @@ -415,8 +415,10 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, ) -> Any: @@ -466,8 +468,10 @@ def type_for_source( def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( From 69d920daee30cbc4270c2648cccc32b6c753113e Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Fri, 19 Dec 2025 22:22:15 +0100 Subject: [PATCH 03/23] Fix typing errors in utils --- src/cwl_utils/parser/cwl_v1_0_utils.py | 26 ++++-- src/cwl_utils/parser/cwl_v1_1_utils.py | 12 ++- src/cwl_utils/parser/cwl_v1_2_utils.py | 22 +++-- src/cwl_utils/parser/utils.py | 122 +++++++++++++++---------- src/cwl_utils/utils.py | 21 ++++- 5 files changed, 133 insertions(+), 70 deletions(-) diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index e74e3895..36ba87f9 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import Any, IO, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -181,7 +181,7 @@ def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: def check_all_types( src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], type_dict: dict[str, Any], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" @@ -197,7 +197,7 @@ def check_all_types( case _: continue if sourceField is not None: - if isinstance(sourceField, MutableSequence): + if isinstance(sourceField, Sequence): linkMerge = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -475,14 +475,26 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.InputParameter - | cwl.CommandOutputParameter - | MutableSequence[cwl.InputParameter | cwl.CommandOutputParameter] + cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.InputParameter + | cwl.WorkflowOutputParameter + | MutableSequence[ + cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.InputParameter + | cwl.WorkflowOutputParameter + ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] - params: MutableSequence[cwl.InputParameter | cwl.CommandOutputParameter] = [] + params: MutableSequence[ + cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.InputParameter + | cwl.WorkflowOutputParameter + ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): for param in process.inputs: diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index 5247ccdb..12f61c5c 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -2,7 +2,7 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path from typing import IO, Any, cast @@ -181,7 +181,7 @@ def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: def check_all_types( src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], type_dict: dict[str, Any], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" @@ -197,7 +197,7 @@ def check_all_types( case _: continue if sourceField is not None: - if isinstance(sourceField, MutableSequence): + if isinstance(sourceField, Sequence): linkMerge = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -489,11 +489,15 @@ def param_for_source_id( ) -> ( cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter | MutableSequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" @@ -502,7 +506,9 @@ def param_for_source_id( params: MutableSequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 684b81d4..2c78cd56 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -2,7 +2,7 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence +from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path from typing import IO, Any, cast @@ -83,7 +83,7 @@ def _compare_type(type1: Any, type2: Any) -> bool: def _is_all_output_method_loop_step( - param_to_step: dict[str, cwl.WorkflowStep], parm_id: str + param_to_step: Mapping[str, cwl.WorkflowStep], parm_id: str ) -> bool: if (source_step := param_to_step.get(parm_id)) is not None: for requirement in source_step.requirements or []: @@ -93,7 +93,7 @@ def _is_all_output_method_loop_step( def _is_conditional_step( - param_to_step: dict[str, cwl.WorkflowStep], parm_id: str + param_to_step: Mapping[str, cwl.WorkflowStep], parm_id: str ) -> bool: if (source_step := param_to_step.get(parm_id)) is not None: if source_step.when is not None: @@ -200,8 +200,8 @@ def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: def check_all_types( src_dict: dict[str, Any], - sinks: MutableSequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], - param_to_step: dict[str, cwl.WorkflowStep], + sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], + param_to_step: Mapping[str, cwl.WorkflowStep], type_dict: dict[str, Any], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" @@ -221,7 +221,7 @@ def check_all_types( case _: continue if sourceField is not None: - if isinstance(sourceField, MutableSequence) and len(sourceField) > 1: + if isinstance(sourceField, Sequence) and len (sourceField) > 1: linkMerge: str | None = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -595,11 +595,19 @@ def param_for_source_id( ) -> ( cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.OperationInputParameter + | cwl.OperationOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter | MutableSequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.OperationInputParameter + | cwl.OperationOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" @@ -608,7 +616,9 @@ def param_for_source_id( params: MutableSequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter | cwl.WorkflowInputParameter + | cwl.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/src/cwl_utils/parser/utils.py b/src/cwl_utils/parser/utils.py index cfbdc95d..d47c8a68 100644 --- a/src/cwl_utils/parser/utils.py +++ b/src/cwl_utils/parser/utils.py @@ -2,20 +2,19 @@ import copy import logging -from collections.abc import MutableSequence +from collections.abc import MutableMapping, MutableSequence from pathlib import Path from types import ModuleType -from typing import Any, Optional, cast +from typing import Any, Final, Optional, cast from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException from schema_salad.sourceline import SourceLine, strip_dup_lineno from schema_salad.utils import json_dumps, yaml_no_ts -import cwl_utils -import cwl_utils.parser - from . import ( + CommandLineTool, + ExpressionTool, LoadingOptions, Process, Workflow, @@ -27,6 +26,7 @@ cwl_v1_1_utils, cwl_v1_2, cwl_v1_2_utils, + load_document_by_uri, ) _logger = logging.getLogger("cwl_utils") @@ -134,10 +134,10 @@ def load_inputfile_by_yaml( def load_step( - step: cwl_utils.parser.WorkflowStep, + step: WorkflowStep, ) -> Process: if isinstance(step.run, str): - step_run = cwl_utils.parser.load_document_by_uri( + step_run = load_document_by_uri( path=step.loadingOptions.fetcher.urljoin( base_url=cast(str, step.loadingOptions.fileuri), url=step.run, @@ -148,12 +148,12 @@ def load_step( return cast(Process, copy.deepcopy(step.run)) -def static_checker(workflow: cwl_utils.parser.Workflow) -> None: +def static_checker(workflow: Workflow) -> None: """Check if all source and sink types of a workflow are compatible before run time.""" - step_inputs = [] + step_inputs: Final[MutableSequence[WorkflowStepInput]] = [] step_outputs = [] type_dict = {} - param_to_step = {} + param_to_step: Final[MutableMapping[str, WorkflowStep]] = {} for step in workflow.steps: if step.in_ is not None: step_inputs.extend(step.in_) @@ -209,26 +209,36 @@ def static_checker(workflow: cwl_utils.parser.Workflow) -> None: case "v1.0": parser = cwl_v1_0 step_inputs_val = cwl_v1_0_utils.check_all_types( - src_dict, step_inputs, type_dict + src_dict, + cast(MutableSequence[cwl_v1_0.WorkflowStepInput], step_inputs), + type_dict, ) workflow_outputs_val = cwl_v1_0_utils.check_all_types( - src_dict, workflow.outputs, type_dict + src_dict, cast(cwl_v1_0.Workflow, workflow).outputs, type_dict ) case "v1.1": parser = cwl_v1_1 step_inputs_val = cwl_v1_1_utils.check_all_types( - src_dict, step_inputs, type_dict + src_dict, + cast(MutableSequence[cwl_v1_1.WorkflowStepInput], step_inputs), + type_dict, ) workflow_outputs_val = cwl_v1_1_utils.check_all_types( - src_dict, workflow.outputs, type_dict + src_dict, cast(cwl_v1_1.Workflow, workflow).outputs, type_dict ) case "v1.2": parser = cwl_v1_2 step_inputs_val = cwl_v1_2_utils.check_all_types( - src_dict, step_inputs, param_to_step, type_dict + src_dict, + cast(MutableSequence[cwl_v1_2.WorkflowStepInput], step_inputs), + cast(MutableMapping[str, cwl_v1_2.WorkflowStep], param_to_step), + type_dict, ) workflow_outputs_val = cwl_v1_2_utils.check_all_types( - src_dict, workflow.outputs, param_to_step, type_dict + src_dict, + workflow.outputs, + cast(MutableMapping[str, cwl_v1_2.WorkflowStep], param_to_step), + type_dict, ) case _ as cwlVersion: raise Exception(f"Unsupported CWL version {cwlVersion}") @@ -416,74 +426,86 @@ def type_for_step_output(step: WorkflowStep, sourcename: str, cwlVersion: str) - def param_for_source_id( - process: ( - cwl_utils.parser.CommandLineTool - | cwl_utils.parser.Workflow - | cwl_utils.parser.ExpressionTool - ), + process: CommandLineTool | Workflow | ExpressionTool, sourcenames: str | list[str], - parent: cwl_utils.parser.Workflow | None = None, + parent: Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( ( MutableSequence[ - cwl_utils.parser.cwl_v1_0.InputParameter - | cwl_utils.parser.cwl_v1_0.CommandOutputParameter + cwl_v1_0.CommandOutputParameter + | cwl_v1_0.ExpressionToolOutputParameter + | cwl_v1_0.InputParameter + | cwl_v1_0.WorkflowOutputParameter ] - | cwl_utils.parser.cwl_v1_0.InputParameter - | cwl_utils.parser.cwl_v1_0.CommandOutputParameter + | cwl_v1_0.CommandOutputParameter + | cwl_v1_0.ExpressionToolOutputParameter + | cwl_v1_0.InputParameter + | cwl_v1_0.WorkflowOutputParameter ) | ( MutableSequence[ - cwl_utils.parser.cwl_v1_1.CommandInputParameter - | cwl_utils.parser.cwl_v1_1.CommandOutputParameter - | cwl_utils.parser.cwl_v1_1.WorkflowInputParameter + cwl_v1_1.CommandInputParameter + | cwl_v1_1.CommandOutputParameter + | cwl_v1_1.ExpressionToolOutputParameter + | cwl_v1_1.WorkflowInputParameter + | cwl_v1_1.WorkflowOutputParameter ] - | cwl_utils.parser.cwl_v1_1.CommandInputParameter - | cwl_utils.parser.cwl_v1_1.CommandOutputParameter - | cwl_utils.parser.cwl_v1_1.WorkflowInputParameter + | cwl_v1_1.CommandInputParameter + | cwl_v1_1.CommandOutputParameter + | cwl_v1_1.ExpressionToolOutputParameter + | cwl_v1_1.WorkflowInputParameter + | cwl_v1_1.WorkflowOutputParameter ) | ( MutableSequence[ - cwl_utils.parser.cwl_v1_2.CommandInputParameter - | cwl_utils.parser.cwl_v1_2.CommandOutputParameter - | cwl_utils.parser.cwl_v1_2.WorkflowInputParameter + cwl_v1_2.CommandInputParameter + | cwl_v1_2.CommandOutputParameter + | cwl_v1_2.ExpressionToolOutputParameter + | cwl_v1_2.OperationInputParameter + | cwl_v1_2.OperationOutputParameter + | cwl_v1_2.WorkflowInputParameter + | cwl_v1_2.WorkflowOutputParameter ] - | cwl_utils.parser.cwl_v1_2.CommandInputParameter - | cwl_utils.parser.cwl_v1_2.CommandOutputParameter - | cwl_utils.parser.cwl_v1_2.WorkflowInputParameter + | cwl_v1_2.CommandInputParameter + | cwl_v1_2.CommandOutputParameter + | cwl_v1_2.ExpressionToolOutputParameter + | cwl_v1_2.OperationInputParameter + | cwl_v1_2.OperationOutputParameter + | cwl_v1_2.WorkflowInputParameter + | cwl_v1_2.WorkflowOutputParameter ) ): match process.cwlVersion: case "v1.0": - return cwl_utils.parser.cwl_v1_0_utils.param_for_source_id( + return cwl_v1_0_utils.param_for_source_id( cast( - cwl_utils.parser.cwl_v1_0.CommandLineTool - | cwl_utils.parser.cwl_v1_0.Workflow - | cwl_utils.parser.cwl_v1_0.ExpressionTool, + cwl_v1_0.CommandLineTool + | cwl_v1_0.Workflow + | cwl_v1_0.ExpressionTool, process, ), sourcenames, - cast(cwl_utils.parser.cwl_v1_0.Workflow, parent), + cast(cwl_v1_0.Workflow, parent), scatter_context, ) case "v1.1": - return cwl_utils.parser.cwl_v1_1_utils.param_for_source_id( + return cwl_v1_1_utils.param_for_source_id( cast( - cwl_utils.parser.cwl_v1_1.CommandLineTool - | cwl_utils.parser.cwl_v1_1.Workflow - | cwl_utils.parser.cwl_v1_1.ExpressionTool, + cwl_v1_1.CommandLineTool + | cwl_v1_1.Workflow + | cwl_v1_1.ExpressionTool, process, ), sourcenames, - cast(cwl_utils.parser.cwl_v1_1.Workflow, parent), + cast(cwl_v1_1.Workflow, parent), scatter_context, ) case "v1.2": - return cwl_utils.parser.cwl_v1_2_utils.param_for_source_id( + return cwl_v1_2_utils.param_for_source_id( process, sourcenames, - cast(cwl_utils.parser.cwl_v1_2.Workflow, parent), + cast(cwl_v1_2.Workflow, parent), scatter_context, ) case None: diff --git a/src/cwl_utils/utils.py b/src/cwl_utils/utils.py index bfae73dd..57dc8c9f 100644 --- a/src/cwl_utils/utils.py +++ b/src/cwl_utils/utils.py @@ -7,11 +7,11 @@ import urllib.error import urllib.parse import urllib.request -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from copy import deepcopy from importlib.resources import files from io import StringIO -from typing import Any +from typing import Any, cast from urllib.parse import urlparse from ruamel.yaml.main import YAML @@ -415,11 +415,24 @@ def sanitise_schema_field( case {"type": {"type": "enum", **rest}}: schema_field_item["type"] = InputEnumSchemaV1_2( type_="enum", - symbols=rest.get("symbols", ""), + symbols=cast(Sequence[str], rest.get("symbols", [])), ) case {"type": {"type": "array", **rest}}: schema_field_item["type"] = InputArraySchemaV1_2( - type_="array", items=rest.get("items", "") + type_="array", + items=cast( + str + | cwl_v1_2.InputArraySchema + | cwl_v1_2.InputEnumSchema + | cwl_v1_2.InputRecordSchema + | Sequence[ + str + | cwl_v1_2.InputArraySchema + | cwl_v1_2.InputEnumSchema + | cwl_v1_2.InputRecordSchema, + ], + rest.get("items", ""), + ), ) case {"type": {"$import": _}}: pass # Leave import as is From bb405634e5684e5036583cb84729bad2efbb16c4 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Fri, 19 Dec 2025 22:55:37 +0100 Subject: [PATCH 04/23] Regenerate parsers with native ints --- src/cwl_utils/parser/cwl_v1_0.py | 120 +++++++++++---------- src/cwl_utils/parser/cwl_v1_0_utils.py | 18 ++-- src/cwl_utils/parser/cwl_v1_1.py | 138 ++++++++++++------------ src/cwl_utils/parser/cwl_v1_1_utils.py | 18 ++-- src/cwl_utils/parser/cwl_v1_2.py | 142 +++++++++++++------------ src/cwl_utils/parser/cwl_v1_2_utils.py | 38 +++++-- 6 files changed, 253 insertions(+), 221 deletions(-) diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 4aedf527..165e94df 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -18,7 +18,7 @@ from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from mypy_extensions import trait +from mypy_extensions import i32, i64, trait from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -265,7 +265,7 @@ def load_field( save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str ) @@ -343,7 +343,7 @@ def save( for key in val: newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) return newdict - if val is None or isinstance(val, (int, float, bool, str)): + if val is None or isinstance(val, (i32, i64, float, bool, str)): return val raise Exception("Not Saveable: %s" % type(val)) @@ -1187,7 +1187,7 @@ def parser_info() -> str: @trait -class Documented(Saveable): +class Documented(Saveable, metaclass=ABCMeta): pass @@ -3974,7 +3974,7 @@ def __init__( nameroot: None | str = None, nameext: None | str = None, checksum: None | str = None, - size: None | int = None, + size: None | i32 = None, secondaryFiles: None | Sequence[Directory | File] = None, format: None | str = None, contents: None | str = None, @@ -3989,7 +3989,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.class_: Final[str] = "File" self.location = location self.path = path self.basename = basename @@ -4395,7 +4395,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.class_: Final[str] = "Directory" self.location = location self.path = path self.basename = basename @@ -4407,12 +4407,12 @@ def __init__( @trait -class SchemaBase(Saveable): +class SchemaBase(Saveable, metaclass=ABCMeta): pass @trait -class Parameter(SchemaBase): +class Parameter(SchemaBase, metaclass=ABCMeta): """ Define an input or output parameter to a process. @@ -4422,22 +4422,22 @@ class Parameter(SchemaBase): @trait -class InputBinding(Saveable): +class InputBinding(Saveable, metaclass=ABCMeta): pass @trait -class OutputBinding(Saveable): +class OutputBinding(Saveable, metaclass=ABCMeta): pass @trait -class InputSchema(SchemaBase): +class InputSchema(SchemaBase, metaclass=ABCMeta): pass @trait -class OutputSchema(SchemaBase): +class OutputSchema(SchemaBase, metaclass=ABCMeta): pass @@ -8281,7 +8281,7 @@ def __init__( @trait -class ProcessRequirement(Saveable): +class ProcessRequirement(Saveable, metaclass=ABCMeta): """ A process requirement declares a prerequisite that may or must be fulfilled before executing a process. See [`Process.hints`](#process) and @@ -8296,7 +8296,7 @@ class ProcessRequirement(Saveable): @trait -class Process(Saveable): +class Process(Saveable, metaclass=ABCMeta): """ The base executable type in CWL is the `Process` object defined by the @@ -8484,7 +8484,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.class_: Final[str] = "InlineJavascriptRequirement" self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @@ -8665,7 +8665,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.class_: Final[str] = "SchemaDefRequirement" self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -9389,7 +9389,7 @@ def save( def __init__( self, loadContents: None | bool = None, - position: None | int = None, + position: None | i32 = None, prefix: None | str = None, separate: None | bool = None, itemSeparator: None | str = None, @@ -14687,9 +14687,9 @@ def __init__( stdin: None | str = None, stderr: None | str = None, stdout: None | str = None, - successCodes: None | Sequence[int] = None, - temporaryFailCodes: None | Sequence[int] = None, - permanentFailCodes: None | Sequence[int] = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -14709,7 +14709,7 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.class_: Final[str] = "CommandLineTool" self.baseCommand = baseCommand self.arguments = arguments self.stdin = stdin @@ -15243,7 +15243,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.class_: Final[str] = "DockerRequirement" self.dockerPull = dockerPull self.dockerLoad = dockerLoad self.dockerFile = dockerFile @@ -15434,7 +15434,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.class_: Final[str] = "SoftwareRequirement" self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -16132,7 +16132,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.class_: Final[str] = "InitialWorkDirRequirement" self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -16308,7 +16308,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.class_: Final[str] = "EnvVarRequirement" self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -16433,7 +16433,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + self.class_: Final[str] = "ShellCommandRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -17011,14 +17011,14 @@ def save( def __init__( self, - coresMin: None | int | str = None, - coresMax: None | int | str = None, - ramMin: None | int | str = None, - ramMax: None | int | str = None, - tmpdirMin: None | int | str = None, - tmpdirMax: None | int | str = None, - outdirMin: None | int | str = None, - outdirMax: None | int | str = None, + coresMin: None | i32 | str = None, + coresMax: None | i32 | str = None, + ramMin: None | i32 | str = None, + ramMax: None | i32 | str = None, + tmpdirMin: None | i32 | str = None, + tmpdirMax: None | i32 | str = None, + outdirMin: None | i32 | str = None, + outdirMax: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17030,7 +17030,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.class_: Final[str] = "ResourceRequirement" self.coresMin = coresMin self.coresMax = coresMax self.ramMin = ramMin @@ -18270,7 +18270,7 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.class_: Final[str] = "ExpressionTool" self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( @@ -18982,7 +18982,7 @@ def __init__( @trait -class Sink(Saveable): +class Sink(Saveable, metaclass=ABCMeta): pass @@ -20995,7 +20995,7 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.class_: Final[str] = "Workflow" self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( @@ -21128,7 +21128,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -21247,7 +21247,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -21366,7 +21366,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -21485,7 +21485,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + self.class_: Final[str] = "StepInputExpressionRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -21659,7 +21659,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#LoadListingRequirement" + self.class_: Final[str] = "LoadListingRequirement" self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -21835,7 +21835,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#InplaceUpdateRequirement" + self.class_: Final[str] = "InplaceUpdateRequirement" self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -22004,7 +22004,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.class_: Final[str] = "Secrets" self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -22175,7 +22175,7 @@ def save( def __init__( self, - timelimit: int | str, + timelimit: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -22187,7 +22187,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#TimeLimit" + self.class_: Final[str] = "TimeLimit" self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -22375,7 +22375,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#WorkReuse" + self.class_: Final[str] = "WorkReuse" self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -22570,7 +22570,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#NetworkAccess" + self.class_: Final[str] = "NetworkAccess" self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -23210,7 +23210,7 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.class_: Final[str] = "ProcessGenerator" self.run = run attrs: ClassVar[Collection[str]] = frozenset( @@ -23391,7 +23391,7 @@ def save( def __init__( self, - processes: int | str, + processes: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23403,7 +23403,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.class_: Final[str] = "MPIRequirement" self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -23751,8 +23751,8 @@ def __init__( self, cudaComputeCapability: Sequence[str] | str, cudaVersionMin: str, - cudaDeviceCountMax: None | int | str = None, - cudaDeviceCountMin: None | int | str = None, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23764,7 +23764,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.class_: Final[str] = "CUDARequirement" self.cudaComputeCapability = cudaComputeCapability self.cudaDeviceCountMax = cudaDeviceCountMax self.cudaDeviceCountMin = cudaDeviceCountMin @@ -23945,7 +23945,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.class_: Final[str] = "ShmSize" self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -24197,11 +24197,12 @@ def __init__( }) strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(int) +inttype: Final = _PrimitiveLoader(i32) floattype: Final = _PrimitiveLoader(float) booltype: Final = _PrimitiveLoader(bool) None_type: Final = _PrimitiveLoader(type(None)) Any_type: Final = _AnyLoader() +longtype: Final = _PrimitiveLoader(i64) PrimitiveTypeLoader: Final = _EnumLoader( ( "null", @@ -25549,6 +25550,7 @@ def __init__( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -25558,7 +25560,7 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index 36ba87f9..dd00335d 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -195,16 +195,9 @@ def check_all_types( sourceName = "source" sourceField = sink.source case _: - continue + raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: - if isinstance(sourceField, Sequence): - linkMerge = sink.linkMerge or ( - "merge_nested" if len(sourceField) > 1 else None - ) - srcs_of_sink = [] - for parm_id in sourceField: - srcs_of_sink += [src_dict[parm_id]] - else: + if isinstance(sourceField, str): parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( @@ -212,6 +205,13 @@ def check_all_types( ) srcs_of_sink = [src_dict[parm_id]] linkMerge = None + else: + linkMerge = sink.linkMerge or ( + "merge_nested" if len(sourceField) > 1 else None + ) + srcs_of_sink = [] + for parm_id in sourceField: + srcs_of_sink += [src_dict[parm_id]] for src in srcs_of_sink: check_result = check_types( type_dict[cast(str, src.id)], diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index d03c8932..7397d3a5 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -18,7 +18,7 @@ from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from mypy_extensions import trait +from mypy_extensions import i32, i64, trait from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -265,7 +265,7 @@ def load_field( save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str ) @@ -343,7 +343,7 @@ def save( for key in val: newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) return newdict - if val is None or isinstance(val, (int, float, bool, str)): + if val is None or isinstance(val, (i32, i64, float, bool, str)): return val raise Exception("Not Saveable: %s" % type(val)) @@ -1187,7 +1187,7 @@ def parser_info() -> str: @trait -class Documented(Saveable): +class Documented(Saveable, metaclass=ABCMeta): pass @@ -3974,7 +3974,7 @@ def __init__( nameroot: None | str = None, nameext: None | str = None, checksum: None | str = None, - size: None | int = None, + size: None | i32 = None, secondaryFiles: None | Sequence[Directory | File] = None, format: None | str = None, contents: None | str = None, @@ -3989,7 +3989,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.class_: Final[str] = "File" self.location = location self.path = path self.basename = basename @@ -4395,7 +4395,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.class_: Final[str] = "Directory" self.location = location self.path = path self.basename = basename @@ -4407,42 +4407,42 @@ def __init__( @trait -class Labeled(Saveable): +class Labeled(Saveable, metaclass=ABCMeta): pass @trait -class Identified(Saveable): +class Identified(Saveable, metaclass=ABCMeta): pass @trait -class IdentifierRequired(Identified): +class IdentifierRequired(Identified, metaclass=ABCMeta): pass @trait -class LoadContents(Saveable): +class LoadContents(Saveable, metaclass=ABCMeta): pass @trait -class FieldBase(Labeled): +class FieldBase(Labeled, metaclass=ABCMeta): pass @trait -class InputFormat(Saveable): +class InputFormat(Saveable, metaclass=ABCMeta): pass @trait -class OutputFormat(Saveable): +class OutputFormat(Saveable, metaclass=ABCMeta): pass @trait -class Parameter(FieldBase, Documented, IdentifierRequired): +class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): """ Define an input or output parameter to a process. @@ -4599,17 +4599,17 @@ def __init__( @trait -class IOSchema(Labeled, Documented): +class IOSchema(Labeled, Documented, metaclass=ABCMeta): pass @trait -class InputSchema(IOSchema): +class InputSchema(IOSchema, metaclass=ABCMeta): pass @trait -class OutputSchema(IOSchema): +class OutputSchema(IOSchema, metaclass=ABCMeta): pass @@ -8032,17 +8032,17 @@ def __init__( @trait -class InputParameter(Parameter, InputFormat, LoadContents): +class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): pass @trait -class OutputParameter(Parameter, OutputFormat): +class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): pass @trait -class ProcessRequirement(Saveable): +class ProcessRequirement(Saveable, metaclass=ABCMeta): """ A process requirement declares a prerequisite that may or must be fulfilled before executing a process. See [`Process.hints`](#process) and @@ -8057,7 +8057,7 @@ class ProcessRequirement(Saveable): @trait -class Process(Identified, Labeled, Documented): +class Process(Identified, Labeled, Documented, metaclass=ABCMeta): """ The base executable type in CWL is the `Process` object defined by the @@ -8245,14 +8245,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.class_: Final[str] = "InlineJavascriptRequirement" self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @trait -class CommandInputSchema(Saveable): +class CommandInputSchema(Saveable, metaclass=ABCMeta): pass @@ -8431,7 +8431,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.class_: Final[str] = "SchemaDefRequirement" self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8812,7 +8812,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#LoadListingRequirement" + self.class_: Final[str] = "LoadListingRequirement" self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9536,7 +9536,7 @@ def save( def __init__( self, loadContents: None | bool = None, - position: None | int | str = None, + position: None | i32 | str = None, prefix: None | str = None, separate: None | bool = None, itemSeparator: None | str = None, @@ -9911,7 +9911,7 @@ def __init__( @trait -class CommandLineBindable(Saveable): +class CommandLineBindable(Saveable, metaclass=ABCMeta): pass @@ -16004,9 +16004,9 @@ def __init__( stdin: None | str = None, stderr: None | str = None, stdout: None | str = None, - successCodes: None | Sequence[int] = None, - temporaryFailCodes: None | Sequence[int] = None, - permanentFailCodes: None | Sequence[int] = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -16026,7 +16026,7 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.class_: Final[str] = "CommandLineTool" self.baseCommand = baseCommand self.arguments = arguments self.stdin = stdin @@ -16578,7 +16578,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.class_: Final[str] = "DockerRequirement" self.dockerPull = dockerPull self.dockerLoad = dockerLoad self.dockerFile = dockerFile @@ -16769,7 +16769,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.class_: Final[str] = "SoftwareRequirement" self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17467,7 +17467,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.class_: Final[str] = "InitialWorkDirRequirement" self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -17643,7 +17643,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.class_: Final[str] = "EnvVarRequirement" self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -17768,7 +17768,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + self.class_: Final[str] = "ShellCommandRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -18346,14 +18346,14 @@ def save( def __init__( self, - coresMin: None | int | str = None, - coresMax: None | int | str = None, - ramMin: None | int | str = None, - ramMax: None | int | str = None, - tmpdirMin: None | int | str = None, - tmpdirMax: None | int | str = None, - outdirMin: None | int | str = None, - outdirMax: None | int | str = None, + coresMin: None | i32 | str = None, + coresMax: None | i32 | str = None, + ramMin: None | i32 | str = None, + ramMax: None | i32 | str = None, + tmpdirMin: None | i32 | str = None, + tmpdirMax: None | i32 | str = None, + outdirMin: None | i32 | str = None, + outdirMax: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -18365,7 +18365,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.class_: Final[str] = "ResourceRequirement" self.coresMin = coresMin self.coresMax = coresMax self.ramMin = ramMin @@ -18572,7 +18572,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#WorkReuse" + self.class_: Final[str] = "WorkReuse" self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -18767,7 +18767,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#NetworkAccess" + self.class_: Final[str] = "NetworkAccess" self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -18977,7 +18977,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InplaceUpdateRequirement" + self.class_: Final[str] = "InplaceUpdateRequirement" self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -19151,7 +19151,7 @@ def save( def __init__( self, - timelimit: int | str, + timelimit: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -19163,7 +19163,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ToolTimeLimit" + self.class_: Final[str] = "ToolTimeLimit" self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -21073,7 +21073,7 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.class_: Final[str] = "ExpressionTool" self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( @@ -21727,7 +21727,7 @@ def __init__( @trait -class Sink(Saveable): +class Sink(Saveable, metaclass=ABCMeta): pass @@ -23939,7 +23939,7 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.class_: Final[str] = "Workflow" self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( @@ -24072,7 +24072,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24191,7 +24191,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24310,7 +24310,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24429,7 +24429,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + self.class_: Final[str] = "StepInputExpressionRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24597,7 +24597,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.class_: Final[str] = "Secrets" self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -25239,7 +25239,7 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.class_: Final[str] = "ProcessGenerator" self.run = run attrs: ClassVar[Collection[str]] = frozenset( @@ -25420,7 +25420,7 @@ def save( def __init__( self, - processes: int | str, + processes: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25432,7 +25432,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.class_: Final[str] = "MPIRequirement" self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -25780,8 +25780,8 @@ def __init__( self, cudaComputeCapability: Sequence[str] | str, cudaVersionMin: str, - cudaDeviceCountMax: None | int | str = None, - cudaDeviceCountMin: None | int | str = None, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25793,7 +25793,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.class_: Final[str] = "CUDARequirement" self.cudaComputeCapability = cudaComputeCapability self.cudaDeviceCountMax = cudaDeviceCountMax self.cudaDeviceCountMin = cudaDeviceCountMin @@ -25974,7 +25974,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.class_: Final[str] = "ShmSize" self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -26254,11 +26254,12 @@ def __init__( }) strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(int) +inttype: Final = _PrimitiveLoader(i32) floattype: Final = _PrimitiveLoader(float) booltype: Final = _PrimitiveLoader(bool) None_type: Final = _PrimitiveLoader(type(None)) Any_type: Final = _AnyLoader() +longtype: Final = _PrimitiveLoader(i64) PrimitiveTypeLoader: Final = _EnumLoader( ( "null", @@ -27707,6 +27708,7 @@ def __init__( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -27716,7 +27718,7 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index 12f61c5c..ecd784e8 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -195,16 +195,9 @@ def check_all_types( sourceName = "source" sourceField = sink.source case _: - continue + raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: - if isinstance(sourceField, Sequence): - linkMerge = sink.linkMerge or ( - "merge_nested" if len(sourceField) > 1 else None - ) - srcs_of_sink = [] - for parm_id in sourceField: - srcs_of_sink += [src_dict[parm_id]] - else: + if isinstance(sourceField, str): parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( @@ -212,6 +205,13 @@ def check_all_types( ) srcs_of_sink = [src_dict[parm_id]] linkMerge = None + else: + linkMerge = sink.linkMerge or ( + "merge_nested" if len(sourceField) > 1 else None + ) + srcs_of_sink = [] + for parm_id in sourceField: + srcs_of_sink += [src_dict[parm_id]] for src in srcs_of_sink: check_result = check_types( type_dict[cast(str, src.id)], diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index 77a7c937..25d55219 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -18,7 +18,7 @@ from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 from io import StringIO from itertools import chain -from mypy_extensions import trait +from mypy_extensions import i32, i64, trait from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -265,7 +265,7 @@ def load_field( save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str + None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str ) @@ -343,7 +343,7 @@ def save( for key in val: newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) return newdict - if val is None or isinstance(val, (int, float, bool, str)): + if val is None or isinstance(val, (i32, i64, float, bool, str)): return val raise Exception("Not Saveable: %s" % type(val)) @@ -1187,7 +1187,7 @@ def parser_info() -> str: @trait -class Documented(Saveable): +class Documented(Saveable, metaclass=ABCMeta): pass @@ -3974,7 +3974,7 @@ def __init__( nameroot: None | str = None, nameext: None | str = None, checksum: None | str = None, - size: None | int = None, + size: None | i32 = None, secondaryFiles: None | Sequence[Directory | File] = None, format: None | str = None, contents: None | str = None, @@ -3989,7 +3989,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#File" + self.class_: Final[str] = "File" self.location = location self.path = path self.basename = basename @@ -4395,7 +4395,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory" + self.class_: Final[str] = "Directory" self.location = location self.path = path self.basename = basename @@ -4407,42 +4407,42 @@ def __init__( @trait -class Labeled(Saveable): +class Labeled(Saveable, metaclass=ABCMeta): pass @trait -class Identified(Saveable): +class Identified(Saveable, metaclass=ABCMeta): pass @trait -class IdentifierRequired(Identified): +class IdentifierRequired(Identified, metaclass=ABCMeta): pass @trait -class LoadContents(Saveable): +class LoadContents(Saveable, metaclass=ABCMeta): pass @trait -class FieldBase(Labeled): +class FieldBase(Labeled, metaclass=ABCMeta): pass @trait -class InputFormat(Saveable): +class InputFormat(Saveable, metaclass=ABCMeta): pass @trait -class OutputFormat(Saveable): +class OutputFormat(Saveable, metaclass=ABCMeta): pass @trait -class Parameter(FieldBase, Documented, IdentifierRequired): +class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): """ Define an input or output parameter to a process. @@ -4599,17 +4599,17 @@ def __init__( @trait -class IOSchema(Labeled, Documented): +class IOSchema(Labeled, Documented, metaclass=ABCMeta): pass @trait -class InputSchema(IOSchema): +class InputSchema(IOSchema, metaclass=ABCMeta): pass @trait -class OutputSchema(IOSchema): +class OutputSchema(IOSchema, metaclass=ABCMeta): pass @@ -8032,17 +8032,17 @@ def __init__( @trait -class InputParameter(Parameter, InputFormat, LoadContents): +class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): pass @trait -class OutputParameter(Parameter, OutputFormat): +class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): pass @trait -class ProcessRequirement(Saveable): +class ProcessRequirement(Saveable, metaclass=ABCMeta): """ A process requirement declares a prerequisite that may or must be fulfilled before executing a process. See [`Process.hints`](#process) and @@ -8057,7 +8057,7 @@ class ProcessRequirement(Saveable): @trait -class Process(Identified, Labeled, Documented): +class Process(Identified, Labeled, Documented, metaclass=ABCMeta): """ The base executable type in CWL is the `Process` object defined by the @@ -8245,14 +8245,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement" + self.class_: Final[str] = "InlineJavascriptRequirement" self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @trait -class CommandInputSchema(Saveable): +class CommandInputSchema(Saveable, metaclass=ABCMeta): pass @@ -8436,7 +8436,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement" + self.class_: Final[str] = "SchemaDefRequirement" self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8834,7 +8834,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#LoadListingRequirement" + self.class_: Final[str] = "LoadListingRequirement" self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9558,7 +9558,7 @@ def save( def __init__( self, loadContents: None | bool = None, - position: None | int | str = None, + position: None | i32 | str = None, prefix: None | str = None, separate: None | bool = None, itemSeparator: None | str = None, @@ -9933,7 +9933,7 @@ def __init__( @trait -class CommandLineBindable(Saveable): +class CommandLineBindable(Saveable, metaclass=ABCMeta): pass @@ -16080,9 +16080,9 @@ def __init__( stdin: None | str = None, stderr: None | str = None, stdout: None | str = None, - successCodes: None | Sequence[int] = None, - temporaryFailCodes: None | Sequence[int] = None, - permanentFailCodes: None | Sequence[int] = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -16103,7 +16103,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool" + self.class_: Final[str] = "CommandLineTool" self.baseCommand = baseCommand self.arguments = arguments self.stdin = stdin @@ -16656,7 +16656,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement" + self.class_: Final[str] = "DockerRequirement" self.dockerPull = dockerPull self.dockerLoad = dockerLoad self.dockerFile = dockerFile @@ -16847,7 +16847,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement" + self.class_: Final[str] = "SoftwareRequirement" self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17550,7 +17550,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement" + self.class_: Final[str] = "InitialWorkDirRequirement" self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -17726,7 +17726,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement" + self.class_: Final[str] = "EnvVarRequirement" self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -17851,7 +17851,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement" + self.class_: Final[str] = "ShellCommandRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -18434,14 +18434,14 @@ def save( def __init__( self, - coresMin: None | float | int | str = None, - coresMax: None | float | int | str = None, - ramMin: None | float | int | str = None, - ramMax: None | float | int | str = None, - tmpdirMin: None | float | int | str = None, - tmpdirMax: None | float | int | str = None, - outdirMin: None | float | int | str = None, - outdirMax: None | float | int | str = None, + coresMin: None | float | i32 | str = None, + coresMax: None | float | i32 | str = None, + ramMin: None | float | i32 | str = None, + ramMax: None | float | i32 | str = None, + tmpdirMin: None | float | i32 | str = None, + tmpdirMax: None | float | i32 | str = None, + outdirMin: None | float | i32 | str = None, + outdirMax: None | float | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -18453,7 +18453,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement" + self.class_: Final[str] = "ResourceRequirement" self.coresMin = coresMin self.coresMax = coresMax self.ramMin = ramMin @@ -18660,7 +18660,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#WorkReuse" + self.class_: Final[str] = "WorkReuse" self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -18855,7 +18855,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#NetworkAccess" + self.class_: Final[str] = "NetworkAccess" self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -19065,7 +19065,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#InplaceUpdateRequirement" + self.class_: Final[str] = "InplaceUpdateRequirement" self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -19239,7 +19239,7 @@ def save( def __init__( self, - timelimit: int | str, + timelimit: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -19251,7 +19251,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ToolTimeLimit" + self.class_: Final[str] = "ToolTimeLimit" self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -21216,7 +21216,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool" + self.class_: Final[str] = "ExpressionTool" self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( @@ -21931,7 +21931,7 @@ def __init__( @trait -class Sink(Saveable): +class Sink(Saveable, metaclass=ABCMeta): pass @@ -24407,7 +24407,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow" + self.class_: Final[str] = "Workflow" self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( @@ -24541,7 +24541,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement" + self.class_: Final[str] = "SubworkflowFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24660,7 +24660,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement" + self.class_: Final[str] = "ScatterFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24779,7 +24779,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement" + self.class_: Final[str] = "MultipleInputFeatureRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -24898,7 +24898,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement" + self.class_: Final[str] = "StepInputExpressionRequirement" attrs: ClassVar[Collection[str]] = frozenset(["class"]) @@ -26753,7 +26753,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "https://w3id.org/cwl/cwl#Operation" + self.class_: Final[str] = "Operation" attrs: ClassVar[Collection[str]] = frozenset( [ @@ -26934,7 +26934,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets" + self.class_: Final[str] = "Secrets" self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -27631,7 +27631,7 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator" + self.class_: Final[str] = "ProcessGenerator" self.run = run attrs: ClassVar[Collection[str]] = frozenset( @@ -27813,7 +27813,7 @@ def save( def __init__( self, - processes: int | str, + processes: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -27825,7 +27825,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement" + self.class_: Final[str] = "MPIRequirement" self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -28173,8 +28173,8 @@ def __init__( self, cudaComputeCapability: Sequence[str] | str, cudaVersionMin: str, - cudaDeviceCountMax: None | int | str = None, - cudaDeviceCountMin: None | int | str = None, + cudaDeviceCountMax: None | i32 | str = None, + cudaDeviceCountMin: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -28186,7 +28186,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement" + self.class_: Final[str] = "CUDARequirement" self.cudaComputeCapability = cudaComputeCapability self.cudaDeviceCountMax = cudaDeviceCountMax self.cudaDeviceCountMin = cudaDeviceCountMin @@ -28941,7 +28941,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#Loop" + self.class_: Final[str] = "Loop" self.loop = loop self.loopWhen = loopWhen self.outputMethod = outputMethod @@ -29115,7 +29115,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize" + self.class_: Final[str] = "ShmSize" self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -29429,11 +29429,12 @@ def __init__( }) strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(int) +inttype: Final = _PrimitiveLoader(i32) floattype: Final = _PrimitiveLoader(float) booltype: Final = _PrimitiveLoader(bool) None_type: Final = _PrimitiveLoader(type(None)) Any_type: Final = _AnyLoader() +longtype: Final = _PrimitiveLoader(i64) PrimitiveTypeLoader: Final = _EnumLoader( ( "null", @@ -30966,6 +30967,7 @@ def __init__( ( booltype, inttype, + longtype, floattype, strtype, FileLoader, @@ -30975,7 +30977,7 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 2c78cd56..777417ef 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -219,7 +219,7 @@ def check_all_types( sourceName = "source" sourceField = sink.source case _: - continue + raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: if isinstance(sourceField, Sequence) and len (sourceField) > 1: linkMerge: str | None = sink.linkMerge or ( @@ -256,10 +256,10 @@ def check_all_types( items=src_typ, type_="array" ) else: - if isinstance(sourceField, MutableSequence): - parm_id = cast(str, sourceField[0]) + if isinstance(sourceField, Sequence): + parm_id = sourceField[0] else: - parm_id = cast(str, sourceField) + parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( f"{sourceName} not found: {parm_id}" @@ -281,8 +281,8 @@ def check_all_types( if "null" not in src_typ: src_typ = ["null"] + cast(list[Any], src_typ) if ( - not isinstance(snk_typ, MutableSequence) - or "null" not in snk_typ + not isinstance(snk_typ, MutableSequence) + or "null" not in snk_typ ): validation["warning"].append( SrcSink( @@ -298,6 +298,32 @@ def check_all_types( type_dict[src_dict[parm_id].id] = cwl.ArraySchema( items=src_typ, type_="array" ) + else: + linkMerge: str | None = sink.linkMerge or ( + "merge_nested" if len(sourceField) > 1 else None + ) + if sink.pickValue in ("first_non_null", "the_only_non_null"): + linkMerge = None + srcs_of_sink = [] + for parm_id in sourceField: + srcs_of_sink += [src_dict[parm_id]] + if ( + _is_conditional_step(param_to_step, parm_id) + and sink.pickValue is not None + ): + validation["warning"].append( + SrcSink( + src_dict[parm_id], + sink, + linkMerge, + message="Source is from conditional step, but pickValue is not used", + ) + ) + if _is_all_output_method_loop_step(param_to_step, parm_id): + src_typ = type_dict[src_dict[parm_id].id] + type_dict[src_dict[parm_id].id] = cwl.ArraySchema( + items=src_typ, type_="array" + ) for src in srcs_of_sink: check_result = check_types( type_dict[cast(str, src.id)], From 11e81e349ff8a836da1b16f09798f4783edfd218 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 20 Dec 2025 12:02:03 +0100 Subject: [PATCH 05/23] ProcessGenerator schema improvement --- src/cwl_utils/parser/cwl_v1_0.py | 4 ++-- src/cwl_utils/parser/cwl_v1_1.py | 8 ++++---- src/cwl_utils/parser/cwl_v1_2.py | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 165e94df..406bcd7d 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -22751,7 +22751,7 @@ def fromDoc( outputs = load_field( _doc.get("outputs"), - idmap_outputs_array_of_OutputParameterLoader, + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -23183,7 +23183,7 @@ def save( def __init__( self, inputs: Sequence[InputParameter], - outputs: Sequence[OutputParameter], + outputs: Sequence[ExpressionToolOutputParameter], run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, id: None | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index 7397d3a5..0f4004c0 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -24824,7 +24824,7 @@ def fromDoc( inputs = load_field( _doc.get("inputs"), - idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader, + idmap_inputs_array_of_WorkflowInputParameterLoader, baseuri, loadingOptions, lc=_doc.get("inputs") @@ -24872,7 +24872,7 @@ def fromDoc( outputs = load_field( _doc.get("outputs"), - idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader, + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -25211,8 +25211,8 @@ def save( def __init__( self, - inputs: Sequence[CommandInputParameter | WorkflowInputParameter], - outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter], + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, id: None | str = None, label: None | str = None, diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index 25d55219..167ed57b 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -27163,7 +27163,7 @@ def fromDoc( inputs = load_field( _doc.get("inputs"), - idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader, + idmap_inputs_array_of_WorkflowInputParameterLoader, baseuri, loadingOptions, lc=_doc.get("inputs") @@ -27211,7 +27211,7 @@ def fromDoc( outputs = load_field( _doc.get("outputs"), - idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader, + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -27601,8 +27601,8 @@ def save( def __init__( self, - inputs: Sequence[CommandInputParameter | OperationInputParameter | WorkflowInputParameter], - outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter], + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str, id: None | str = None, label: None | str = None, From f345e801151c6582f9ba30f0427a427385894762 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 20 Dec 2025 11:38:47 +0100 Subject: [PATCH 06/23] finish type fixing cwl_v1_0_expression_refactor --- src/cwl_utils/cwl_v1_0_expression_refactor.py | 797 ++++++++---------- src/cwl_utils/parser/cwl_v1_0_utils.py | 2 +- src/cwl_utils/parser/cwl_v1_2_utils.py | 8 +- 3 files changed, 339 insertions(+), 468 deletions(-) diff --git a/src/cwl_utils/cwl_v1_0_expression_refactor.py b/src/cwl_utils/cwl_v1_0_expression_refactor.py index 03628bb7..2d84bc5d 100755 --- a/src/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_0_expression_refactor.py @@ -76,6 +76,46 @@ def escape_expression_field(contents: str) -> str: InputTypeSchemas: TypeAlias = ( BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] | None ) +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] | None +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +OutputTypeSchemas: TypeAlias = ( + BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] | None +) BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema @@ -215,41 +255,9 @@ def get_expression( return None -def _plain_input_type_to_clt_input( - input_type: ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ), -) -> ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str -): +def _plain_input_schema_to_clt_input_schema( + input_type: BasicInputTypeSchemas, +) -> BasicCommandInputTypeSchemas: match input_type: case cwl.InputArraySchema(): return cwl.CommandInputArraySchema.fromDoc( @@ -274,122 +282,22 @@ def _plain_input_type_to_clt_input( raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") -def plain_input_type_to_clt_input( - input_type: ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str - ), -) -> ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str -): +def plain_input_schema_to_clt_input_schema( + input_type: InputTypeSchemas, +) -> CommandInputTypeSchemas: if isinstance(input_type, Sequence): return [ - _plain_input_type_to_clt_input(input_type_item) + _plain_input_schema_to_clt_input_schema(input_type_item) for input_type_item in input_type ] if input_type is None: return None - return _plain_input_type_to_clt_input(input_type) - - -def _plain_input_type_to_plain_output( - input_type: ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ), -) -> ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str -): + return _plain_input_schema_to_clt_input_schema(input_type) + + +def _plain_input_schema_to_plain_output_schema( + input_type: BasicInputTypeSchemas, +) -> BasicOutputTypeSchemas: match input_type: case cwl.InputArraySchema(): return cwl.OutputArraySchema.fromDoc( @@ -414,122 +322,22 @@ def _plain_input_type_to_plain_output( raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") -def plain_input_type_to_plain_output( - input_type: ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str - ), -) -> ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str -): +def plain_input_schema_to_plain_output_schema( + input_type: InputTypeSchemas, +) -> OutputTypeSchemas: if isinstance(input_type, Sequence): return [ - _plain_input_type_to_plain_output(input_type_item) + _plain_input_schema_to_plain_output_schema(input_type_item) for input_type_item in input_type ] if input_type is None: return None - return _plain_input_type_to_plain_output(input_type) - - -def _plain_output_type_to_clt_output( - output_type: ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ), -) -> ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str -): + return _plain_input_schema_to_plain_output_schema(input_type) + + +def _plain_output_type_to_clt_output_type( + output_type: BasicOutputTypeSchemas, +) -> BasicCommandOutputTypeSchemas: match output_type: case cwl.OutputArraySchema(): return cwl.CommandOutputArraySchema.fromDoc( @@ -554,85 +362,31 @@ def _plain_output_type_to_clt_output( raise WorkflowException(f"Unexpected ExpressionTool output type: {output_type}.") -def plain_output_type_to_clt_output( - output_type: ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str - ), -) -> ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | None - | Sequence[ - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] - | str -): +def plain_output_type_to_clt_output_type( + output_type: OutputTypeSchemas, +) -> CommandOutputTypeSchemas: if isinstance(output_type, Sequence): return [ - _plain_output_type_to_clt_output(output_type_item) + _plain_output_type_to_clt_output_type(output_type_item) for output_type_item in output_type ] if output_type is None: return None - return _plain_output_type_to_clt_output(output_type) + return _plain_output_type_to_clt_output_type(output_type) + + +def parameter_to_plain_input_paramater( + parameter: ( + cwl.InputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.WorkflowOutputParameter + ), +) -> cwl.InputParameter: + return cwl.InputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) def parameters_to_plain_input_paramaters( @@ -640,12 +394,7 @@ def parameters_to_plain_input_paramaters( cwl.InputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], ) -> Sequence[cwl.InputParameter]: - return [ - cwl.InputParameter.fromDoc( - parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions - ) - for parameter in parameters - ] + return [parameter_to_plain_input_paramater(parameter) for parameter in parameters] def etool_to_cltool( @@ -663,7 +412,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=plain_input_type_to_clt_input(inp.type_), + type_=plain_input_schema_to_clt_input_schema(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -678,7 +427,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=plain_output_type_to_clt_output(outp.type_), + type_=plain_output_type_to_clt_output_type(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -841,14 +590,21 @@ def generate_etool_from_expr( | list[cwl.InputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output extra_processes: None | ( - Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] + Sequence[ + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] ) = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" - inputs = yaml.comments.CommentedSeq() + inputs: list[cwl.InputParameter] = [] if not no_inputs: - if not self_type: + if self_type is None: self_type = target + assert self_type is not None new_type: InputTypeSchemas if isinstance(self_type, Sequence): new_type_list: MutableSequence[BasicInputTypeSchemas] = [] @@ -890,7 +646,7 @@ def generate_etool_from_expr( ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -899,7 +655,7 @@ def generate_etool_from_expr( streamable=target.streamable, doc=target.doc, format=target.format[0] if target.format else None, - type_=plain_input_type_to_plain_output(target.type_), + type_=plain_input_schema_to_plain_output_schema(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -983,23 +739,35 @@ def replace_expr_with_etool( source: str | list[Any] | None, replace_etool: bool = False, extra_process: None | ( - cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator ) = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] = [ - workflow - ] + extra_processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[cwl.WorkflowStep | cwl.Workflow | cwl.CommandLineTool] = [ - workflow - ] + processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -1050,7 +818,11 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( process_or_step: ( - cwl.CommandLineTool | cwl.WorkflowStep | cwl.ExpressionTool | cwl.Workflow + cwl.CommandLineTool + | cwl.WorkflowStep + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator ), parent: cwl.Workflow | None = None, ) -> dict[str, Any]: @@ -1526,6 +1298,7 @@ def process_level_reqs( if not process.requirements: return False modified = False + assert not isinstance(step.run, str) target_process = step.run inputs = empty_inputs(process) generated_res_reqs: list[tuple[str, str]] = [] @@ -1535,6 +1308,7 @@ def process_level_reqs( return False step_name = step.id.split("#", 1)[-1] for req_index, req in enumerate(process.requirements): + assert target_process.requirements is not None match req: case cwl.EnvVarRequirement() if req.envDef: for env_index, envDef in enumerate(req.envDef): @@ -1555,11 +1329,12 @@ def process_level_reqs( replace_etool, process, ) - new_requirements = list(target_process.requirements) - new_requirements[req_index][ + cast( + cwl.EnvVarRequirement, + target_process.requirements[req_index], + ).envDef[ env_index ].envValue = f"$(inputs._envDef{env_index})" - target_process.requirements = new_requirements generated_envVar_reqs.append((etool_id, env_index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -1572,7 +1347,7 @@ def process_level_reqs( etool_id = "_expression_{}_ResourceRequirement_{}".format( step_name, attr ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( expression, etool_id, parent, @@ -1610,15 +1385,18 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing = ( - "$(inputs._iwdr_listing)", - ) - step.in_.append( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = ("$(inputs._iwdr_listing)",) + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source=f"{etool_id}/result", ) ) + step.in_ = new_step_ins add_input_to_process( target_process, "_iwdr_listing", @@ -1651,9 +1429,19 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ] = f"$(inputs._iwdr_listing_{listing_index}" + new_iwdr_listing = list( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing + ) + new_iwdr_listing[listing_index] = ( + f"$(inputs._iwdr_listing_{listing_index}" + ) + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = new_iwdr_listing generated_iwdr_reqs.append( (etool_id, listing_index, target_type) ) @@ -1698,7 +1486,7 @@ def process_level_reqs( step_name, listing_index ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( new_expression, etool_id, parent, @@ -1706,9 +1494,13 @@ def process_level_reqs( step, replace_etool, ) - target_process.requirements[req_index].listing[ - listing_index - ].entry = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entry = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( @@ -1736,26 +1528,40 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ].entryname = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entryname = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, "string") ) - for entry in generated_envVar_reqs: - name = f"_envDef{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + new_step_ins = list(step.in_) + for env_entry in generated_envVar_reqs: + name = f"_envDef{env_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{env_entry[0]}/result") + ) add_input_to_process(target_process, name, "string", process.loadingOptions) - for entry in generated_res_reqs: - name = f"_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + for res_entry in generated_res_reqs: + name = f"_{res_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{res_entry[0]}/result") + ) add_input_to_process(target_process, name, "long", process.loadingOptions) - for entry in generated_iwdr_reqs: - name = f"_iwdr_listing_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) - add_input_to_process(target_process, name, entry[2], process.loadingOptions) + for iwdr_entry in generated_iwdr_reqs: + name = f"_iwdr_listing_{iwdr_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{iwdr_entry[0]}/result") + ) + add_input_to_process( + target_process, name, iwdr_entry[2], process.loadingOptions + ) + step.in_ = new_step_ins return modified @@ -1764,13 +1570,15 @@ def add_input_to_process( ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): - process.inputs.append( + new_process_inputs = list(process.inputs) + new_process_inputs.append( cwl.CommandInputParameter( id=name, type_=inptype, loadingOptions=loadingOptions, ) ) + process.inputs = new_process_inputs def traverse_CommandLineTool( @@ -1802,20 +1610,24 @@ def traverse_CommandLineTool( replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index] = cwl.CommandLineBinding( + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( valueFrom=f"$(inputs.{inp_id})" ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( - cwl.WorkflowStepInput( - f"{etool_id}/result", None, inp_id, None, None - ) + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( + cwl.WorkflowStepInput(id=f"{etool_id}/result", source=inp_id) ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) elif isinstance(arg, cwl.CommandLineBinding) and arg.valueFrom: expression = get_expression(arg.valueFrom, inputs, None) @@ -1828,18 +1640,24 @@ def traverse_CommandLineTool( replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index].valueFrom = "$(inputs.{})".format( - inp_id + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( + valueFrom="$(inputs.{})".format(inp_id) ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) for streamtype in "stdout", "stderr": # add 'stdin' for v1.1 version stream_value = getattr(clt, streamtype) @@ -1855,12 +1673,16 @@ def traverse_CommandLineTool( expression, etool_id, parent, target, step, replace_etool ) setattr(target_clt, streamtype, f"$(inputs.{inp_id})") - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter(id=inp_id, type_=target_type) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for inp in clt.inputs: if not skip_command_line1 and inp.inputBinding and inp.inputBinding.valueFrom: expression = get_expression( @@ -1875,12 +1697,19 @@ def traverse_CommandLineTool( expression, etool_id, parent, inp, step, replace_etool, self_id ) inp.inputBinding.valueFrom = f"$(inputs.{inp_id})" - target_clt.inputs.append( - cwl.CommandInputParameter(id=inp_id, type_=inp.type_) + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( + cwl.CommandInputParameter( + id=inp_id, + type_=plain_input_schema_to_clt_input_schema(inp.type_), + ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for outp in clt.outputs: if outp.outputBinding: if outp.outputBinding.glob: @@ -1889,21 +1718,28 @@ def traverse_CommandLineTool( modified = True inp_id = "_{}_glob".format(outp.id.split("#")[-1]) etool_id = f"_expression_{step_id}{inp_id}" - glob_target_type = ["string", cwl.ArraySchema("string", "array")] + glob_target_type: CommandInputTypeSchemas = [ + "string", + cwl.CommandInputArraySchema("string", "array"), + ] target = cwl.InputParameter(id="", type_=glob_target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) outp.outputBinding.glob = f"$(inputs.{inp_id})" - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=glob_target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins if outp.outputBinding.outputEval and not skip_command_line2: self: CWLOutputType = [ { @@ -1930,31 +1766,42 @@ def traverse_CommandLineTool( id="", type_=cwl.InputArraySchema("File", "array", None, None), ) + if isinstance(outp, cwl.CommandOutputParameter): + target = parameter_to_plain_input_paramater(outp) + else: + target = outp etool = generate_etool_from_expr( - expression, outp, False, self_type, [clt, step, parent] + expression, target, False, self_type, [clt, step, parent] ) if outp.outputBinding.loadContents: - etool.inputs[0].type_.inputBinding = cwl.CommandLineBinding( + etool.inputs[0].inputBinding = cwl.CommandLineBinding( loadContents=True ) - etool.inputs.extend(cltool_inputs_to_etool_inputs(clt)) - sub_wf_inputs = cltool_inputs_to_etool_inputs(clt) + etool.inputs = list(etool.inputs) + process_inputs_to_etool_inputs( + clt + ) + sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - orig_step_input.id = orig_step_input.id.split("/")[-1] - if isinstance(orig_step_input.source, MutableSequence): + if isinstance(orig_step_input.source, Sequence): + new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): - orig_step_input.source[index] = source.split("#")[-1] + new_orig_step_input_source[index] = source.split("#")[ + -1 + ] + orig_step_input.source = new_orig_step_input_source + elif orig_step_input.source is None: + continue else: orig_step_input.source = orig_step_input.source.split("#")[ -1 ] - orig_step_inputs[:] = [ + orig_step_inputs = [ x for x in orig_step_inputs if not x.id.startswith("_") ] - for inp in orig_step_inputs: - inp.source = inp.id - inp.linkMerge = None + for wsi in orig_step_inputs: + wsi.source = wsi.id + wsi.linkMerge = None if replace_etool: processes = [parent] final_etool: cwl.CommandLineTool | cwl.ExpressionTool = ( @@ -1973,8 +1820,8 @@ def traverse_CommandLineTool( step ) # a deepcopy would be convenient, but params2.cwl gives it problems new_clt_step.id = new_clt_step.id.split("#")[-1] - new_clt_step.run = copy.copy(step.run) - new_clt_step.run.id = None + new_clt_step.run = copy.copy(target_clt) + new_clt_step.run.id = "" remove_JSReq(new_clt_step.run, skip_command_line1) for new_outp in new_clt_step.run.outputs: if new_outp.id.split("#")[-1] == outp_id: @@ -2002,13 +1849,17 @@ def traverse_CommandLineTool( type(new_outp), ) new_clt_step.in_ = copy.deepcopy(step.in_) - for inp in new_clt_step.in_: - inp.id = inp.id.split("/")[-1] - inp.source = inp.id - inp.linkMerge = None - for index, out in enumerate(new_clt_step.out): - new_clt_step.out[index] = out.split("/")[-1] - + for wsi2 in new_clt_step.in_: + wsi2.id = wsi2.id.split("/")[-1] + wsi2.source = wsi2.id + wsi2.linkMerge = None + new_clt_step_out = list(new_clt_step.out) + for index, out in enumerate(new_clt_step_out): + if isinstance(out, str): + new_clt_step_out[index] = out.split("/")[-1] + else: + out.id = out.id.split("/")[-1] + new_clt_step.out = new_clt_step_out for tool_inp in new_clt_step.run.inputs: tool_inp.id = tool_inp.id.split("#")[-1] for tool_out in new_clt_step.run.outputs: @@ -2039,24 +1890,33 @@ def traverse_CommandLineTool( if isinstance(req, cwl.SubworkflowFeatureRequirement): has_sub_wf_req = True if not has_sub_wf_req: - parent.requirements.append( - cwl.SubworkflowFeatureRequirement() - ) + new_parent_reqs = list(parent.requirements) + new_parent_reqs.append(cwl.SubworkflowFeatureRequirement()) + parent.requirements = new_parent_reqs return modified def rename_step_source(workflow: cwl.Workflow, old: str, new: str) -> None: """Update step source names to the new name.""" - def simplify_wf_id(uri: str) -> str: - return uri.split("#")[-1].split("/", 1)[1] + def simplify_wf_ids(uris: Sequence[str] | str | None) -> set[str]: + if isinstance(uris, str): + uri_seq: Sequence[str] = [uris] + elif uris is None: + return set() + else: + uri_seq = uris + return {uri.split("#")[-1].split("/", 1)[1] for uri in uri_seq} def simplify_step_id(uri: str) -> str: return uri.split("#")[-1] for wf_outp in workflow.outputs: - if wf_outp.outputSource and simplify_wf_id(wf_outp.outputSource) == old: - wf_outp.outputSource = new + simplified_wf_ids = simplify_wf_ids(wf_outp.outputSource) + if wf_outp.outputSource and old in simplified_wf_ids: + simplified_wf_ids.remove(old) + simplified_wf_ids.add(new) + wf_outp.outputSource = list(simplified_wf_ids) for step in workflow.steps: if step.in_: for inp in step.in_: @@ -2072,7 +1932,9 @@ def simplify_step_id(uri: str) -> str: else: for index, source in enumerate(inp.source): if simplify_step_id(source) == old: - inp.source[index] = new + new_inp_source = list(inp.source) + new_inp_source[index] = new + inp.source = new_inp_source def remove_JSReq( @@ -2083,7 +1945,7 @@ def remove_JSReq( if skip_command_line1 and isinstance(process, cwl.CommandLineTool): return if process.hints: - process.hints[:] = [ + process.hints = [ hint for hint in process.hints if not isinstance(hint, cwl.InlineJavascriptRequirement) @@ -2091,7 +1953,7 @@ def remove_JSReq( if not process.hints: process.hints = None if process.requirements: - process.requirements[:] = [ + process.requirements = [ req for req in process.requirements if not isinstance(req, cwl.InlineJavascriptRequirement) @@ -2110,7 +1972,8 @@ def replace_step_clt_expr_with_etool( self_name: str | None = None, ) -> None: """Convert a step level CWL Expression to a sibling expression step.""" - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -2124,8 +1987,9 @@ def replace_step_clt_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -2133,9 +1997,10 @@ def replace_step_clt_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps -def replace_clt_hintreq_expr_with_etool( +def replace_step_process_hintreq_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, @@ -2146,7 +2011,8 @@ def replace_clt_hintreq_expr_with_etool( ) -> cwl.CommandLineTool | cwl.ExpressionTool: """Factor out an expression inside a CommandLineTool req or hint into a sibling step.""" # Same as replace_step_clt_expr_with_etool or different? - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -2160,8 +2026,9 @@ def replace_clt_hintreq_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -2169,30 +2036,33 @@ def replace_clt_hintreq_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps return etool -def cltool_inputs_to_etool_inputs( - tool: cwl.CommandLineTool, +def process_inputs_to_etool_inputs( + tool: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), ) -> list[cwl.InputParameter]: - """Copy CommandLineTool input objects into the equivalent ExpressionTool input objects.""" - inputs = yaml.comments.CommentedSeq() + """Copy Process input parameters to matching ExpressionTool versions.""" + inputs = [] if tool.inputs: - for clt_inp in tool.inputs: - clt_inp_id = clt_inp.id.split("#")[-1].split("/")[-1] - if not clt_inp_id.startswith("_"): + for process_inp in tool.inputs: + process_inp_id = process_inp.id.split("#")[-1].split("/")[-1] + if not process_inp_id.startswith("_"): inputs.append( cwl.InputParameter( - id=clt_inp_id, - label=clt_inp.label, - secondaryFiles=clt_inp.secondaryFiles, - streamable=clt_inp.streamable, - doc=clt_inp.doc, - format=clt_inp.format, - default=clt_inp.default, - type_=clt_inp.type_, - extension_fields=clt_inp.extension_fields, - loadingOptions=clt_inp.loadingOptions, + id=process_inp_id, + label=process_inp.label, + secondaryFiles=process_inp.secondaryFiles, + streamable=process_inp.streamable, + doc=process_inp.doc, + format=process_inp.format, + default=process_inp.default, + type_=process_inp.type_, + extension_fields=process_inp.extension_fields, + loadingOptions=process_inp.loadingOptions, ) ) return inputs @@ -2207,10 +2077,11 @@ def cltool_step_outputs_to_workflow_outputs( Connects the outputSources for each of the new output parameters to the step they came from. """ - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.WorkflowOutputParameter] = [] if not cltool_step.id: raise WorkflowException(f"Missing step id from {cltool_step}.") default_step_id = cltool_step.id.split("#")[-1] + assert not isinstance(cltool_step.run, str) if cltool_step.run.outputs: for clt_out in cltool_step.run.outputs: clt_out_id = clt_out.id.split("#")[-1].split("/")[-1] @@ -2264,7 +2135,7 @@ def generate_etool_from_expr2( streamable=target.streamable, doc=target.doc, format=target.format[0] if target.format else None, - type_=plain_input_type_to_plain_output(target.type_), + type_=plain_input_schema_to_plain_output_schema(target.type_), ) ) expression = "${" @@ -2468,34 +2339,34 @@ def traverse_step( def workflow_step_to_InputParameters( step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str -) -> list[cwl.InputParameter | cwl.CommandOutputParameter]: - """Create InputParameters to match the given WorkflowStep inputs.""" +) -> list[cwl.InputParameter]: + """Create ExpressionTool InputParameters to match the given WorkflowStep inputs.""" params = [] for inp in step_ins: - if not inp.id: - continue inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, MutableSequence): + if isinstance(param, Sequence): for p in param: if not p.type_: raise WorkflowException( f"Don't know how to get type id for {p!r}." ) - p.id = inp_id - p.type_ = clean_type_ids(p.type_) - params.append(p) + new_param = parameter_to_plain_input_paramater(p) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) else: if not param.type_: raise WorkflowException( f"Don't know how to get type id for {param!r}." ) - param.id = inp_id - param.type_ = clean_type_ids(param.type_) - params.append(param) + new_param = parameter_to_plain_input_paramater(param) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) return params diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index dd00335d..de0affad 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import Any, IO, cast +from typing import IO, Any, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 777417ef..677108b5 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -281,8 +281,8 @@ def check_all_types( if "null" not in src_typ: src_typ = ["null"] + cast(list[Any], src_typ) if ( - not isinstance(snk_typ, MutableSequence) - or "null" not in snk_typ + not isinstance(snk_typ, MutableSequence) + or "null" not in snk_typ ): validation["warning"].append( SrcSink( @@ -308,8 +308,8 @@ def check_all_types( for parm_id in sourceField: srcs_of_sink += [src_dict[parm_id]] if ( - _is_conditional_step(param_to_step, parm_id) - and sink.pickValue is not None + _is_conditional_step(param_to_step, parm_id) + and sink.pickValue is not None ): validation["warning"].append( SrcSink( From df9f82c3873040ed073b959b70c5fbf1af30eee4 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 20 Dec 2025 15:28:55 +0100 Subject: [PATCH 07/23] finish type fixing cwl_v1_1_expression_refactor --- src/cwl_utils/cwl_v1_0_expression_refactor.py | 2 +- src/cwl_utils/cwl_v1_1_expression_refactor.py | 1133 ++++++++++++----- src/cwl_utils/parser/cwl_v1_1_utils.py | 12 +- 3 files changed, 798 insertions(+), 349 deletions(-) diff --git a/src/cwl_utils/cwl_v1_0_expression_refactor.py b/src/cwl_utils/cwl_v1_0_expression_refactor.py index 2d84bc5d..81692534 100755 --- a/src/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_0_expression_refactor.py @@ -2386,7 +2386,7 @@ def replace_step_valueFrom_expr_with_etool( source_type: ( cwl.InputParameter | cwl.CommandOutputParameter - | MutableSequence[cwl.InputParameter | cwl.CommandOutputParameter] + | Sequence[cwl.InputParameter | cwl.CommandOutputParameter] | None ) = None, ) -> None: diff --git a/src/cwl_utils/cwl_v1_1_expression_refactor.py b/src/cwl_utils/cwl_v1_1_expression_refactor.py index 453e4124..40b19923 100755 --- a/src/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_1_expression_refactor.py @@ -8,7 +8,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, cast +from typing import Any, Literal, TypeAlias, TypeVar, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -45,7 +45,7 @@ def expand_stream_shortcuts(process: cwl.CommandLineTool) -> cwl.CommandLineTool ).hexdigest() result.stdout = stdout_path result.outputs[index].type_ = "File" - output.outputBinding = cwl.CommandOutputBinding(stdout_path, None, None) + output.outputBinding = cwl.CommandOutputBinding(glob=stdout_path) if result: return result return process @@ -56,33 +56,153 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -def clean_type_ids( - cwltype: cwl.ArraySchema | cwl.InputRecordSchema, -) -> cwl.ArraySchema | cwl.InputRecordSchema: - """Simplify type identifiers.""" - result = copy.deepcopy(cwltype) - if isinstance(result, cwl.ArraySchema): - if isinstance(result.items, MutableSequence): - for item in result.items: +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype.items, Sequence): + for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(result.items, cwl.InputRecordSchema): - if result.items.name: - result.items.name = result.items.name.split("/")[-1] - if result.items.fields: - for field in result.items.fields: + elif isinstance(cwltype.items, cwl.RecordSchema): + if ( + isinstance( + cwltype.items, + (cwl.InputRecordSchema, cwl.CommandOutputRecordSchema), + ) + and cwltype.items.name + ): + cwltype.items.name = cwltype.items.name.split("/")[-1] + if cwltype.items.fields: + for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(result, cwl.InputRecordSchema): - if result.name: - result.name = result.name.split("/")[-1] - if result.fields: - for field in result.fields: + elif isinstance(cwltype, cwl.RecordSchema): + if cwltype.name: + cwltype.name = cwltype.name.split("/")[-1] + if cwltype.fields: + for field in cwltype.fields: field.name = field.name.split("/")[-1] + + +def clean_type_ids( + cwltype: AnyTypeSchema, +) -> AnyTypeSchema: + """Simplify type identifiers.""" + result = copy.deepcopy(cwltype) + if isinstance(result, Sequence): + for item in result: + _clean_type_ids(item) + else: + _clean_type_ids(result) return result +def _has_expression(string: str) -> bool: + if "${" in string: + return True + if "$(" in string: + return True + return False + + +def has_expression(field: str | Sequence[str]) -> bool: + if isinstance(field, Sequence): + for entry in field: + if _has_expression(entry): + return True + return False + return _has_expression(field) + + def get_expression( - string: str, inputs: CWLObjectType, self: CWLOutputType | None + string: Any, inputs: CWLObjectType, self: CWLOutputType | None ) -> str | None: """ Find and return a normalized CWL expression, if any. @@ -137,6 +257,146 @@ def get_expression( return None +def _plain_input_schema_to_clt_input_schema( + input_type: BasicInputTypeSchemas, +) -> BasicCommandInputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.CommandInputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.CommandInputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.CommandInputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_clt_input_schema( + input_type: InputTypeSchemas, +) -> CommandInputTypeSchemas: + if isinstance(input_type, Sequence): + return [ + _plain_input_schema_to_clt_input_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_input_schema_to_clt_input_schema(input_type) + + +def _plain_input_schema_to_plain_output_schema( + input_type: BasicInputTypeSchemas, +) -> BasicOutputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.OutputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_plain_output_schema( + input_type: InputTypeSchemas, +) -> OutputTypeSchemas: + if isinstance(input_type, Sequence): + return [ + _plain_input_schema_to_plain_output_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_input_schema_to_plain_output_schema(input_type) + + +def _plain_output_type_to_clt_output_type( + output_type: BasicOutputTypeSchemas, +) -> BasicCommandOutputTypeSchemas: + match output_type: + case cwl.OutputArraySchema(): + return cwl.CommandOutputArraySchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputEnumSchema(): + return cwl.CommandOutputEnumSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputRecordSchema(): + return cwl.CommandOutputRecordSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case str(): + return output_type + raise WorkflowException(f"Unexpected ExpressionTool output type: {output_type}.") + + +def plain_output_type_to_clt_output_type( + output_type: OutputTypeSchemas, +) -> CommandOutputTypeSchemas: + if isinstance(output_type, Sequence): + return [ + _plain_output_type_to_clt_output_type(output_type_item) + for output_type_item in output_type + ] + return _plain_output_type_to_clt_output_type(output_type) + + +def parameter_to_workflow_input_paramater( + parameter: ( + cwl.WorkflowInputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.WorkflowOutputParameter + ), +) -> cwl.WorkflowInputParameter: + return cwl.WorkflowInputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) + + +def parameters_to_workflow_input_paramaters( + parameters: Sequence[ + cwl.WorkflowInputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + ], +) -> Sequence[cwl.WorkflowInputParameter]: + return [ + parameter_to_workflow_input_paramater(parameter) for parameter in parameters + ] + + def etool_to_cltool( etool: cwl.ExpressionTool, expressionLib: list[str] | None = None ) -> cwl.CommandLineTool: @@ -152,7 +412,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=inp.type_, + type_=plain_input_schema_to_clt_input_schema(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -167,7 +427,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=outp.type_, + type_=plain_output_type_to_clt_output_type(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -330,20 +590,33 @@ def generate_etool_from_expr( | list[cwl.WorkflowInputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output extra_processes: None | ( - Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] + Sequence[ + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] ) = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" - inputs = yaml.comments.CommentedSeq() + inputs: list[cwl.WorkflowInputParameter] = [] if not no_inputs: - if not self_type: + if self_type is None: self_type = target - if isinstance(self_type, list): - new_type: ( - list[cwl.ArraySchema | cwl.InputRecordSchema] - | cwl.ArraySchema - | cwl.InputRecordSchema - ) = [clean_type_ids(t.type_) for t in self_type] + assert self_type is not None + new_type: InputTypeSchemas + if isinstance(self_type, Sequence): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if isinstance(clean_type, Sequence): + new_type_list.extend(clean_type) + elif clean_type is None: + pass + else: + new_type_list.append(clean_type) + new_type = new_type_list else: new_type = clean_type_ids(self_type.type_) inputs.append( @@ -373,7 +646,7 @@ def generate_etool_from_expr( ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -381,8 +654,8 @@ def generate_etool_from_expr( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -411,18 +684,24 @@ def generate_etool_from_expr( def get_input_for_id( - name: str, tool: cwl.CommandLineTool | cwl.Workflow + name: str, + tool: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ProcessGenerator | cwl.ExpressionTool + ), ) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] for inp in cast(list[cwl.CommandInputParameter], tool.inputs): if inp.id and inp.id.split("#")[-1].split("/")[-1] == name: - return inp + return cwl.CommandInputParameter.fromDoc( + inp.save(), inp.loadingOptions.baseuri, inp.loadingOptions + ) if isinstance(tool, cwl.Workflow) and "/" in name: stepname, stem = name.split("/", 1) for step in tool.steps: if step.id == stepname: + assert not isinstance(step.run, str) result = get_input_for_id(stem, step.run) if result: return result @@ -431,7 +710,11 @@ def get_input_for_id( def find_expressionLib( processes: Sequence[ - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.Workflow + | cwl.ExpressionTool + | cwl.WorkflowStep + | cwl.ProcessGenerator ], ) -> list[str] | None: """ @@ -456,23 +739,35 @@ def replace_expr_with_etool( source: str | list[Any] | None, replace_etool: bool = False, extra_process: None | ( - cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator ) = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] = [ - workflow - ] + extra_processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[cwl.WorkflowStep | cwl.Workflow | cwl.CommandLineTool] = [ - workflow - ] + processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + ] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -483,14 +778,16 @@ def replace_expr_with_etool( inps = [] if source: inps.append(cwl.WorkflowStepInput(id="self", source=source)) - workflow.steps.append( + new_steps: list[cwl.WorkflowStep] = [ cwl.WorkflowStep( id=name, in_=inps, out=[cwl.WorkflowStepOutput("result")], run=final_tool, ) - ) + ] + new_steps.extend(workflow.steps) + workflow.steps = new_steps def replace_wf_input_ref_with_step_output( @@ -521,26 +818,33 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( process_or_step: ( - cwl.CommandLineTool | cwl.WorkflowStep | cwl.ExpressionTool | cwl.Workflow + cwl.CommandLineTool + | cwl.WorkflowStep + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator ), parent: cwl.Workflow | None = None, ) -> dict[str, Any]: """Produce a mock input object for the given inputs.""" result = {} if isinstance(process_or_step, cwl.Process): - for param in process_or_step.inputs: - result[param.id.split("#")[-1]] = example_input(param.type_) + for param1 in process_or_step.inputs: + result[param1.id.split("#")[-1]] = example_input(param1.type_) else: - for param in process_or_step.in_: - param_id = param.id.split("/")[-1] - if param.source is None and param.valueFrom: - result[param_id] = example_input("string") - elif param.source is None and param.default: - result[param_id] = param.default - else: + for param2 in process_or_step.in_: + param2_id = param2.id.split("/")[-1] + if param2.source is None and param2.valueFrom: + result[param2_id] = example_input("string") + elif param2.source is None and param2.default: + result[param2_id] = param2.default + elif param2.source is not None: with suppress(WorkflowException): - result[param_id] = example_input( - utils.type_for_source(process_or_step.run, param.source, parent) + assert not isinstance(process_or_step.run, str) + result[param2_id] = example_input( + utils.type_for_source( + process_or_step.run, param2.source, parent + ) ) return result @@ -617,18 +921,17 @@ def process_workflow_inputs_and_outputs( ) -> bool: """Do any needed conversions on the given Workflow's inputs and outputs.""" modified = False - inputs = empty_inputs(workflow) for index, param in enumerate(workflow.inputs): with SourceLine(workflow.inputs, index, WorkflowException): - if param.format and get_expression(param.format, inputs, None): + if param.format is not None and has_expression(param.format): raise SourceLine( param.loadingOptions.original_doc, "format", raise_type=WorkflowException, ).makeError(TOPLEVEL_FORMAT_EXPR_ERROR.format(param.id.split("#")[-1])) if param.secondaryFiles: - if hasattr(param.secondaryFiles, "pattern") and get_expression( - param.secondaryFiles.pattern, inputs, EMPTY_FILE + if hasattr(param.secondaryFiles, "pattern") and has_expression( + param.secondaryFiles.pattern ): raise SourceLine( param.loadingOptions.original_doc, @@ -637,7 +940,7 @@ def process_workflow_inputs_and_outputs( ).makeError(TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1])) elif isinstance(param.secondaryFiles, MutableSequence): for index2, entry in enumerate(param.secondaryFiles): - if get_expression(entry.pattern, inputs, EMPTY_FILE): + if has_expression(entry.pattern): raise SourceLine( param.loadingOptions.original_doc, index2, @@ -646,6 +949,7 @@ def process_workflow_inputs_and_outputs( f"Entry {index}," + TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1]) ) + return modified @@ -690,7 +994,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -711,7 +1015,9 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.EnvVarRequirement,) newEnvDef = copy.deepcopy(envDef) newEnvDef.envValue = f"$(inputs._envDef{index})" - envVarReq.envDef[index] = newEnvDef + new_envDef = list(envVarReq.envDef) + new_envDef[index] = newEnvDef + envVarReq.envDef = new_envDef generated_envVar_reqs.append((etool_id, index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -720,9 +1026,7 @@ def process_workflow_reqs_and_hints( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter( - id=None, type_="long" - ) + target = cwl.WorkflowInputParameter(id="", type_="long") etool_id = "_expression_workflow_ResourceRequirement_{}".format( attr ) @@ -747,7 +1051,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), @@ -768,18 +1072,18 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.InitialWorkDirRequirement,) else: iwdr = copy.deepcopy(req) - for index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for index1, entry1 in enumerate(req.listing): + expression = get_expression(entry1, inputs, None) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expression, @@ -789,17 +1093,19 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = f"$(inputs._iwdr_listing_{index}" - generated_iwdr_reqs.append((etool_id, index)) - elif isinstance(entry, cwl.Dirent): - if entry.entry: + new_listing = list(iwdr.listing) + new_listing[index1] = f"$(inputs._iwdr_listing_{index1}" + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) + elif isinstance(entry1, cwl.Dirent): + if entry1.entry: expression = get_expression( - entry.entry, inputs, None + entry1.entry, inputs, None ) if expression: expr: str = expression expr_result = do_eval( - ex=entry.entry, + ex=entry1.entry, jobinput=inputs, requirements=[], outdir="", @@ -809,7 +1115,7 @@ def process_workflow_reqs_and_hints( modified = True if is_file_or_directory(expr_result): target = cwl.WorkflowInputParameter( - id=None, + id="", type_=expr_result["class"], ) replace_expr_with_etool( @@ -820,38 +1126,38 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - "$(inputs._iwdr_listing_{}".format( - index - ) + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) + iwdr.listing = new_listing generated_iwdr_reqs.append( - (etool_id, index) + (etool_id, index1) ) elif isinstance(expr_result, str): target = cwl.WorkflowInputParameter( - id=None, + id="", type_=["File"], ) - if entry.entryname is None: + if entry1.entryname is None: raise SourceLine( - entry.loadingOptions.original_doc, - index, + entry1.loadingOptions.original_doc, + index1, raise_type=WorkflowException, ).makeError( - f"Entry {index}," + f"Entry {index1}," + "Invalid CWL, if 'entry' " "is a string, then entryName must be specified." ) expr = ( '${return {"class": "File", "basename": "' - + entry.entryname + + entry1.entryname + '", "contents": (function(){' + expr[2:-1] + "})() }; }" ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expr, @@ -861,24 +1167,24 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) - elif entry.entryname: + elif entry1.entryname: expression = get_expression( - entry.entryname, inputs, None + entry1.entryname, inputs, None ) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) - etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index - ) + etool_id = f"_expression_workflow_InitialWorkDirRequirement_{index1}" replace_expr_with_etool( expression, etool_id, @@ -887,10 +1193,12 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) if generated_iwdr_reqs: prop_reqs += (cwl.InitialWorkDirRequirement,) else: @@ -905,14 +1213,18 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(envVarReq) - for entry in generated_envVar_reqs: - step.in_.append( + new_requirements = list(step.requirements) + new_requirements.append(envVarReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry2 in generated_envVar_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_envDef{entry[1]}", - source=f"{entry[0]}/result", + id=f"_envDef{entry2[1]}", + source=f"{entry2[0]}/result", ) ) + step.in_ = new_ins if resourceReq and workflow.steps: for step in workflow.steps: @@ -923,15 +1235,19 @@ def process_workflow_reqs_and_hints( if isinstance(req, cwl.ResourceRequirement): continue else: - step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(resourceReq) - for entry in generated_res_reqs: - step.in_.append( + step.requirements = [] + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry3 in generated_res_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_{entry[1]}", - source=f"{entry[0]}/result", + id=f"_{entry3[1]}", + source=f"{entry3[0]}/result", ) ) + step.in_ = new_ins if iwdr and workflow.steps: for step in workflow.steps: @@ -943,32 +1259,39 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(iwdr) + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + new_requirements.append(iwdr) + step.requirements = new_requirements + new_ins = list(step.in_) if generated_iwdr_reqs: - for entry in generated_iwdr_reqs: - step.in_.append( + for entry4 in generated_iwdr_reqs: + new_ins.append( cwl.WorkflowStepInput( id=f"_iwdr_listing_{index}", - source=f"{entry[0]}/result", + source=f"{entry4[0]}/result", ) ) else: - step.in_.append( + new_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source="_expression_workflow_InitialWorkDirRequirement/result", ) ) + step.in_ = new_ins if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance(x, prop_reqs) ] return modified def process_level_reqs( - process: cwl.CommandLineTool, + process: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -988,6 +1311,7 @@ def process_level_reqs( if not process.requirements: return False modified = False + assert not isinstance(step.run, str) target_process = step.run inputs = empty_inputs(process) generated_res_reqs: list[tuple[str, str]] = [] @@ -997,6 +1321,7 @@ def process_level_reqs( return False step_name = step.id.split("#", 1)[-1] for req_index, req in enumerate(process.requirements): + assert target_process.requirements is not None match req: case cwl.EnvVarRequirement() if req.envDef: for env_index, envDef in enumerate(req.envDef): @@ -1004,7 +1329,7 @@ def process_level_reqs( expression = get_expression(envDef.envValue, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter(id=None, type_="string") + target = cwl.WorkflowInputParameter(id="", type_="string") etool_id = "_expression_{}_EnvVarRequirement_{}".format( step_name, env_index ) @@ -1017,7 +1342,10 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index][ + cast( + cwl.EnvVarRequirement, + target_process.requirements[req_index], + ).envDef[ env_index ].envValue = f"$(inputs._envDef{env_index})" generated_envVar_reqs.append((etool_id, env_index)) @@ -1028,11 +1356,11 @@ def process_level_reqs( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter(id=None, type_="long") + target = cwl.WorkflowInputParameter(id="", type_="long") etool_id = "_expression_{}_ResourceRequirement_{}".format( step_name, attr ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( expression, etool_id, parent, @@ -1057,7 +1385,7 @@ def process_level_reqs( target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) etool_id = "_expression_{}_InitialWorkDirRequirement".format( step_name ) @@ -1070,15 +1398,18 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing = ( - "$(inputs._iwdr_listing)", - ) - step.in_.append( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = ("$(inputs._iwdr_listing)",) + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source=f"{etool_id}/result", ) ) + step.in_ = new_step_ins add_input_to_process( target_process, "_iwdr_listing", @@ -1086,15 +1417,15 @@ def process_level_reqs( process.loadingOptions, ) else: - for listing_index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for listing_index, entry5 in enumerate(req.listing): + expression = get_expression(entry5, inputs, None) if expression: modified = True target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) target = cwl.WorkflowInputParameter( - id=None, + id="", type_=target_type, ) etool_id = ( @@ -1111,31 +1442,41 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ] = f"$(inputs._iwdr_listing_{listing_index}" + new_iwdr_listing = list( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing + ) + new_iwdr_listing[listing_index] = ( + f"$(inputs._iwdr_listing_{listing_index}" + ) + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = new_iwdr_listing generated_iwdr_reqs.append( (etool_id, listing_index, target_type) ) - elif isinstance(entry, cwl.Dirent): - if entry.entry: - expression = get_expression(entry.entry, inputs, None) + elif isinstance(entry5, cwl.Dirent): + if entry5.entry: + expression = get_expression(entry5.entry, inputs, None) if expression: modified = True - if entry.entryname is not None: + if entry5.entryname is not None: entryname_expr = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) entryname = ( - entry.entryname + entry5.entryname if entryname_expr - else f'"{entry.entryname}"' # noqa: B907 + else f'"{entry5.entryname}"' # noqa: B907 ) new_expression = ( "${var result; var entryname = " + entryname + "; var entry = " - + entry.entry[2:-1] + + entry5.entry[2:-1] + """; if (typeof entry === 'string' || entry instanceof String) { result = {"class": "File", "basename": entryname, "contents": entry} ; @@ -1151,14 +1492,14 @@ def process_level_reqs( new_expression = expression d_target_type = ["File", "Directory"] target = cwl.WorkflowInputParameter( - id=None, + id="", type_=d_target_type, ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( step_name, listing_index ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( new_expression, etool_id, parent, @@ -1166,22 +1507,26 @@ def process_level_reqs( step, replace_etool, ) - target_process.requirements[req_index].listing[ - listing_index - ].entry = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entry = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, d_target_type) ) - elif entry.entryname: + elif entry5.entryname: expression = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( @@ -1196,26 +1541,40 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ].entryname = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entryname = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, "string") ) - for entry in generated_envVar_reqs: - name = f"_envDef{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + new_step_ins = list(step.in_) + for env_entry in generated_envVar_reqs: + name = f"_envDef{env_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{env_entry[0]}/result") + ) add_input_to_process(target_process, name, "string", process.loadingOptions) - for entry in generated_res_reqs: - name = f"_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + for res_entry in generated_res_reqs: + name = f"_{res_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{res_entry[0]}/result") + ) add_input_to_process(target_process, name, "long", process.loadingOptions) - for entry in generated_iwdr_reqs: - name = f"_iwdr_listing_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) - add_input_to_process(target_process, name, entry[2], process.loadingOptions) + for iwdr_entry in generated_iwdr_reqs: + name = f"_iwdr_listing_{iwdr_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{iwdr_entry[0]}/result") + ) + add_input_to_process( + target_process, name, iwdr_entry[2], process.loadingOptions + ) + step.in_ = new_step_ins return modified @@ -1224,13 +1583,15 @@ def add_input_to_process( ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): - process.inputs.append( + new_process_inputs = list(process.inputs) + new_process_inputs.append( cwl.CommandInputParameter( id=name, type_=inptype, loadingOptions=loadingOptions, ) ) + process.inputs = new_process_inputs def traverse_CommandLineTool( @@ -1258,24 +1619,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index] = cwl.CommandLineBinding( + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( valueFrom=f"$(inputs.{inp_id})" ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( - cwl.WorkflowStepInput( - f"{etool_id}/result", None, inp_id, None, None - ) + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( + cwl.WorkflowStepInput(id=f"{etool_id}/result", source=inp_id) ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) elif isinstance(arg, cwl.CommandLineBinding) and arg.valueFrom: expression = get_expression(arg.valueFrom, inputs, None) @@ -1284,22 +1649,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index].valueFrom = "$(inputs.{})".format( - inp_id + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( + valueFrom="$(inputs.{})".format(inp_id) ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) for streamtype in "stdout", "stderr": # add 'stdin' for v1.1 version stream_value = getattr(clt, streamtype) @@ -1310,17 +1681,21 @@ def traverse_CommandLineTool( inp_id = f"_{streamtype}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "string" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) setattr(target_clt, streamtype, f"$(inputs.{inp_id})") - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter(id=inp_id, type_=target_type) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for inp in clt.inputs: if not skip_command_line1 and inp.inputBinding and inp.inputBinding.valueFrom: expression = get_expression( @@ -1335,12 +1710,19 @@ def traverse_CommandLineTool( expression, etool_id, parent, inp, step, replace_etool, self_id ) inp.inputBinding.valueFrom = f"$(inputs.{inp_id})" - target_clt.inputs.append( - cwl.CommandInputParameter(id=inp_id, type_=inp.type_) + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( + cwl.CommandInputParameter( + id=inp_id, + type_=plain_input_schema_to_clt_input_schema(inp.type_), + ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for outp in clt.outputs: if outp.outputBinding: if outp.outputBinding.glob: @@ -1349,21 +1731,28 @@ def traverse_CommandLineTool( modified = True inp_id = "_{}_glob".format(outp.id.split("#")[-1]) etool_id = f"_expression_{step_id}{inp_id}" - glob_target_type = ["string", cwl.ArraySchema("string", "array")] - target = cwl.WorkflowInputParameter(id=None, type_=glob_target_type) + glob_target_type: CommandInputTypeSchemas = [ + "string", + cwl.CommandInputArraySchema("string", "array"), + ] + target = cwl.WorkflowInputParameter(id="", type_=glob_target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) outp.outputBinding.glob = f"$(inputs.{inp_id})" - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=glob_target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins if outp.outputBinding.outputEval and not skip_command_line2: self: CWLOutputType = [ { @@ -1387,34 +1776,45 @@ def traverse_CommandLineTool( step, etool_id, outp_id ) self_type = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema("File", "array", None, None), ) + if isinstance(outp, cwl.CommandOutputParameter): + target = parameter_to_workflow_input_paramater(outp) + else: + target = outp etool = generate_etool_from_expr( - expression, outp, False, self_type, [clt, step, parent] + expression, target, False, self_type, [clt, step, parent] ) if outp.outputBinding.loadContents: - etool.inputs[0].type_.inputBinding = cwl.CommandLineBinding( + etool.inputs[0].inputBinding = cwl.CommandLineBinding( loadContents=True ) - etool.inputs.extend(cltool_inputs_to_etool_inputs(clt)) - sub_wf_inputs = cltool_inputs_to_etool_inputs(clt) + etool.inputs = list(etool.inputs) + process_inputs_to_etool_inputs( + clt + ) + sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - orig_step_input.id = orig_step_input.id.split("/")[-1] - if isinstance(orig_step_input.source, MutableSequence): + if isinstance(orig_step_input.source, Sequence): + new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): - orig_step_input.source[index] = source.split("#")[-1] + new_orig_step_input_source[index] = source.split("#")[ + -1 + ] + orig_step_input.source = new_orig_step_input_source + elif orig_step_input.source is None: + continue else: orig_step_input.source = orig_step_input.source.split("#")[ -1 ] - orig_step_inputs[:] = [ + orig_step_inputs = [ x for x in orig_step_inputs if not x.id.startswith("_") ] - for inp in orig_step_inputs: - inp.source = inp.id - inp.linkMerge = None + for wsi in orig_step_inputs: + wsi.source = wsi.id + wsi.linkMerge = None if replace_etool: processes = [parent] final_etool: cwl.CommandLineTool | cwl.ExpressionTool = ( @@ -1433,8 +1833,8 @@ def traverse_CommandLineTool( step ) # a deepcopy would be convenient, but params2.cwl gives it problems new_clt_step.id = new_clt_step.id.split("#")[-1] - new_clt_step.run = copy.copy(step.run) - new_clt_step.run.id = None + new_clt_step.run = copy.copy(target_clt) + new_clt_step.run.id = "" remove_JSReq(new_clt_step.run, skip_command_line1) for new_outp in new_clt_step.run.outputs: if new_outp.id.split("#")[-1] == outp_id: @@ -1462,12 +1862,17 @@ def traverse_CommandLineTool( type(new_outp), ) new_clt_step.in_ = copy.deepcopy(step.in_) - for inp in new_clt_step.in_: - inp.id = inp.id.split("/")[-1] - inp.source = inp.id - inp.linkMerge = None - for index, out in enumerate(new_clt_step.out): - new_clt_step.out[index] = out.split("/")[-1] + for wsi2 in new_clt_step.in_: + wsi2.id = wsi2.id.split("/")[-1] + wsi2.source = wsi2.id + wsi2.linkMerge = None + new_clt_step_out = list(new_clt_step.out) + for index, out in enumerate(new_clt_step_out): + if isinstance(out, str): + new_clt_step_out[index] = out.split("/")[-1] + else: + out.id = out.id.split("/")[-1] + new_clt_step.out = new_clt_step_out for tool_inp in new_clt_step.run.inputs: tool_inp.id = tool_inp.id.split("#")[-1] for tool_out in new_clt_step.run.outputs: @@ -1498,24 +1903,33 @@ def traverse_CommandLineTool( if isinstance(req, cwl.SubworkflowFeatureRequirement): has_sub_wf_req = True if not has_sub_wf_req: - parent.requirements.append( - cwl.SubworkflowFeatureRequirement() - ) + new_parent_reqs = list(parent.requirements) + new_parent_reqs.append(cwl.SubworkflowFeatureRequirement()) + parent.requirements = new_parent_reqs return modified def rename_step_source(workflow: cwl.Workflow, old: str, new: str) -> None: """Update step source names to the new name.""" - def simplify_wf_id(uri: str) -> str: - return uri.split("#")[-1].split("/", 1)[1] + def simplify_wf_ids(uris: Sequence[str] | str | None) -> set[str]: + if isinstance(uris, str): + uri_seq: Sequence[str] = [uris] + elif uris is None: + return set() + else: + uri_seq = uris + return {uri.split("#")[-1].split("/", 1)[1] for uri in uri_seq} def simplify_step_id(uri: str) -> str: return uri.split("#")[-1] for wf_outp in workflow.outputs: - if wf_outp.outputSource and simplify_wf_id(wf_outp.outputSource) == old: - wf_outp.outputSource = new + simplified_wf_ids = simplify_wf_ids(wf_outp.outputSource) + if wf_outp.outputSource and old in simplified_wf_ids: + simplified_wf_ids.remove(old) + simplified_wf_ids.add(new) + wf_outp.outputSource = list(simplified_wf_ids) for step in workflow.steps: if step.in_: for inp in step.in_: @@ -1531,7 +1945,9 @@ def simplify_step_id(uri: str) -> str: else: for index, source in enumerate(inp.source): if simplify_step_id(source) == old: - inp.source[index] = new + new_inp_source = list(inp.source) + new_inp_source[index] = new + inp.source = new_inp_source def remove_JSReq( @@ -1542,7 +1958,7 @@ def remove_JSReq( if skip_command_line1 and isinstance(process, cwl.CommandLineTool): return if process.hints: - process.hints[:] = [ + process.hints = [ hint for hint in process.hints if not isinstance(hint, cwl.InlineJavascriptRequirement) @@ -1550,7 +1966,7 @@ def remove_JSReq( if not process.hints: process.hints = None if process.requirements: - process.requirements[:] = [ + process.requirements = [ req for req in process.requirements if not isinstance(req, cwl.InlineJavascriptRequirement) @@ -1563,13 +1979,14 @@ def replace_step_clt_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, - target: cwl.WorkflowInputParameter, + target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, replace_etool: bool, self_name: str | None = None, ) -> None: """Convert a step level CWL Expression to a sibling expression step.""" - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1583,8 +2000,9 @@ def replace_step_clt_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1592,9 +2010,10 @@ def replace_step_clt_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps -def replace_clt_hintreq_expr_with_etool( +def replace_step_process_hintreq_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, @@ -1605,7 +2024,8 @@ def replace_clt_hintreq_expr_with_etool( ) -> cwl.CommandLineTool | cwl.ExpressionTool: """Factor out an expression inside a CommandLineTool req or hint into a sibling step.""" # Same as replace_step_clt_expr_with_etool or different? - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1619,8 +2039,9 @@ def replace_clt_hintreq_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1628,30 +2049,33 @@ def replace_clt_hintreq_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps return etool -def cltool_inputs_to_etool_inputs( - tool: cwl.CommandLineTool, +def process_inputs_to_etool_inputs( + tool: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), ) -> list[cwl.WorkflowInputParameter]: - """Copy CommandLineTool input objects into the equivalent ExpressionTool input objects.""" - inputs = yaml.comments.CommentedSeq() + """Copy Process input parameters to matching ExpressionTool versions.""" + inputs = [] if tool.inputs: - for clt_inp in tool.inputs: - clt_inp_id = clt_inp.id.split("#")[-1].split("/")[-1] - if not clt_inp_id.startswith("_"): + for process_inp in tool.inputs: + process_inp_id = process_inp.id.split("#")[-1].split("/")[-1] + if not process_inp_id.startswith("_"): inputs.append( cwl.WorkflowInputParameter( - id=clt_inp_id, - label=clt_inp.label, - secondaryFiles=clt_inp.secondaryFiles, - streamable=clt_inp.streamable, - doc=clt_inp.doc, - format=clt_inp.format, - default=clt_inp.default, - type_=clt_inp.type_, - extension_fields=clt_inp.extension_fields, - loadingOptions=clt_inp.loadingOptions, + id=process_inp_id, + label=process_inp.label, + secondaryFiles=process_inp.secondaryFiles, + streamable=process_inp.streamable, + doc=process_inp.doc, + format=process_inp.format, + default=process_inp.default, + type_=process_inp.type_, + extension_fields=process_inp.extension_fields, + loadingOptions=process_inp.loadingOptions, ) ) return inputs @@ -1659,17 +2083,18 @@ def cltool_inputs_to_etool_inputs( def cltool_step_outputs_to_workflow_outputs( cltool_step: cwl.WorkflowStep, etool_step_id: str, etool_out_id: str -) -> list[cwl.OutputParameter]: +) -> list[cwl.WorkflowOutputParameter]: """ Copy CommandLineTool outputs into the equivalent Workflow output parameters. Connects the outputSources for each of the new output parameters to the step they came from. """ - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.WorkflowOutputParameter] = [] if not cltool_step.id: raise WorkflowException(f"Missing step id from {cltool_step}.") default_step_id = cltool_step.id.split("#")[-1] + assert not isinstance(cltool_step.run, str) if cltool_step.run.outputs: for clt_out in cltool_step.run.outputs: clt_out_id = clt_out.id.split("#")[-1].split("/")[-1] @@ -1697,14 +2122,20 @@ def cltool_step_outputs_to_workflow_outputs( def generate_etool_from_expr2( expr: str, - target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, + target: cwl.WorkflowInputParameter | cwl.CommandInputParameter, inputs: Sequence[ cwl.WorkflowInputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], self_name: str | None = None, - process: cwl.CommandLineTool | cwl.ExpressionTool | None = None, + process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator + | None + ) = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -1718,8 +2149,8 @@ def generate_etool_from_expr2( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), ) ) expression = "${" @@ -1734,19 +2165,47 @@ def generate_etool_from_expr2( ) hints = None procs: list[ - cwl.CommandLineTool | cwl.ExpressionTool | cwl.Workflow | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.WorkflowStep + | cwl.ProcessGenerator ] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs = [inlineJSReq] + reqs: MutableSequence[ + cwl.CUDARequirement + | cwl.DockerRequirement + | cwl.EnvVarRequirement + | cwl.InitialWorkDirRequirement + | cwl.InlineJavascriptRequirement + | cwl.InplaceUpdateRequirement + | cwl.LoadListingRequirement + | cwl.MPIRequirement + | cwl.MultipleInputFeatureRequirement + | cwl.NetworkAccess + | cwl.ResourceRequirement + | cwl.ScatterFeatureRequirement + | cwl.SchemaDefRequirement + | cwl.Secrets + | cwl.ShellCommandRequirement + | cwl.ShmSize + | cwl.SoftwareRequirement + | cwl.StepInputExpressionRequirement + | cwl.SubworkflowFeatureRequirement + | cwl.ToolTimeLimit + | cwl.WorkReuse + ] = [inlineJSReq] if process: if process.hints: hints = copy.deepcopy(process.hints) - hints[:] = [ - x for x in hints if not isinstance(x, cwl.InitialWorkDirRequirement) + hints = [ + x + for x in copy.deepcopy(hints) + if not isinstance(x, cwl.InitialWorkDirRequirement) ] if process.requirements: reqs.extend(copy.deepcopy(process.requirements)) @@ -1755,7 +2214,7 @@ def generate_etool_from_expr2( ] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), - inputs=inputs, + inputs=parameters_to_workflow_input_paramaters(inputs), outputs=outputs, expression=expression, requirements=reqs, @@ -1777,43 +2236,29 @@ def traverse_step( return False step_id = step.id.split("#")[-1] original_process = copy.deepcopy(step.run) + assert not isinstance(original_process, str) + assert not isinstance(step.run, str) original_step_ins = copy.deepcopy(step.in_) for inp in step.in_: if inp.valueFrom: if not inp.source: self = None else: - if isinstance(inp.source, MutableSequence): - self = [] - for source in inp.source: - if not step.scatter: - self.append( - example_input( - utils.type_for_source(parent, source.split("#")[-1]) - ) - ) - else: - scattered_source_type = utils.type_for_source( - parent, source - ) - if isinstance(scattered_source_type, list): - for stype in scattered_source_type: - self.append(example_input(stype.type_)) - else: - self.append(example_input(scattered_source_type.type_)) - else: + self = [] + for source in inp.source: if not step.scatter: - self = example_input( - utils.type_for_source(parent, inp.source.split("#")[-1]) + self.append( + example_input( + utils.type_for_source(parent, source.split("#")[-1]) + ) ) else: - scattered_source_type2 = utils.type_for_source( - parent, inp.source - ) - if isinstance(scattered_source_type2, list): - self = example_input(scattered_source_type2[0].type_) + scattered_source_type = utils.type_for_source(parent, source) + if isinstance(scattered_source_type, list): + for stype in scattered_source_type: + self.append(example_input(stype.type_)) else: - self = example_input(scattered_source_type2.type_) + self.append(example_input(scattered_source_type.type_)) expression = get_expression(inp.valueFrom, inputs, self) if expression: modified = True @@ -1822,42 +2267,32 @@ def traverse_step( if not target: raise WorkflowException("target not found") input_source_id = None - source_type: None | ( - MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + source_type: ( + None + | MutableSequence[ + cwl.WorkflowInputParameter | cwl.CommandOutputParameter ] - | cwl.CommandInputParameter - | cwl.CommandOutputParameter | cwl.WorkflowInputParameter + | cwl.CommandOutputParameter ) = None if inp.source: - if isinstance(inp.source, MutableSequence): - input_source_id = [] - source_types: list[cwl.WorkflowInputParameter] = [] - for source in inp.source: - source_id = source.split("#")[-1] - input_source_id.append(source_id) - temp_type = utils.type_for_source( - step.run, source_id, parent - ) - if isinstance(temp_type, list): - for ttype in temp_type: - if ttype not in source_types: - source_types.append(ttype) - else: - if temp_type not in source_types: - source_types.append(temp_type) - source_type = cwl.WorkflowInputParameter( - id=None, - type_=cwl.ArraySchema(source_types, "array"), - ) - else: - input_source_id = inp.source.split("#")[-1] - source_type = utils.param_for_source_id( - step.run, input_source_id, parent - ) + input_source_id = [] + source_types: list[BasicInputTypeSchemas] = [] + for source in inp.source: + source_id = source.split("#")[-1] + input_source_id.append(source_id) + temp_type = utils.type_for_source(step.run, source_id, parent) + if isinstance(temp_type, list): + for ttype in temp_type: + if ttype not in source_types: + source_types.append(ttype) + else: + if temp_type not in source_types: + source_types.append(temp_type) + source_type = cwl.WorkflowInputParameter( + id="", + type_=cwl.InputArraySchema(source_types, "array"), + ) # target.id = target.id.split('#')[-1] if isinstance(original_process, cwl.ExpressionTool): found_JSReq = False @@ -1873,9 +2308,11 @@ def traverse_step( if not step.run.requirements: step.run.requirements = [] expr_lib = find_expressionLib([parent]) - step.run.requirements.append( + new_step_run_requirements = list(step.run.requirements) + new_step_run_requirements.append( cwl.InlineJavascriptRequirement(expr_lib) ) + step.run.requirements = new_step_run_requirements replace_step_valueFrom_expr_with_etool( expression, etool_id, @@ -1892,6 +2329,7 @@ def traverse_step( inp.valueFrom = None inp.source = f"{etool_id}/result" # TODO: skip or special process for sub workflows? + assert not isinstance(original_process, str) process_modified = process_level_reqs( original_process, step, @@ -1917,29 +2355,35 @@ def traverse_step( def workflow_step_to_WorkflowInputParameters( - step_ins: list[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str -) -> MutableSequence[ - cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter -]: + step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str +) -> list[cwl.WorkflowInputParameter]: """Create WorkflowInputParameters to match the given WorkflowStep inputs.""" - params = [] + params: list[cwl.WorkflowInputParameter] = [] for inp in step_ins: - if not inp.id: - continue inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, MutableSequence): + if isinstance(param, Sequence): for p in param: - p.id = inp_id - p.type_ = clean_type_ids(p.type_) - params.append(p) + if not p.type_: + raise WorkflowException( + f"Don't know how to get type id for {p!r}." + ) + new_param = parameter_to_workflow_input_paramater(p) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) else: - param.id = inp_id - param.type_ = clean_type_ids(param.type_) - params.append(param) + if not param.type_: + raise WorkflowException( + f"Don't know how to get type id for {param!r}." + ) + new_param = parameter_to_workflow_input_paramater(param) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) return params @@ -1950,15 +2394,17 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: cwl.CommandLineTool | cwl.ExpressionTool, - original_step_ins: list[cwl.WorkflowStepInput], + original_process: ( + cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow + ), + original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, source_type: None | ( cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter - | MutableSequence[ + | Sequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter @@ -1995,22 +2441,19 @@ def replace_step_valueFrom_expr_with_etool( etool: cwl.ExpressionTool | cwl.CommandLineTool = cltool else: etool = temp_etool - wf_step_inputs = copy.deepcopy(original_step_ins) + wf_step_inputs = list(original_step_ins) if source: wf_step_inputs.append(cwl.WorkflowStepInput(id="self", source=step_inp.source)) for wf_step_input in wf_step_inputs: - if not wf_step_input.id: - continue wf_step_input.id = wf_step_input.id.split("/")[-1] if wf_step_input.valueFrom: wf_step_input.valueFrom = None if wf_step_input.source: - if isinstance(wf_step_input.source, MutableSequence): - for index, inp_source in enumerate(wf_step_input.source): - wf_step_input.source[index] = inp_source.split("#")[-1] - else: - wf_step_input.source = wf_step_input.source.split("#")[-1] - wf_step_inputs[:] = [ + new_source = list(wf_step_input.source) + for index, inp_source in enumerate(wf_step_input.source): + new_source[index] = inp_source.split("#")[-1] + wf_step_input.source = new_source + wf_step_inputs = [ x for x in wf_step_inputs if x.id and not (x.id.startswith("_") or x.id.endswith(step_inp_id)) @@ -2026,7 +2469,8 @@ def replace_step_valueFrom_expr_with_etool( # do we still need to scatter? else: scatter = None - workflow.steps.append( + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -2036,6 +2480,7 @@ def replace_step_valueFrom_expr_with_etool( scatterMethod=step.scatterMethod, ) ) + workflow.steps = new_steps def traverse_workflow( @@ -2068,7 +2513,7 @@ def traverse_workflow( if process_workflow_reqs_and_hints(workflow, replace_etool): modified = True if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance( diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index ecd784e8..8e57fcb5 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -430,8 +430,10 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, ) -> Any: @@ -482,8 +484,10 @@ def type_for_source( def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( From 308068686f6f47444141d2f706458928d5aa3e8d Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 20 Dec 2025 16:11:10 +0100 Subject: [PATCH 08/23] finish type fixing cwl_v1_2_expression_refactor --- src/cwl_utils/cwl_v1_2_expression_refactor.py | 1328 +++++++++++------ src/cwl_utils/parser/cwl_v1_2_utils.py | 16 +- 2 files changed, 895 insertions(+), 449 deletions(-) diff --git a/src/cwl_utils/cwl_v1_2_expression_refactor.py b/src/cwl_utils/cwl_v1_2_expression_refactor.py index 1b667304..47709bbe 100755 --- a/src/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_2_expression_refactor.py @@ -6,9 +6,9 @@ import copy import hashlib import uuid -from collections.abc import Mapping, MutableSequence, Sequence +from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, cast +from typing import Any, Literal, TypeAlias, TypeVar, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -25,6 +25,7 @@ CWLOutputType, CWLParameterContext, CWLRuntimeParameterContext, + is_file_or_directory, ) @@ -44,7 +45,7 @@ def expand_stream_shortcuts(process: cwl.CommandLineTool) -> cwl.CommandLineTool ).hexdigest() result.stdout = stdout_path result.outputs[index].type_ = "File" - output.outputBinding = cwl.CommandOutputBinding(stdout_path, None, None) + output.outputBinding = cwl.CommandOutputBinding(glob=stdout_path) if result: return result return process @@ -55,33 +56,153 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -def clean_type_ids( - cwltype: cwl.ArraySchema | cwl.InputRecordSchema, -) -> cwl.ArraySchema | cwl.InputRecordSchema: - """Simplify type identifiers.""" - result = copy.deepcopy(cwltype) - if isinstance(result, cwl.ArraySchema): - if isinstance(result.items, MutableSequence): - for item in result.items: +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _clean_type_ids( + cwltype: InputTypeSchemas | CommandOutputTypeSchemas, +) -> None: + if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype.items, Sequence): + for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(result.items, cwl.InputRecordSchema): - if result.items.name: - result.items.name = result.items.name.split("/")[-1] - if result.items.fields: - for field in result.items.fields: + elif isinstance(cwltype.items, cwl.RecordSchema): + if ( + isinstance( + cwltype.items, + (cwl.InputRecordSchema, cwl.CommandOutputRecordSchema), + ) + and cwltype.items.name + ): + cwltype.items.name = cwltype.items.name.split("/")[-1] + if cwltype.items.fields: + for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(result, cwl.InputRecordSchema): - if result.name: - result.name = result.name.split("/")[-1] - if result.fields: - for field in result.fields: + elif isinstance(cwltype, cwl.RecordSchema): + if cwltype.name: + cwltype.name = cwltype.name.split("/")[-1] + if cwltype.fields: + for field in cwltype.fields: field.name = field.name.split("/")[-1] + + +def clean_type_ids( + cwltype: AnyTypeSchema, +) -> AnyTypeSchema: + """Simplify type identifiers.""" + result = copy.deepcopy(cwltype) + if isinstance(result, Sequence): + for item in result: + _clean_type_ids(item) + else: + _clean_type_ids(result) return result +def _has_expression(string: str) -> bool: + if "${" in string: + return True + if "$(" in string: + return True + return False + + +def has_expression(field: str | Sequence[str]) -> bool: + if isinstance(field, Sequence): + for entry in field: + if _has_expression(entry): + return True + return False + return _has_expression(field) + + def get_expression( - string: str, inputs: CWLObjectType, self: CWLOutputType | None + string: Any, inputs: CWLObjectType, self: CWLOutputType | None ) -> str | None: """ Find and return a normalized CWL expression, if any. @@ -136,6 +257,186 @@ def get_expression( return None +def _plain_input_schema_to_clt_input_schema( + input_type: BasicInputTypeSchemas, +) -> BasicCommandInputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.CommandInputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.CommandInputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.CommandInputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_clt_input_schema( + input_type: InputTypeSchemas, +) -> CommandInputTypeSchemas: + if isinstance(input_type, Sequence): + return [ + _plain_input_schema_to_clt_input_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_input_schema_to_clt_input_schema(input_type) + + +def _plain_input_schema_to_plain_output_schema( + input_type: BasicInputTypeSchemas, +) -> BasicOutputTypeSchemas: + match input_type: + case cwl.InputArraySchema(): + return cwl.OutputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputEnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.InputRecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_input_schema_to_plain_output_schema( + input_type: InputTypeSchemas, +) -> OutputTypeSchemas: + if isinstance(input_type, Sequence): + return [ + _plain_input_schema_to_plain_output_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_input_schema_to_plain_output_schema(input_type) + + +def _plain_output_schema_to_plain_input_schema( + input_type: BasicOutputTypeSchemas, +) -> BasicInputTypeSchemas: + match input_type: + case cwl.OutputArraySchema(): + return cwl.InputArraySchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.OutputEnumSchema(): + return cwl.InputEnumSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case cwl.OutputRecordSchema(): + return cwl.InputRecordSchema.fromDoc( + input_type.save(), + input_type.loadingOptions.baseuri, + input_type.loadingOptions, + ) + case str(): + return input_type + raise WorkflowException(f"Unexpected ExpressionTool input type: {input_type}.") + + +def plain_output_schema_to_plain_input_schema( + input_type: OutputTypeSchemas, +) -> InputTypeSchemas: + if isinstance(input_type, Sequence): + return [ + _plain_output_schema_to_plain_input_schema(input_type_item) + for input_type_item in input_type + ] + return _plain_output_schema_to_plain_input_schema(input_type) + + +def _plain_output_type_to_clt_output_type( + output_type: BasicOutputTypeSchemas, +) -> BasicCommandOutputTypeSchemas: + match output_type: + case cwl.OutputArraySchema(): + return cwl.CommandOutputArraySchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputEnumSchema(): + return cwl.CommandOutputEnumSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case cwl.OutputRecordSchema(): + return cwl.CommandOutputRecordSchema.fromDoc( + output_type.save(), + output_type.loadingOptions.baseuri, + output_type.loadingOptions, + ) + case str(): + return output_type + raise WorkflowException(f"Unexpected ExpressionTool output type: {output_type}.") + + +def plain_output_type_to_clt_output_type( + output_type: OutputTypeSchemas, +) -> CommandOutputTypeSchemas: + if isinstance(output_type, Sequence): + return [ + _plain_output_type_to_clt_output_type(output_type_item) + for output_type_item in output_type + ] + return _plain_output_type_to_clt_output_type(output_type) + + +def parameter_to_workflow_input_paramater( + parameter: ( + cwl.WorkflowInputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + | cwl.ExpressionToolOutputParameter + | cwl.WorkflowOutputParameter + | cwl.OperationOutputParameter + | cwl.OperationInputParameter + ), +) -> cwl.WorkflowInputParameter: + return cwl.WorkflowInputParameter.fromDoc( + parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions + ) + + +def parameters_to_workflow_input_paramaters( + parameters: Sequence[ + cwl.WorkflowInputParameter + | cwl.CommandInputParameter + | cwl.CommandOutputParameter + ], +) -> Sequence[cwl.WorkflowInputParameter]: + return [ + parameter_to_workflow_input_paramater(parameter) for parameter in parameters + ] + + def etool_to_cltool( etool: cwl.ExpressionTool, expressionLib: list[str] | None = None ) -> cwl.CommandLineTool: @@ -151,7 +452,7 @@ def etool_to_cltool( doc=inp.doc, format=inp.format, default=inp.default, - type_=inp.type_, + type_=plain_input_schema_to_clt_input_schema(inp.type_), extension_fields=inp.extension_fields, loadingOptions=inp.loadingOptions, ) @@ -166,7 +467,7 @@ def etool_to_cltool( streamable=outp.streamable, doc=outp.doc, format=outp.format, - type_=outp.type_, + type_=plain_output_type_to_clt_output_type(outp.type_), extension_fields=outp.extension_fields, loadingOptions=outp.loadingOptions, ) @@ -326,53 +627,71 @@ def generate_etool_from_expr( self_type: None | ( cwl.WorkflowInputParameter | cwl.CommandInputParameter - | list[cwl.WorkflowInputParameter | cwl.CommandInputParameter] + | Sequence[cwl.WorkflowInputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output extra_processes: None | ( - Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] + Sequence[ + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation + ] ) = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" - inputs = yaml.comments.CommentedSeq() + inputs: list[cwl.WorkflowInputParameter] = [] if not no_inputs: - if not self_type: + if self_type is None: self_type = target - if isinstance(self_type, list): - new_type: ( - list[cwl.ArraySchema | cwl.InputRecordSchema] - | cwl.ArraySchema - | cwl.InputRecordSchema - ) = [clean_type_ids(t.type_) for t in self_type] + assert self_type is not None + new_type: InputTypeSchemas + if isinstance(self_type, Sequence): + new_type_list: MutableSequence[BasicInputTypeSchemas] = [] + for entry in self_type: + clean_type = clean_type_ids(entry.type_) + if isinstance(clean_type, Sequence): + new_type_list.extend(clean_type) + elif clean_type is None: + pass + else: + new_type_list.append(clean_type) + new_type = new_type_list else: new_type = clean_type_ids(self_type.type_) inputs.append( cwl.WorkflowInputParameter( id="self", - label=self_type.label if not isinstance(self_type, list) else None, + label=self_type.label if not isinstance(self_type, Sequence) else None, secondaryFiles=( self_type.secondaryFiles - if not isinstance(self_type, list) + if not isinstance(self_type, Sequence) else None ), streamable=( - self_type.streamable if not isinstance(self_type, list) else None + self_type.streamable + if not isinstance(self_type, Sequence) + else None + ), + doc=self_type.doc if not isinstance(self_type, Sequence) else None, + format=( + self_type.format if not isinstance(self_type, Sequence) else None ), - doc=self_type.doc if not isinstance(self_type, list) else None, - format=self_type.format if not isinstance(self_type, list) else None, type_=new_type, extension_fields=( self_type.extension_fields - if not isinstance(self_type, list) + if not isinstance(self_type, Sequence) else None ), loadingOptions=( self_type.loadingOptions - if not isinstance(self_type, list) + if not isinstance(self_type, Sequence) else None ), ) ) - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.ExpressionToolOutputParameter] = [] outputs.append( cwl.ExpressionToolOutputParameter( id="result", @@ -380,8 +699,8 @@ def generate_etool_from_expr( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), extension_fields=target.extension_fields, loadingOptions=target.loadingOptions, ) @@ -410,18 +729,28 @@ def generate_etool_from_expr( def get_input_for_id( - name: str, tool: cwl.CommandLineTool | cwl.Workflow + name: str, + tool: ( + cwl.CommandLineTool + | cwl.Workflow + | cwl.ProcessGenerator + | cwl.ExpressionTool + | cwl.Operation + ), ) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] for inp in cast(list[cwl.CommandInputParameter], tool.inputs): if inp.id and inp.id.split("#")[-1].split("/")[-1] == name: - return inp + return cwl.CommandInputParameter.fromDoc( + inp.save(), inp.loadingOptions.baseuri, inp.loadingOptions + ) if isinstance(tool, cwl.Workflow) and "/" in name: stepname, stem = name.split("/", 1) for step in tool.steps: if step.id == stepname: + assert not isinstance(step.run, str) result = get_input_for_id(stem, step.run) if result: return result @@ -430,7 +759,12 @@ def get_input_for_id( def find_expressionLib( processes: Sequence[ - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.Workflow + | cwl.ExpressionTool + | cwl.WorkflowStep + | cwl.ProcessGenerator + | cwl.Operation ], ) -> list[str] | None: """ @@ -452,26 +786,41 @@ def replace_expr_with_etool( name: str, workflow: cwl.Workflow, target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, - source: str | list[Any] | None, + source: str | Sequence[Any] | None, replace_etool: bool = False, extra_process: None | ( - cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool + cwl.Workflow + | cwl.WorkflowStep + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation ) = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] = [ - workflow - ] + extra_processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation + ] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[cwl.WorkflowStep | cwl.Workflow | cwl.CommandLineTool] = [ - workflow - ] + processes: list[ + cwl.WorkflowStep + | cwl.Workflow + | cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation + ] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -482,14 +831,16 @@ def replace_expr_with_etool( inps = [] if source: inps.append(cwl.WorkflowStepInput(id="self", source=source)) - workflow.steps.append( + new_steps: list[cwl.WorkflowStep] = [ cwl.WorkflowStep( id=name, in_=inps, out=[cwl.WorkflowStepOutput("result")], run=final_tool, ) - ) + ] + new_steps.extend(workflow.steps) + workflow.steps = new_steps def replace_wf_input_ref_with_step_output( @@ -520,26 +871,34 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( process_or_step: ( - cwl.CommandLineTool | cwl.WorkflowStep | cwl.ExpressionTool | cwl.Workflow + cwl.CommandLineTool + | cwl.WorkflowStep + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator + | cwl.Operation ), parent: cwl.Workflow | None = None, ) -> dict[str, Any]: """Produce a mock input object for the given inputs.""" result = {} if isinstance(process_or_step, cwl.Process): - for param in process_or_step.inputs: - result[param.id.split("#")[-1]] = example_input(param.type_) + for param1 in process_or_step.inputs: + result[param1.id.split("#")[-1]] = example_input(param1.type_) else: - for param in process_or_step.in_: - param_id = param.id.split("/")[-1] - if param.source is None and param.valueFrom: - result[param_id] = example_input("string") - elif param.source is None and param.default: - result[param_id] = param.default - else: + for param2 in process_or_step.in_: + param2_id = param2.id.split("/")[-1] + if param2.source is None and param2.valueFrom: + result[param2_id] = example_input("string") + elif param2.source is None and param2.default: + result[param2_id] = param2.default + elif param2.source is not None: with suppress(WorkflowException): - result[param_id] = example_input( - utils.type_for_source(process_or_step.run, param.source, parent) + assert not isinstance(process_or_step.run, str) + result[param2_id] = example_input( + utils.type_for_source( + process_or_step.run, param2.source, parent + ) ) return result @@ -660,18 +1019,17 @@ def process_workflow_inputs_and_outputs( ) -> bool: """Do any needed conversions on the given Workflow's inputs and outputs.""" modified = False - inputs = empty_inputs(workflow) for index, param in enumerate(workflow.inputs): with SourceLine(workflow.inputs, index, WorkflowException): - if param.format and get_expression(param.format, inputs, None): + if param.format is not None and has_expression(param.format): raise SourceLine( param.loadingOptions.original_doc, "format", raise_type=WorkflowException, ).makeError(TOPLEVEL_FORMAT_EXPR_ERROR.format(param.id.split("#")[-1])) if param.secondaryFiles: - if hasattr(param.secondaryFiles, "pattern") and get_expression( - param.secondaryFiles.pattern, inputs, EMPTY_FILE + if hasattr(param.secondaryFiles, "pattern") and has_expression( + param.secondaryFiles.pattern ): raise SourceLine( param.loadingOptions.original_doc, @@ -680,7 +1038,7 @@ def process_workflow_inputs_and_outputs( ).makeError(TOPLEVEL_SF_EXPR_ERROR.format(param.id.split("#")[-1])) elif isinstance(param.secondaryFiles, MutableSequence): for index2, entry in enumerate(param.secondaryFiles): - if get_expression(entry.pattern, inputs, EMPTY_FILE): + if has_expression(entry.pattern): raise SourceLine( param.loadingOptions.original_doc, index2, @@ -709,26 +1067,31 @@ def process_workflow_inputs_and_outputs( target_type = copy.deepcopy(param2.type_) if isinstance(target_type, cwl.OutputArraySchema): target_type.name = "" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) - if not isinstance(param2.outputSource, list): + target = cwl.WorkflowInputParameter( + id="", type_=plain_output_schema_to_plain_input_schema(target_type) + ) + assert param2.outputSource is not None + if not isinstance(param2.outputSource, Sequence): sources = param2.outputSource.split("#")[-1] else: sources = [s.split("#")[-1] for s in param2.outputSource] source_type_items = utils.type_for_source(workflow, sources) if isinstance(source_type_items, cwl.ArraySchema): - if isinstance(source_type_items.items, list): + if isinstance(source_type_items.items, Sequence): if "null" not in source_type_items.items: - source_type_items.items.append("null") + new_source_type_items_items = list(source_type_items.items) + new_source_type_items_items.append("null") + source_type_items.items = new_source_type_items_items elif source_type_items.items != "null": source_type_items.items = ["null", source_type_items.items] - elif isinstance(source_type_items, list): + elif isinstance(source_type_items, Sequence): if "null" not in source_type_items: - source_type_items.append("null") + new_source_type_items = list(source_type_items) + new_source_type_items.append("null") + source_type_items = new_source_type_items elif source_type_items != "null": source_type_items = ["null", source_type_items] - source_type = cwl.CommandInputParameter( - id=None, type_=source_type_items - ) + source_type = cwl.CommandInputParameter(id="", type_=source_type_items) replace_expr_with_etool( expression, etool_id, @@ -786,7 +1149,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = ( @@ -807,7 +1170,9 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.EnvVarRequirement,) newEnvDef = copy.deepcopy(envDef) newEnvDef.envValue = f"$(inputs._envDef{index})" - envVarReq.envDef[index] = newEnvDef + new_envDef = list(envVarReq.envDef) + new_envDef[index] = newEnvDef + envVarReq.envDef = new_envDef generated_envVar_reqs.append((etool_id, index)) case cwl.ResourceRequirement(): for attr in cwl.ResourceRequirement.attrs: @@ -816,9 +1181,7 @@ def process_workflow_reqs_and_hints( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter( - id=None, type_="long" - ) + target = cwl.WorkflowInputParameter(id="", type_="long") etool_id = "_expression_workflow_ResourceRequirement_{}".format( attr ) @@ -843,7 +1206,7 @@ def process_workflow_reqs_and_hints( if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), @@ -864,18 +1227,18 @@ def process_workflow_reqs_and_hints( prop_reqs += (cwl.InitialWorkDirRequirement,) else: iwdr = copy.deepcopy(req) - for index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for index1, entry1 in enumerate(req.listing): + expression = get_expression(entry1, inputs, None) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema( ["File", "Directory"], "array", None, None ), ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expression, @@ -885,17 +1248,19 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = f"$(inputs._iwdr_listing_{index}" - generated_iwdr_reqs.append((etool_id, index)) - elif isinstance(entry, cwl.Dirent): - if entry.entry: + new_listing = list(iwdr.listing) + new_listing[index1] = f"$(inputs._iwdr_listing_{index1}" + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) + elif isinstance(entry1, cwl.Dirent): + if entry1.entry: expression = get_expression( - entry.entry, inputs, None + entry1.entry, inputs, None ) if expression: expr: str = expression expr_result = do_eval( - ex=entry.entry, + ex=entry1.entry, jobinput=inputs, requirements=[], outdir="", @@ -903,16 +1268,9 @@ def process_workflow_reqs_and_hints( resources={}, ) modified = True - if ( - isinstance(expr_result, Mapping) - and "class" in expr_result - and ( - expr_result["class"] - in ("File", "Directory") - ) - ): + if is_file_or_directory(expr_result): target = cwl.WorkflowInputParameter( - id=None, + id="", type_=expr_result["class"], ) replace_expr_with_etool( @@ -923,38 +1281,38 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - "$(inputs._iwdr_listing_{}".format( - index - ) + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) + iwdr.listing = new_listing generated_iwdr_reqs.append( - (etool_id, index) + (etool_id, index1) ) elif isinstance(expr_result, str): target = cwl.WorkflowInputParameter( - id=None, + id="", type_=["File"], ) - if entry.entryname is None: + if entry1.entryname is None: raise SourceLine( - entry.loadingOptions.original_doc, - index, + entry1.loadingOptions.original_doc, + index1, raise_type=WorkflowException, ).makeError( - f"Entry {index}," + f"Entry {index1}," + "Invalid CWL, if 'entry' " "is a string, then entryName must be specified." ) expr = ( '${return {"class": "File", "basename": "' - + entry.entryname + + entry1.entryname + '", "contents": (function(){' + expr[2:-1] + "})() }; }" ) etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index + index1 ) replace_expr_with_etool( expr, @@ -964,24 +1322,24 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) - elif entry.entryname: + elif entry1.entryname: expression = get_expression( - entry.entryname, inputs, None + entry1.entryname, inputs, None ) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) - etool_id = "_expression_workflow_InitialWorkDirRequirement_{}".format( - index - ) + etool_id = f"_expression_workflow_InitialWorkDirRequirement_{index1}" replace_expr_with_etool( expression, etool_id, @@ -990,10 +1348,12 @@ def process_workflow_reqs_and_hints( None, replace_etool, ) - iwdr.listing[index] = ( - f"$(inputs._iwdr_listing_{index}" + new_listing = list(iwdr.listing) + new_listing[index1] = ( + f"$(inputs._iwdr_listing_{index1}" ) - generated_iwdr_reqs.append((etool_id, index)) + iwdr.listing = new_listing + generated_iwdr_reqs.append((etool_id, index1)) if generated_iwdr_reqs: prop_reqs += (cwl.InitialWorkDirRequirement,) else: @@ -1008,14 +1368,18 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(envVarReq) - for entry in generated_envVar_reqs: - step.in_.append( + new_requirements = list(step.requirements) + new_requirements.append(envVarReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry2 in generated_envVar_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_envDef{entry[1]}", - source=f"{entry[0]}/result", + id=f"_envDef{entry2[1]}", + source=f"{entry2[0]}/result", ) ) + step.in_ = new_ins if resourceReq and workflow.steps: for step in workflow.steps: @@ -1026,15 +1390,19 @@ def process_workflow_reqs_and_hints( if isinstance(req, cwl.ResourceRequirement): continue else: - step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(resourceReq) - for entry in generated_res_reqs: - step.in_.append( + step.requirements = [] + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + step.requirements = new_requirements + new_ins = list(step.in_) + for entry3 in generated_res_reqs: + new_ins.append( cwl.WorkflowStepInput( - id=f"_{entry[1]}", - source=f"{entry[0]}/result", + id=f"_{entry3[1]}", + source=f"{entry3[0]}/result", ) ) + step.in_ = new_ins if iwdr and workflow.steps: for step in workflow.steps: @@ -1046,32 +1414,43 @@ def process_workflow_reqs_and_hints( continue else: step.requirements = yaml.comments.CommentedSeq() - step.requirements.append(iwdr) + new_requirements = list(step.requirements) + new_requirements.append(resourceReq) + new_requirements.append(iwdr) + step.requirements = new_requirements + new_ins = list(step.in_) if generated_iwdr_reqs: - for entry in generated_iwdr_reqs: - step.in_.append( + for entry4 in generated_iwdr_reqs: + new_ins.append( cwl.WorkflowStepInput( id=f"_iwdr_listing_{index}", - source=f"{entry[0]}/result", + source=f"{entry4[0]}/result", ) ) else: - step.in_.append( + new_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source="_expression_workflow_InitialWorkDirRequirement/result", ) ) + step.in_ = new_ins if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance(x, prop_reqs) ] return modified def process_level_reqs( - process: cwl.CommandLineTool, + process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Workflow + | cwl.Operation + ), step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -1091,6 +1470,7 @@ def process_level_reqs( if not process.requirements: return False modified = False + assert not isinstance(step.run, str) target_process = step.run inputs = empty_inputs(process) generated_res_reqs: list[tuple[str, str]] = [] @@ -1100,6 +1480,7 @@ def process_level_reqs( return False step_name = step.id.split("#", 1)[-1] for req_index, req in enumerate(process.requirements): + assert target_process.requirements is not None match req: case cwl.EnvVarRequirement() if req.envDef: for env_index, envDef in enumerate(req.envDef): @@ -1107,7 +1488,7 @@ def process_level_reqs( expression = get_expression(envDef.envValue, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter(id=None, type_="string") + target = cwl.WorkflowInputParameter(id="", type_="string") etool_id = "_expression_{}_EnvVarRequirement_{}".format( step_name, env_index ) @@ -1120,7 +1501,10 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index][ + cast( + cwl.EnvVarRequirement, + target_process.requirements[req_index], + ).envDef[ env_index ].envValue = f"$(inputs._envDef{env_index})" generated_envVar_reqs.append((etool_id, env_index)) @@ -1131,11 +1515,11 @@ def process_level_reqs( expression = get_expression(this_attr, inputs, None) if expression: modified = True - target = cwl.WorkflowInputParameter(id=None, type_="long") + target = cwl.WorkflowInputParameter(id="", type_="long") etool_id = "_expression_{}_ResourceRequirement_{}".format( step_name, attr ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( expression, etool_id, parent, @@ -1160,7 +1544,7 @@ def process_level_reqs( target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) etool_id = "_expression_{}_InitialWorkDirRequirement".format( step_name ) @@ -1173,15 +1557,18 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing = ( - "$(inputs._iwdr_listing)", - ) - step.in_.append( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = ("$(inputs._iwdr_listing)",) + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput( id="_iwdr_listing", source=f"{etool_id}/result", ) ) + step.in_ = new_step_ins add_input_to_process( target_process, "_iwdr_listing", @@ -1189,15 +1576,15 @@ def process_level_reqs( process.loadingOptions, ) else: - for listing_index, entry in enumerate(req.listing): - expression = get_expression(entry, inputs, None) + for listing_index, entry5 in enumerate(req.listing): + expression = get_expression(entry5, inputs, None) if expression: modified = True target_type = cwl.InputArraySchema( ["File", "Directory"], "array", None, None ) target = cwl.WorkflowInputParameter( - id=None, + id="", type_=target_type, ) etool_id = ( @@ -1214,31 +1601,41 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ] = f"$(inputs._iwdr_listing_{listing_index}" + new_iwdr_listing = list( + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing + ) + new_iwdr_listing[listing_index] = ( + f"$(inputs._iwdr_listing_{listing_index}" + ) + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing = new_iwdr_listing generated_iwdr_reqs.append( (etool_id, listing_index, target_type) ) - elif isinstance(entry, cwl.Dirent): - if entry.entry: - expression = get_expression(entry.entry, inputs, None) + elif isinstance(entry5, cwl.Dirent): + if entry5.entry: + expression = get_expression(entry5.entry, inputs, None) if expression: modified = True - if entry.entryname is not None: + if entry5.entryname is not None: entryname_expr = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) entryname = ( - entry.entryname + entry5.entryname if entryname_expr - else f'"{entry.entryname}"' # noqa: B907 + else f'"{entry5.entryname}"' # noqa: B907 ) new_expression = ( "${var result; var entryname = " + entryname + "; var entry = " - + entry.entry[2:-1] + + entry5.entry[2:-1] + """; if (typeof entry === 'string' || entry instanceof String) { result = {"class": "File", "basename": entryname, "contents": entry} ; @@ -1254,14 +1651,14 @@ def process_level_reqs( new_expression = expression d_target_type = ["File", "Directory"] target = cwl.WorkflowInputParameter( - id=None, + id="", type_=d_target_type, ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( step_name, listing_index ) - replace_clt_hintreq_expr_with_etool( + replace_step_process_hintreq_expr_with_etool( new_expression, etool_id, parent, @@ -1269,22 +1666,26 @@ def process_level_reqs( step, replace_etool, ) - target_process.requirements[req_index].listing[ - listing_index - ].entry = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entry = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, d_target_type) ) - elif entry.entryname: + elif entry5.entryname: expression = get_expression( - entry.entryname, inputs, None + entry5.entryname, inputs, None ) if expression: modified = True target = cwl.WorkflowInputParameter( - id=None, + id="", type_="string", ) etool_id = "_expression_{}_InitialWorkDirRequirement_{}".format( @@ -1299,26 +1700,40 @@ def process_level_reqs( replace_etool, process, ) - target_process.requirements[req_index].listing[ - listing_index - ].entryname = "$(inputs._iwdr_listing_{})".format( + cast( + cwl.Dirent, + cast( + cwl.InitialWorkDirRequirement, + target_process.requirements[req_index], + ).listing[listing_index], + ).entryname = "$(inputs._iwdr_listing_{})".format( listing_index ) generated_iwdr_reqs.append( (etool_id, listing_index, "string") ) - for entry in generated_envVar_reqs: - name = f"_envDef{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + new_step_ins = list(step.in_) + for env_entry in generated_envVar_reqs: + name = f"_envDef{env_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{env_entry[0]}/result") + ) add_input_to_process(target_process, name, "string", process.loadingOptions) - for entry in generated_res_reqs: - name = f"_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) + for res_entry in generated_res_reqs: + name = f"_{res_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{res_entry[0]}/result") + ) add_input_to_process(target_process, name, "long", process.loadingOptions) - for entry in generated_iwdr_reqs: - name = f"_iwdr_listing_{entry[1]}" - step.in_.append(cwl.WorkflowStepInput(id=name, source=f"{entry[0]}/result")) - add_input_to_process(target_process, name, entry[2], process.loadingOptions) + for iwdr_entry in generated_iwdr_reqs: + name = f"_iwdr_listing_{iwdr_entry[1]}" + new_step_ins.append( + cwl.WorkflowStepInput(id=name, source=f"{iwdr_entry[0]}/result") + ) + add_input_to_process( + target_process, name, iwdr_entry[2], process.loadingOptions + ) + step.in_ = new_step_ins return modified @@ -1327,13 +1742,15 @@ def add_input_to_process( ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): - process.inputs.append( + new_process_inputs = list(process.inputs) + new_process_inputs.append( cwl.CommandInputParameter( id=name, type_=inptype, loadingOptions=loadingOptions, ) ) + process.inputs = new_process_inputs def traverse_CommandLineTool( @@ -1361,24 +1778,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index] = cwl.CommandLineBinding( + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( valueFrom=f"$(inputs.{inp_id})" ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( - cwl.WorkflowStepInput( - f"{etool_id}/result", None, inp_id, None, None - ) + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( + cwl.WorkflowStepInput(id=f"{etool_id}/result", source=inp_id) ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) elif isinstance(arg, cwl.CommandLineBinding) and arg.valueFrom: expression = get_expression(arg.valueFrom, inputs, None) @@ -1387,22 +1808,28 @@ def traverse_CommandLineTool( inp_id = f"_arguments_{index}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "Any" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) - target_clt.arguments[index].valueFrom = "$(inputs.{})".format( - inp_id + new_target_clt_arguments = list(target_clt.arguments or []) + new_target_clt_arguments[index] = cwl.CommandLineBinding( + valueFrom="$(inputs.{})".format(inp_id) ) - target_clt.inputs.append( + target_clt.arguments = new_target_clt_arguments + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins remove_JSReq(target_clt, skip_command_line1) for streamtype in "stdout", "stderr": # add 'stdin' for v1.1 version stream_value = getattr(clt, streamtype) @@ -1413,17 +1840,21 @@ def traverse_CommandLineTool( inp_id = f"_{streamtype}" etool_id = f"_expression_{step_id}{inp_id}" target_type = "string" - target = cwl.WorkflowInputParameter(id=None, type_=target_type) + target = cwl.WorkflowInputParameter(id="", type_=target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) setattr(target_clt, streamtype, f"$(inputs.{inp_id})") - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter(id=inp_id, type_=target_type) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for inp in clt.inputs: if not skip_command_line1 and inp.inputBinding and inp.inputBinding.valueFrom: expression = get_expression( @@ -1438,12 +1869,19 @@ def traverse_CommandLineTool( expression, etool_id, parent, inp, step, replace_etool, self_id ) inp.inputBinding.valueFrom = f"$(inputs.{inp_id})" - target_clt.inputs.append( - cwl.CommandInputParameter(id=inp_id, type_=inp.type_) + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( + cwl.CommandInputParameter( + id=inp_id, + type_=plain_input_schema_to_clt_input_schema(inp.type_), + ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins for outp in clt.outputs: if outp.outputBinding: if outp.outputBinding.glob: @@ -1452,21 +1890,28 @@ def traverse_CommandLineTool( modified = True inp_id = "_{}_glob".format(outp.id.split("#")[-1]) etool_id = f"_expression_{step_id}{inp_id}" - glob_target_type = ["string", cwl.ArraySchema("string", "array")] - target = cwl.WorkflowInputParameter(id=None, type_=glob_target_type) + glob_target_type: CommandInputTypeSchemas = [ + "string", + cwl.CommandInputArraySchema("string", "array"), + ] + target = cwl.WorkflowInputParameter(id="", type_=glob_target_type) replace_step_clt_expr_with_etool( expression, etool_id, parent, target, step, replace_etool ) outp.outputBinding.glob = f"$(inputs.{inp_id})" - target_clt.inputs.append( + new_target_clt_inputs = list(target_clt.inputs) + new_target_clt_inputs.append( cwl.CommandInputParameter( id=inp_id, type_=glob_target_type, ) ) - step.in_.append( + target_clt.inputs = new_target_clt_inputs + new_step_ins = list(step.in_) + new_step_ins.append( cwl.WorkflowStepInput(id=inp_id, source=f"{etool_id}/result") ) + step.in_ = new_step_ins if outp.outputBinding.outputEval and not skip_command_line2: self: CWLOutputType = [ { @@ -1490,34 +1935,45 @@ def traverse_CommandLineTool( step, etool_id, outp_id ) self_type = cwl.WorkflowInputParameter( - id=None, + id="", type_=cwl.InputArraySchema("File", "array", None, None), ) + if isinstance(outp, cwl.CommandOutputParameter): + target = parameter_to_workflow_input_paramater(outp) + else: + target = outp etool = generate_etool_from_expr( - expression, outp, False, self_type, [clt, step, parent] + expression, target, False, self_type, [clt, step, parent] ) if outp.outputBinding.loadContents: - etool.inputs[0].type_.inputBinding = cwl.CommandLineBinding( + etool.inputs[0].inputBinding = cwl.CommandLineBinding( loadContents=True ) - etool.inputs.extend(cltool_inputs_to_etool_inputs(clt)) - sub_wf_inputs = cltool_inputs_to_etool_inputs(clt) + etool.inputs = list(etool.inputs) + process_inputs_to_etool_inputs( + clt + ) + sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - orig_step_input.id = orig_step_input.id.split("/")[-1] - if isinstance(orig_step_input.source, MutableSequence): + if isinstance(orig_step_input.source, Sequence): + new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): - orig_step_input.source[index] = source.split("#")[-1] + new_orig_step_input_source[index] = source.split("#")[ + -1 + ] + orig_step_input.source = new_orig_step_input_source + elif orig_step_input.source is None: + continue else: orig_step_input.source = orig_step_input.source.split("#")[ -1 ] - orig_step_inputs[:] = [ + orig_step_inputs = [ x for x in orig_step_inputs if not x.id.startswith("_") ] - for inp in orig_step_inputs: - inp.source = inp.id - inp.linkMerge = None + for wsi in orig_step_inputs: + wsi.source = wsi.id + wsi.linkMerge = None if replace_etool: processes = [parent] final_etool: cwl.CommandLineTool | cwl.ExpressionTool = ( @@ -1536,8 +1992,8 @@ def traverse_CommandLineTool( step ) # a deepcopy would be convenient, but params2.cwl gives it problems new_clt_step.id = new_clt_step.id.split("#")[-1] - new_clt_step.run = copy.copy(step.run) - new_clt_step.run.id = None + new_clt_step.run = copy.copy(target_clt) + new_clt_step.run.id = "" remove_JSReq(new_clt_step.run, skip_command_line1) for new_outp in new_clt_step.run.outputs: if new_outp.id.split("#")[-1] == outp_id: @@ -1565,12 +2021,17 @@ def traverse_CommandLineTool( type(new_outp), ) new_clt_step.in_ = copy.deepcopy(step.in_) - for inp in new_clt_step.in_: - inp.id = inp.id.split("/")[-1] - inp.source = inp.id - inp.linkMerge = None - for index, out in enumerate(new_clt_step.out): - new_clt_step.out[index] = out.split("/")[-1] + for wsi2 in new_clt_step.in_: + wsi2.id = wsi2.id.split("/")[-1] + wsi2.source = wsi2.id + wsi2.linkMerge = None + new_clt_step_out = list(new_clt_step.out) + for index, out in enumerate(new_clt_step_out): + if isinstance(out, str): + new_clt_step_out[index] = out.split("/")[-1] + else: + out.id = out.id.split("/")[-1] + new_clt_step.out = new_clt_step_out for tool_inp in new_clt_step.run.inputs: tool_inp.id = tool_inp.id.split("#")[-1] for tool_out in new_clt_step.run.outputs: @@ -1601,24 +2062,33 @@ def traverse_CommandLineTool( if isinstance(req, cwl.SubworkflowFeatureRequirement): has_sub_wf_req = True if not has_sub_wf_req: - parent.requirements.append( - cwl.SubworkflowFeatureRequirement() - ) + new_parent_reqs = list(parent.requirements) + new_parent_reqs.append(cwl.SubworkflowFeatureRequirement()) + parent.requirements = new_parent_reqs return modified def rename_step_source(workflow: cwl.Workflow, old: str, new: str) -> None: """Update step source names to the new name.""" - def simplify_wf_id(uri: str) -> str: - return uri.split("#")[-1].split("/", 1)[1] + def simplify_wf_ids(uris: Sequence[str] | str | None) -> set[str]: + if isinstance(uris, str): + uri_seq: Sequence[str] = [uris] + elif uris is None: + return set() + else: + uri_seq = uris + return {uri.split("#")[-1].split("/", 1)[1] for uri in uri_seq} def simplify_step_id(uri: str) -> str: return uri.split("#")[-1] for wf_outp in workflow.outputs: - if wf_outp.outputSource and simplify_wf_id(wf_outp.outputSource) == old: - wf_outp.outputSource = new + simplified_wf_ids = simplify_wf_ids(wf_outp.outputSource) + if wf_outp.outputSource and old in simplified_wf_ids: + simplified_wf_ids.remove(old) + simplified_wf_ids.add(new) + wf_outp.outputSource = list(simplified_wf_ids) for step in workflow.steps: if step.in_: for inp in step.in_: @@ -1634,7 +2104,9 @@ def simplify_step_id(uri: str) -> str: else: for index, source in enumerate(inp.source): if simplify_step_id(source) == old: - inp.source[index] = new + new_inp_source = list(inp.source) + new_inp_source[index] = new + inp.source = new_inp_source def remove_JSReq( @@ -1645,7 +2117,7 @@ def remove_JSReq( if skip_command_line1 and isinstance(process, cwl.CommandLineTool): return if process.hints: - process.hints[:] = [ + process.hints = [ hint for hint in process.hints if not isinstance(hint, cwl.InlineJavascriptRequirement) @@ -1653,7 +2125,7 @@ def remove_JSReq( if not process.hints: process.hints = None if process.requirements: - process.requirements[:] = [ + process.requirements = [ req for req in process.requirements if not isinstance(req, cwl.InlineJavascriptRequirement) @@ -1666,13 +2138,14 @@ def replace_step_clt_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, - target: cwl.WorkflowInputParameter, + target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, replace_etool: bool, self_name: str | None = None, ) -> None: """Convert a step level CWL Expression to a sibling expression step.""" - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1686,8 +2159,9 @@ def replace_step_clt_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1695,9 +2169,10 @@ def replace_step_clt_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps -def replace_clt_hintreq_expr_with_etool( +def replace_step_process_hintreq_expr_with_etool( expr: str, name: str, workflow: cwl.Workflow, @@ -1708,7 +2183,8 @@ def replace_clt_hintreq_expr_with_etool( ) -> cwl.CommandLineTool | cwl.ExpressionTool: """Factor out an expression inside a CommandLineTool req or hint into a sibling step.""" # Same as replace_step_clt_expr_with_etool or different? - etool_inputs = cltool_inputs_to_etool_inputs(step.run) + assert not isinstance(step.run, str) + etool_inputs = process_inputs_to_etool_inputs(step.run) temp_etool = generate_etool_from_expr2( expr, target, etool_inputs, self_name, step.run, [workflow] ) @@ -1722,8 +2198,9 @@ def replace_clt_hintreq_expr_with_etool( wf_step_inputs = copy.deepcopy(step.in_) for wf_step_input in wf_step_inputs: wf_step_input.id = wf_step_input.id.split("/")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if not x.id.startswith("_")] - workflow.steps.append( + wf_step_inputs = [x for x in wf_step_inputs if not x.id.startswith("_")] + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -1731,30 +2208,37 @@ def replace_clt_hintreq_expr_with_etool( run=etool, ) ) + workflow.steps = new_steps return etool -def cltool_inputs_to_etool_inputs( - tool: cwl.CommandLineTool, +def process_inputs_to_etool_inputs( + tool: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Workflow + | cwl.Operation + ), ) -> list[cwl.WorkflowInputParameter]: - """Copy CommandLineTool input objects into the equivalent ExpressionTool input objects.""" - inputs = yaml.comments.CommentedSeq() + """Copy Process input parameters to matching ExpressionTool versions.""" + inputs = [] if tool.inputs: - for clt_inp in tool.inputs: - clt_inp_id = clt_inp.id.split("#")[-1].split("/")[-1] - if not clt_inp_id.startswith("_"): + for process_inp in tool.inputs: + process_inp_id = process_inp.id.split("#")[-1].split("/")[-1] + if not process_inp_id.startswith("_"): inputs.append( cwl.WorkflowInputParameter( - id=clt_inp_id, - label=clt_inp.label, - secondaryFiles=clt_inp.secondaryFiles, - streamable=clt_inp.streamable, - doc=clt_inp.doc, - format=clt_inp.format, - default=clt_inp.default, - type_=clt_inp.type_, - extension_fields=clt_inp.extension_fields, - loadingOptions=clt_inp.loadingOptions, + id=process_inp_id, + label=process_inp.label, + secondaryFiles=process_inp.secondaryFiles, + streamable=process_inp.streamable, + doc=process_inp.doc, + format=process_inp.format, + default=process_inp.default, + type_=process_inp.type_, + extension_fields=process_inp.extension_fields, + loadingOptions=process_inp.loadingOptions, ) ) return inputs @@ -1762,17 +2246,18 @@ def cltool_inputs_to_etool_inputs( def cltool_step_outputs_to_workflow_outputs( cltool_step: cwl.WorkflowStep, etool_step_id: str, etool_out_id: str -) -> list[cwl.OutputParameter]: +) -> list[cwl.WorkflowOutputParameter]: """ Copy CommandLineTool outputs into the equivalent Workflow output parameters. Connects the outputSources for each of the new output parameters to the step they came from. """ - outputs = yaml.comments.CommentedSeq() + outputs: list[cwl.WorkflowOutputParameter] = [] if not cltool_step.id: raise WorkflowException(f"Missing step id from {cltool_step}.") default_step_id = cltool_step.id.split("#")[-1] + assert not isinstance(cltool_step.run, str) if cltool_step.run.outputs: for clt_out in cltool_step.run.outputs: clt_out_id = clt_out.id.split("#")[-1].split("/")[-1] @@ -1800,14 +2285,21 @@ def cltool_step_outputs_to_workflow_outputs( def generate_etool_from_expr2( expr: str, - target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, + target: cwl.WorkflowInputParameter | cwl.CommandInputParameter, inputs: Sequence[ cwl.WorkflowInputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], self_name: str | None = None, - process: cwl.CommandLineTool | cwl.ExpressionTool | None = None, + process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.ProcessGenerator + | cwl.Operation + | None + ) = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -1821,8 +2313,8 @@ def generate_etool_from_expr2( secondaryFiles=target.secondaryFiles, streamable=target.streamable, doc=target.doc, - format=target.format, - type_=target.type_, + format=target.format[0] if target.format else None, + type_=plain_input_schema_to_plain_output_schema(target.type_), ) ) expression = "${" @@ -1837,19 +2329,49 @@ def generate_etool_from_expr2( ) hints = None procs: list[ - cwl.CommandLineTool | cwl.ExpressionTool | cwl.Workflow | cwl.WorkflowStep + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.Workflow + | cwl.WorkflowStep + | cwl.ProcessGenerator + | cwl.Operation ] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs = [inlineJSReq] + reqs: MutableSequence[ + cwl.CUDARequirement + | cwl.DockerRequirement + | cwl.EnvVarRequirement + | cwl.InitialWorkDirRequirement + | cwl.InlineJavascriptRequirement + | cwl.InplaceUpdateRequirement + | cwl.LoadListingRequirement + | cwl.Loop + | cwl.MPIRequirement + | cwl.MultipleInputFeatureRequirement + | cwl.NetworkAccess + | cwl.ResourceRequirement + | cwl.ScatterFeatureRequirement + | cwl.SchemaDefRequirement + | cwl.Secrets + | cwl.ShellCommandRequirement + | cwl.ShmSize + | cwl.SoftwareRequirement + | cwl.StepInputExpressionRequirement + | cwl.SubworkflowFeatureRequirement + | cwl.ToolTimeLimit + | cwl.WorkReuse + ] = [inlineJSReq] if process: if process.hints: hints = copy.deepcopy(process.hints) - hints[:] = [ - x for x in hints if not isinstance(x, cwl.InitialWorkDirRequirement) + hints = [ + x + for x in copy.deepcopy(hints) + if not isinstance(x, cwl.InitialWorkDirRequirement) ] if process.requirements: reqs.extend(copy.deepcopy(process.requirements)) @@ -1858,7 +2380,7 @@ def generate_etool_from_expr2( ] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), - inputs=inputs, + inputs=parameters_to_workflow_input_paramaters(inputs), outputs=outputs, expression=expression, requirements=reqs, @@ -1880,43 +2402,29 @@ def traverse_step( return False step_id = step.id.split("#")[-1] original_process = copy.deepcopy(step.run) + assert not isinstance(original_process, str) + assert not isinstance(step.run, str) original_step_ins = copy.deepcopy(step.in_) for inp in step.in_: if inp.valueFrom: if not inp.source: self = None else: - if isinstance(inp.source, MutableSequence): - self = [] - for source in inp.source: - if not step.scatter: - self.append( - example_input( - utils.type_for_source(parent, source.split("#")[-1]) - ) - ) - else: - scattered_source_type = utils.type_for_source( - parent, source - ) - if isinstance(scattered_source_type, list): - for stype in scattered_source_type: - self.append(example_input(stype.type_)) - else: - self.append(example_input(scattered_source_type.type_)) - else: + self = [] + for source in inp.source: if not step.scatter: - self = example_input( - utils.type_for_source(parent, inp.source.split("#")[-1]) + self.append( + example_input( + utils.type_for_source(parent, source.split("#")[-1]) + ) ) else: - scattered_source_type2 = utils.type_for_source( - parent, inp.source - ) - if isinstance(scattered_source_type2, list): - self = example_input(scattered_source_type2[0].type_) + scattered_source_type = utils.type_for_source(parent, source) + if isinstance(scattered_source_type, Sequence): + for stype in scattered_source_type: + self.append(example_input(stype.type_)) else: - self = example_input(scattered_source_type2.type_) + self.append(example_input(scattered_source_type.type_)) expression = get_expression(inp.valueFrom, inputs, self) if expression: modified = True @@ -1925,42 +2433,32 @@ def traverse_step( if not target: raise WorkflowException("target not found") input_source_id = None - source_type: None | ( - MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.WorkflowInputParameter + source_type: ( + None + | MutableSequence[ + cwl.WorkflowInputParameter | cwl.CommandOutputParameter ] - | cwl.CommandInputParameter - | cwl.CommandOutputParameter | cwl.WorkflowInputParameter + | cwl.CommandOutputParameter ) = None if inp.source: - if isinstance(inp.source, MutableSequence): - input_source_id = [] - source_types: list[cwl.WorkflowInputParameter] = [] - for source in inp.source: - source_id = source.split("#")[-1] - input_source_id.append(source_id) - temp_type = utils.type_for_source( - step.run, source_id, parent - ) - if isinstance(temp_type, list): - for ttype in temp_type: - if ttype not in source_types: - source_types.append(ttype) - else: - if temp_type not in source_types: - source_types.append(temp_type) - source_type = cwl.WorkflowInputParameter( - id=None, - type_=cwl.ArraySchema(source_types, "array"), - ) - else: - input_source_id = inp.source.split("#")[-1] - source_type = utils.param_for_source_id( - step.run, input_source_id, parent - ) + input_source_id = [] + source_types: list[BasicInputTypeSchemas] = [] + for source in inp.source: + source_id = source.split("#")[-1] + input_source_id.append(source_id) + temp_type = utils.type_for_source(step.run, source_id, parent) + if isinstance(temp_type, Sequence): + for ttype in temp_type: + if ttype not in source_types: + source_types.append(ttype) + else: + if temp_type not in source_types: + source_types.append(temp_type) + source_type = cwl.WorkflowInputParameter( + id="", + type_=cwl.InputArraySchema(source_types, "array"), + ) # target.id = target.id.split('#')[-1] if isinstance(original_process, cwl.ExpressionTool): found_JSReq = False @@ -1976,9 +2474,11 @@ def traverse_step( if not step.run.requirements: step.run.requirements = [] expr_lib = find_expressionLib([parent]) - step.run.requirements.append( + new_step_run_requirements = list(step.run.requirements) + new_step_run_requirements.append( cwl.InlineJavascriptRequirement(expr_lib) ) + step.run.requirements = new_step_run_requirements replace_step_valueFrom_expr_with_etool( expression, etool_id, @@ -1994,15 +2494,8 @@ def traverse_step( ) inp.valueFrom = None inp.source = f"{etool_id}/result" - if step.when: - expression = get_expression(string=step.when, inputs=inputs, self=None) - if expression: - modified = True - replace_step_when_expr_with_etool( - expression, parent, step, original_step_ins, replace_etool - ) - # TODO: skip or special process for sub workflows? + assert not isinstance(original_process, str) process_modified = process_level_reqs( original_process, step, @@ -2028,29 +2521,35 @@ def traverse_step( def workflow_step_to_WorkflowInputParameters( - step_ins: list[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str -) -> MutableSequence[ - cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter -]: + step_ins: Sequence[cwl.WorkflowStepInput], parent: cwl.Workflow, except_in_id: str +) -> list[cwl.WorkflowInputParameter]: """Create WorkflowInputParameters to match the given WorkflowStep inputs.""" - params = [] + params: list[cwl.WorkflowInputParameter] = [] for inp in step_ins: - if not inp.id: - continue inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, MutableSequence): + if isinstance(param, Sequence): for p in param: - p.id = inp_id - p.type_ = clean_type_ids(p.type_) - params.append(p) + if not p.type_: + raise WorkflowException( + f"Don't know how to get type id for {p!r}." + ) + new_param = parameter_to_workflow_input_paramater(p) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) else: - param.id = inp_id - param.type_ = clean_type_ids(param.type_) - params.append(param) + if not param.type_: + raise WorkflowException( + f"Don't know how to get type id for {param!r}." + ) + new_param = parameter_to_workflow_input_paramater(param) + new_param.id = inp_id + new_param.type_ = clean_type_ids(new_param.type_) + params.append(new_param) return params @@ -2061,15 +2560,21 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: cwl.CommandLineTool | cwl.ExpressionTool, - original_step_ins: list[cwl.WorkflowStepInput], + original_process: ( + cwl.CommandLineTool + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Workflow + | cwl.Operation + ), + original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, source_type: None | ( cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter - | MutableSequence[ + | Sequence[ cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.WorkflowInputParameter @@ -2106,22 +2611,19 @@ def replace_step_valueFrom_expr_with_etool( etool: cwl.ExpressionTool | cwl.CommandLineTool = cltool else: etool = temp_etool - wf_step_inputs = copy.deepcopy(original_step_ins) + wf_step_inputs = list(original_step_ins) if source: wf_step_inputs.append(cwl.WorkflowStepInput(id="self", source=step_inp.source)) for wf_step_input in wf_step_inputs: - if not wf_step_input.id: - continue wf_step_input.id = wf_step_input.id.split("/")[-1] if wf_step_input.valueFrom: wf_step_input.valueFrom = None if wf_step_input.source: - if isinstance(wf_step_input.source, MutableSequence): - for index, inp_source in enumerate(wf_step_input.source): - wf_step_input.source[index] = inp_source.split("#")[-1] - else: - wf_step_input.source = wf_step_input.source.split("#")[-1] - wf_step_inputs[:] = [ + new_source = list(wf_step_input.source) + for index, inp_source in enumerate(wf_step_input.source): + new_source[index] = inp_source.split("#")[-1] + wf_step_input.source = new_source + wf_step_inputs = [ x for x in wf_step_inputs if x.id and not (x.id.startswith("_") or x.id.endswith(step_inp_id)) @@ -2137,7 +2639,8 @@ def replace_step_valueFrom_expr_with_etool( # do we still need to scatter? else: scatter = None - workflow.steps.append( + new_steps = list(workflow.steps) + new_steps.append( cwl.WorkflowStep( id=name, in_=wf_step_inputs, @@ -2147,72 +2650,7 @@ def replace_step_valueFrom_expr_with_etool( scatterMethod=step.scatterMethod, ) ) - - -def replace_step_when_expr_with_etool( - expr: str, - workflow: cwl.Workflow, - step: cwl.WorkflowStep, - original_step_ins: list[cwl.WorkflowStepInput], - replace_etool: bool, -) -> None: - """Replace a WorkflowStep level 'when' expression with a sibling ExpressionTool step.""" - if not step.id: - raise WorkflowException(f"Missing id from {step}.") - etool_id = "_when_expression_{}".format(step.id.split("#")[-1]) - etool_inputs = workflow_step_to_WorkflowInputParameters( - original_step_ins, workflow, "" - ) - temp_etool = generate_etool_from_expr2( - expr, - cwl.WorkflowInputParameter(id=None, type_="boolean"), - etool_inputs, - None, - None, - [workflow, step], - ) - if replace_etool: - processes: list[ - (cwl.Workflow | cwl.CommandLineTool | cwl.ExpressionTool | cwl.WorkflowStep) - ] = [ - workflow, - step, - ] - cltool = etool_to_cltool(temp_etool, find_expressionLib(processes)) - etool: cwl.ExpressionTool | cwl.CommandLineTool = cltool - else: - etool = temp_etool - wf_step_inputs = copy.deepcopy(original_step_ins) - for wf_step_input in wf_step_inputs: - if not wf_step_input.id: - continue - wf_step_input.id = wf_step_input.id.split("/")[-1] - if wf_step_input.source: - if isinstance(wf_step_input.source, MutableSequence): - for index, inp_source in enumerate(wf_step_input.source): - wf_step_input.source[index] = inp_source.split("#")[-1] - else: - wf_step_input.source = wf_step_input.source.split("#")[-1] - wf_step_inputs[:] = [x for x in wf_step_inputs if x.id and not x.id.startswith("_")] - scatter = copy.deepcopy(step.scatter) - if isinstance(scatter, str): - scatter = [scatter] - if isinstance(scatter, MutableSequence): - for index, entry in enumerate(scatter): - scatter[index] = entry.split("/")[-1] - scatter = step.scatter - workflow.steps.append( - cwl.WorkflowStep( - id=etool_id, - in_=wf_step_inputs, - out=[cwl.WorkflowStepOutput("result")], - run=etool, - scatter=scatter, - scatterMethod=step.scatterMethod, - ) - ) - step.when = "$(inputs._when)" - step.in_.append(cwl.WorkflowStepInput(id="_when", source=f"{etool_id}/result")) + workflow.steps = new_steps def traverse_workflow( @@ -2245,7 +2683,7 @@ def traverse_workflow( if process_workflow_reqs_and_hints(workflow, replace_etool): modified = True if workflow.requirements: - workflow.requirements[:] = [ + workflow.requirements = [ x for x in workflow.requirements if not isinstance( diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 677108b5..5f299f91 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -554,8 +554,14 @@ def type_for_step_output( def type_for_source( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool + | cwl.Workflow + | cwl.ExpressionTool + | cwl.ProcessGenerator + | cwl.Operation + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, pickValue: str | None = None, @@ -614,8 +620,10 @@ def type_for_source( def param_for_source_id( - process: cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool, - sourcenames: str | list[str], + process: ( + cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator + ), + sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( From 8ffcf87a8d35e63c55d2c6c803ae8cef7a64f2ef Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sat, 20 Dec 2025 21:53:30 +0100 Subject: [PATCH 09/23] Regenerate parsers --- src/cwl_utils/parser/cwl_v1_0.py | 555 +++++++++--------- src/cwl_utils/parser/cwl_v1_1.py | 656 +++++++++++----------- src/cwl_utils/parser/cwl_v1_2.py | 742 +++++++++++++------------ src/cwl_utils/parser/cwl_v1_2_utils.py | 2 +- 4 files changed, 1018 insertions(+), 937 deletions(-) diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 406bcd7d..9f1ee3e5 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -1188,7 +1188,7 @@ def parser_info() -> str: @trait class Documented(Saveable, metaclass=ABCMeta): - pass + doc: None | Sequence[str] | str class RecordField(Documented): @@ -1456,9 +1456,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1656,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[RecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1928,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2128,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2327,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.type_: Literal["map"] = type_ + self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2526,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names - self.type_ = type_ + self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names + self.type_: Literal["union"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2725,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2992,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3192,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[CWLRecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3990,17 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.dirname: None | str = dirname + self.nameroot: None | str = nameroot + self.nameext: None | str = nameext + self.checksum: None | str = checksum + self.size: None | i32 = size + self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles + self.format: None | str = format + self.contents: None | str = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4396,10 +4396,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.listing: None | Sequence[Directory | File] = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] @@ -4408,7 +4408,7 @@ def __init__( @trait class SchemaBase(Saveable, metaclass=ABCMeta): - pass + label: None | str @trait @@ -4418,12 +4418,15 @@ class Parameter(SchemaBase, metaclass=ABCMeta): """ - pass + label: None | str + secondaryFiles: None | Sequence[str] | str + streamable: None | bool + doc: None | Sequence[str] | str @trait class InputBinding(Saveable, metaclass=ABCMeta): - pass + loadContents: None | bool @trait @@ -4433,12 +4436,12 @@ class OutputBinding(Saveable, metaclass=ABCMeta): @trait class InputSchema(SchemaBase, metaclass=ABCMeta): - pass + label: None | str @trait class OutputSchema(SchemaBase, metaclass=ABCMeta): - pass + label: None | str class InputRecordField(CWLRecordField): @@ -4813,11 +4816,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.inputBinding = inputBinding - self.label = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: CommandLineBinding | None = inputBinding + self.label: None | str = label attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "inputBinding", "label"] @@ -5139,10 +5142,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[InputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @@ -5521,11 +5524,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "inputBinding"] @@ -5839,10 +5842,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "inputBinding"] @@ -6167,10 +6170,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.outputBinding = outputBinding + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "outputBinding"] @@ -6427,9 +6430,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label + self.fields: None | Sequence[OutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label"]) @@ -6808,11 +6811,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "outputBinding"] @@ -7126,10 +7129,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "outputBinding"] @@ -7740,15 +7743,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.inputBinding = inputBinding - self.default = default - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.inputBinding: CommandLineBinding | None = inputBinding + self.default: CWLObjectType | None = default + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -8259,13 +8262,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.outputBinding = outputBinding - self.format = format + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.outputBinding: CommandOutputBinding | None = outputBinding + self.format: None | str = format attrs: ClassVar[Collection[str]] = frozenset( [ @@ -8305,7 +8308,14 @@ class Process(Saveable, metaclass=ABCMeta): """ - pass + id: None | str + inputs: Sequence[InputParameter] + outputs: Sequence[OutputParameter] + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] + label: None | str + doc: None | str + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None class InlineJavascriptRequirement(ProcessRequirement): @@ -8485,7 +8495,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.expressionLib: None | Sequence[str] = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @@ -8666,7 +8676,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types = types + self.types: Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema] = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8874,8 +8884,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.envName: str = envName + self.envValue: str = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @@ -9406,13 +9416,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote + self.loadContents: None | bool = loadContents + self.position: None | i32 = position + self.prefix: None | str = prefix + self.separate: None | bool = separate + self.itemSeparator: None | str = itemSeparator + self.valueFrom: None | str = valueFrom + self.shellQuote: None | bool = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9696,9 +9706,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.glob = glob - self.loadContents = loadContents - self.outputEval = outputEval + self.glob: None | Sequence[str] | str = glob + self.loadContents: None | bool = loadContents + self.outputEval: None | str = outputEval attrs: ClassVar[Collection[str]] = frozenset(["glob", "loadContents", "outputEval"]) @@ -10075,11 +10085,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.inputBinding = inputBinding - self.label = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: CommandLineBinding | None = inputBinding + self.label: None | str = label attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "inputBinding", "label"] @@ -10401,10 +10411,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[CommandInputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @@ -10783,11 +10793,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "inputBinding"] @@ -11101,10 +11111,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "inputBinding"] @@ -11429,10 +11439,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.outputBinding = outputBinding + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "outputBinding"] @@ -11754,10 +11764,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[CommandOutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @@ -12136,11 +12146,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "outputBinding"] @@ -12454,10 +12464,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "outputBinding"] @@ -13072,15 +13082,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.inputBinding = inputBinding - self.default = default - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.inputBinding: CommandLineBinding | None = inputBinding + self.default: CWLObjectType | None = default + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -13650,14 +13660,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.outputBinding = outputBinding - self.format = format - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.outputBinding: CommandOutputBinding | None = outputBinding + self.format: None | str = format + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | None | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14701,23 +14711,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs: Sequence[CommandInputParameter] = inputs + self.outputs: Sequence[CommandOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints + self.label: None | str = label + self.doc: None | str = doc + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = cwlVersion self.class_: Final[str] = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes + self.baseCommand: None | Sequence[str] | str = baseCommand + self.arguments: None | Sequence[CommandLineBinding | str] = arguments + self.stdin: None | str = stdin + self.stderr: None | str = stderr + self.stdout: None | str = stdout + self.successCodes: None | Sequence[i32] = successCodes + self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes + self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -15244,12 +15254,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory + self.dockerPull: None | str = dockerPull + self.dockerLoad: None | str = dockerLoad + self.dockerFile: None | str = dockerFile + self.dockerImport: None | str = dockerImport + self.dockerImageId: None | str = dockerImageId + self.dockerOutputDirectory: None | str = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -15435,7 +15445,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages + self.packages: Sequence[SoftwarePackage] = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -15689,9 +15699,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.package: str = package + self.version: None | Sequence[str] = version + self.specs: None | Sequence[str] = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -15957,9 +15967,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.entryname: None | str = entryname + self.entry: str = entry + self.writable: None | bool = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) @@ -16133,7 +16143,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing + self.listing: Sequence[Directory | Dirent | File | str] | str = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -16309,7 +16319,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef + self.envDef: Sequence[EnvironmentDef] = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -17031,14 +17041,14 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax + self.coresMin: None | i32 | str = coresMin + self.coresMax: None | i32 | str = coresMax + self.ramMin: None | i32 | str = ramMin + self.ramMax: None | i32 | str = ramMax + self.tmpdirMin: None | i32 | str = tmpdirMin + self.tmpdirMax: None | i32 | str = tmpdirMax + self.outdirMin: None | i32 | str = outdirMin + self.outdirMax: None | i32 | str = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -17604,14 +17614,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.outputBinding = outputBinding - self.format = format - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.outputBinding: CommandOutputBinding | None = outputBinding + self.format: None | str = format + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18262,16 +18272,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs: Sequence[InputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints + self.label: None | str = label + self.doc: None | str = doc + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = cwlVersion self.class_: Final[str] = "ExpressionTool" - self.expression = expression + self.expression: str = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18954,16 +18964,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.outputBinding = outputBinding - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | Sequence[str] | str = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.outputBinding: CommandOutputBinding | None = outputBinding + self.format: None | str = format + self.outputSource: None | Sequence[str] | str = outputSource + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18983,7 +18993,8 @@ def __init__( @trait class Sink(Saveable, metaclass=ABCMeta): - pass + source: None | Sequence[str] | str + linkMerge: Literal["merge_nested", "merge_flattened"] | None class WorkflowStepInput(Sink): @@ -19398,11 +19409,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.source = source - self.linkMerge = linkMerge - self.id = id - self.default = default - self.valueFrom = valueFrom + self.source: None | Sequence[str] | str = source + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.id: str = id + self.default: CWLObjectType | None = default + self.valueFrom: None | str = valueFrom attrs: ClassVar[Collection[str]] = frozenset( ["source", "linkMerge", "id", "default", "valueFrom"] @@ -19565,7 +19576,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id + self.id: str = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) @@ -20284,16 +20295,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.run = run - self.scatter = scatter - self.scatterMethod = scatterMethod + self.id: str = id + self.in_: Sequence[WorkflowStepInput] = in_ + self.out: Sequence[WorkflowStepOutput | str] = out + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any] = hints + self.label: None | str = label + self.doc: None | str = doc + self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run + self.scatter: None | Sequence[str] | str = scatter + self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -20987,16 +20998,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs: Sequence[InputParameter] = inputs + self.outputs: Sequence[WorkflowOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints + self.label: None | str = label + self.doc: None | str = doc + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = cwlVersion self.class_: Final[str] = "Workflow" - self.steps = steps + self.steps: Sequence[WorkflowStep] = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21660,7 +21671,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing = loadListing + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -21836,7 +21847,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.inplaceUpdate: bool = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -22005,7 +22016,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets = secrets + self.secrets: Sequence[str] = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -22188,7 +22199,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "TimeLimit" - self.timelimit = timelimit + self.timelimit: i32 | str = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -22376,7 +22387,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse + self.enableReuse: bool | str = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -22571,7 +22582,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess + self.networkAccess: bool | str = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -23202,16 +23213,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs: Sequence[InputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints + self.label: None | str = label + self.doc: None | str = doc + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = cwlVersion self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23404,7 +23415,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes = processes + self.processes: i32 | str = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -23765,10 +23776,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability + self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax + self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin + self.cudaVersionMin: str = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23946,7 +23957,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.shmSize: str = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index 0f4004c0..f75e9657 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -1188,7 +1188,7 @@ def parser_info() -> str: @trait class Documented(Saveable, metaclass=ABCMeta): - pass + doc: None | Sequence[str] | str class RecordField(Documented): @@ -1456,9 +1456,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1656,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[RecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1928,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2128,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2327,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.type_: Literal["map"] = type_ + self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2526,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names - self.type_ = type_ + self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names + self.type_: Literal["union"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2725,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2992,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3192,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[CWLRecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3990,17 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.dirname: None | str = dirname + self.nameroot: None | str = nameroot + self.nameext: None | str = nameext + self.checksum: None | str = checksum + self.size: None | i32 = size + self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles + self.format: None | str = format + self.contents: None | str = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4396,10 +4396,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.listing: None | Sequence[Directory | File] = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] @@ -4408,37 +4408,40 @@ def __init__( @trait class Labeled(Saveable, metaclass=ABCMeta): - pass + label: None | str @trait class Identified(Saveable, metaclass=ABCMeta): - pass + id: None | str @trait class IdentifierRequired(Identified, metaclass=ABCMeta): - pass + id: str @trait class LoadContents(Saveable, metaclass=ABCMeta): - pass + loadContents: None | bool + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None @trait class FieldBase(Labeled, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool @trait class InputFormat(Saveable, metaclass=ABCMeta): - pass + format: None | Sequence[str] | str @trait class OutputFormat(Saveable, metaclass=ABCMeta): - pass + format: None | str @trait @@ -4448,7 +4451,11 @@ class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): """ - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str class InputBinding(Saveable): @@ -4593,24 +4600,30 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents + self.loadContents: None | bool = loadContents attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) @trait class IOSchema(Labeled, Documented, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str @trait class InputSchema(IOSchema, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str @trait class OutputSchema(IOSchema, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): @@ -5221,15 +5234,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing attrs: ClassVar[Collection[str]] = frozenset( [ @@ -5615,11 +5628,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[InputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -5995,11 +6008,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -6375,11 +6388,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -6878,13 +6891,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | str = format attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] @@ -7260,11 +7273,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[OutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -7640,11 +7653,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -8020,11 +8033,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -8033,12 +8046,25 @@ def __init__( @trait class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str + format: None | Sequence[str] | str + loadContents: None | bool + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None + default: CWLObjectType | None @trait class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str + format: None | str @trait @@ -8066,7 +8092,14 @@ class Process(Identified, Labeled, Documented, metaclass=ABCMeta): """ - pass + id: None | str + label: None | str + doc: None | Sequence[str] | str + inputs: Sequence[CommandInputParameter | WorkflowInputParameter] + outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter] + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None class InlineJavascriptRequirement(ProcessRequirement): @@ -8246,7 +8279,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.expressionLib: None | Sequence[str] = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @@ -8432,7 +8465,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types = types + self.types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8632,8 +8665,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required + self.pattern: str = pattern + self.required: None | bool | str = required attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) @@ -8813,7 +8846,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing = loadListing + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9021,8 +9054,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.envName: str = envName + self.envValue: str = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @@ -9553,13 +9586,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote + self.loadContents: None | bool = loadContents + self.position: None | i32 | str = position + self.prefix: None | str = prefix + self.separate: None | bool = separate + self.itemSeparator: None | str = itemSeparator + self.valueFrom: None | str = valueFrom + self.shellQuote: None | bool = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9900,10 +9933,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.glob: None | Sequence[str] | str = glob + self.outputEval: None | str = outputEval attrs: ClassVar[Collection[str]] = frozenset( ["loadContents", "loadListing", "glob", "outputEval"] @@ -9912,7 +9945,7 @@ def __init__( @trait class CommandLineBindable(Saveable, metaclass=ABCMeta): - pass + inputBinding: CommandLineBinding | None class CommandInputRecordField(InputRecordField, CommandLineBindable): @@ -10581,16 +10614,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.inputBinding = inputBinding + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -11045,12 +11078,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding + self.fields: None | Sequence[CommandInputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name", "inputBinding"] @@ -11492,12 +11525,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc - self.inputBinding = inputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc", "inputBinding"] @@ -11934,12 +11967,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding + self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name", "inputBinding"] @@ -12496,14 +12529,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.outputBinding = outputBinding + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | str = format + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -12888,11 +12921,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[CommandOutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -13268,11 +13301,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -13648,11 +13681,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -14384,17 +14417,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14967,14 +15000,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ - self.outputBinding = outputBinding + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16018,23 +16051,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[CommandInputParameter] = inputs + self.outputs: Sequence[CommandOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = cwlVersion self.class_: Final[str] = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes + self.baseCommand: None | Sequence[str] | str = baseCommand + self.arguments: None | Sequence[CommandLineBinding | str] = arguments + self.stdin: None | str = stdin + self.stderr: None | str = stderr + self.stdout: None | str = stdout + self.successCodes: None | Sequence[i32] = successCodes + self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes + self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16579,12 +16612,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory + self.dockerPull: None | str = dockerPull + self.dockerLoad: None | str = dockerLoad + self.dockerFile: None | str = dockerFile + self.dockerImport: None | str = dockerImport + self.dockerImageId: None | str = dockerImageId + self.dockerOutputDirectory: None | str = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16770,7 +16803,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages + self.packages: Sequence[SoftwarePackage] = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17024,9 +17057,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.package: str = package + self.version: None | Sequence[str] = version + self.specs: None | Sequence[str] = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -17292,9 +17325,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.entryname: None | str = entryname + self.entry: str = entry + self.writable: None | bool = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) @@ -17468,7 +17501,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing + self.listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -17644,7 +17677,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef + self.envDef: Sequence[EnvironmentDef] = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -18366,14 +18399,14 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax + self.coresMin: None | i32 | str = coresMin + self.coresMax: None | i32 | str = coresMax + self.ramMin: None | i32 | str = ramMin + self.ramMax: None | i32 | str = ramMax + self.tmpdirMin: None | i32 | str = tmpdirMin + self.tmpdirMax: None | i32 | str = tmpdirMax + self.outdirMin: None | i32 | str = outdirMin + self.outdirMax: None | i32 | str = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18573,7 +18606,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse + self.enableReuse: bool | str = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -18768,7 +18801,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess + self.networkAccess: bool | str = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -18978,7 +19011,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.inplaceUpdate: bool = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -19164,7 +19197,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ToolTimeLimit" - self.timelimit = timelimit + self.timelimit: i32 | str = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -19661,13 +19694,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] @@ -20395,17 +20428,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: InputBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21065,16 +21098,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = cwlVersion self.class_: Final[str] = "ExpressionTool" - self.expression = expression + self.expression: str = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21701,15 +21734,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.outputSource: None | Sequence[str] | str = outputSource + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21728,7 +21761,8 @@ def __init__( @trait class Sink(Saveable, metaclass=ABCMeta): - pass + source: None | Sequence[str] | str + linkMerge: Literal["merge_nested", "merge_flattened"] | None class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): @@ -22324,14 +22358,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id - self.source = source - self.linkMerge = linkMerge - self.loadContents = loadContents - self.loadListing = loadListing - self.label = label - self.default = default - self.valueFrom = valueFrom + self.id: str = id + self.source: None | Sequence[str] | str = source + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.label: None | str = label + self.default: CWLObjectType | None = default + self.valueFrom: None | str = valueFrom attrs: ClassVar[Collection[str]] = frozenset( [ @@ -22507,7 +22541,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id + self.id: str = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) @@ -23228,16 +23262,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id - self.label = label - self.doc = doc - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.run = run - self.scatter = scatter - self.scatterMethod = scatterMethod + self.id: str = id + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.in_: Sequence[WorkflowStepInput] = in_ + self.out: Sequence[WorkflowStepOutput | str] = out + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any] = hints + self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run + self.scatter: None | Sequence[str] | str = scatter + self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23931,16 +23965,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[WorkflowOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = cwlVersion self.class_: Final[str] = "Workflow" - self.steps = steps + self.steps: Sequence[WorkflowStep] = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -24598,7 +24632,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets = secrets + self.secrets: Sequence[str] = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -25231,16 +25265,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = cwlVersion self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25433,7 +25467,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes = processes + self.processes: i32 | str = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -25794,10 +25828,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability + self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax + self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin + self.cudaVersionMin: str = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25975,7 +26009,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.shmSize: str = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index 167ed57b..34e379b2 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -1188,7 +1188,7 @@ def parser_info() -> str: @trait class Documented(Saveable, metaclass=ABCMeta): - pass + doc: None | Sequence[str] | str class RecordField(Documented): @@ -1456,9 +1456,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1656,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[RecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1928,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2128,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2327,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.type_: Literal["map"] = type_ + self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2526,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names - self.type_ = type_ + self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names + self.type_: Literal["union"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2725,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items + self.type_: Literal["array"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2992,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3192,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ + self.fields: None | Sequence[CWLRecordField] = fields + self.type_: Literal["record"] = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3990,17 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.dirname: None | str = dirname + self.nameroot: None | str = nameroot + self.nameext: None | str = nameext + self.checksum: None | str = checksum + self.size: None | i32 = size + self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles + self.format: None | str = format + self.contents: None | str = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4396,10 +4396,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing + self.location: None | str = location + self.path: None | str = path + self.basename: None | str = basename + self.listing: None | Sequence[Directory | File] = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] @@ -4408,37 +4408,40 @@ def __init__( @trait class Labeled(Saveable, metaclass=ABCMeta): - pass + label: None | str @trait class Identified(Saveable, metaclass=ABCMeta): - pass + id: None | str @trait class IdentifierRequired(Identified, metaclass=ABCMeta): - pass + id: str @trait class LoadContents(Saveable, metaclass=ABCMeta): - pass + loadContents: None | bool + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None @trait class FieldBase(Labeled, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool @trait class InputFormat(Saveable, metaclass=ABCMeta): - pass + format: None | Sequence[str] | str @trait class OutputFormat(Saveable, metaclass=ABCMeta): - pass + format: None | str @trait @@ -4448,7 +4451,11 @@ class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): """ - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str class InputBinding(Saveable): @@ -4593,24 +4600,30 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents + self.loadContents: None | bool = loadContents attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) @trait class IOSchema(Labeled, Documented, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str @trait class InputSchema(IOSchema, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str @trait class OutputSchema(IOSchema, metaclass=ABCMeta): - pass + label: None | str + doc: None | Sequence[str] | str + name: None | str class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): @@ -5221,15 +5234,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing attrs: ClassVar[Collection[str]] = frozenset( [ @@ -5615,11 +5628,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[InputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -5995,11 +6008,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -6375,11 +6388,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -6878,13 +6891,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | str = format attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] @@ -7260,11 +7273,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[OutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -7640,11 +7653,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -8020,11 +8033,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -8033,12 +8046,25 @@ def __init__( @trait class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str + format: None | Sequence[str] | str + loadContents: None | bool + loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None + default: CWLObjectType | None @trait class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): - pass + label: None | str + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] + streamable: None | bool + doc: None | Sequence[str] | str + id: str + format: None | str @trait @@ -8066,7 +8092,15 @@ class Process(Identified, Labeled, Documented, metaclass=ABCMeta): """ - pass + id: None | str + label: None | str + doc: None | Sequence[str] | str + inputs: Sequence[CommandInputParameter | OperationInputParameter | WorkflowInputParameter] + outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter] + requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] + hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] + cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None + intent: None | Sequence[str] class InlineJavascriptRequirement(ProcessRequirement): @@ -8246,7 +8280,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.expressionLib: None | Sequence[str] = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @@ -8437,7 +8471,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types = types + self.types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8654,8 +8688,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required + self.pattern: str = pattern + self.required: None | bool | str = required attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) @@ -8835,7 +8869,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing = loadListing + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9043,8 +9077,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.envName: str = envName + self.envValue: str = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @@ -9575,13 +9609,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote + self.loadContents: None | bool = loadContents + self.position: None | i32 | str = position + self.prefix: None | str = prefix + self.separate: None | bool = separate + self.itemSeparator: None | str = itemSeparator + self.valueFrom: None | str = valueFrom + self.shellQuote: None | bool = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9922,10 +9956,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.glob: None | Sequence[str] | str = glob + self.outputEval: None | str = outputEval attrs: ClassVar[Collection[str]] = frozenset( ["loadContents", "loadListing", "glob", "outputEval"] @@ -9934,7 +9968,7 @@ def __init__( @trait class CommandLineBindable(Saveable, metaclass=ABCMeta): - pass + inputBinding: CommandLineBinding | None class CommandInputRecordField(InputRecordField, CommandLineBindable): @@ -10603,16 +10637,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.inputBinding = inputBinding + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -11067,12 +11101,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding + self.fields: None | Sequence[CommandInputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name", "inputBinding"] @@ -11514,12 +11548,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc - self.inputBinding = inputBinding + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc", "inputBinding"] @@ -11956,12 +11990,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding + self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name", "inputBinding"] @@ -12518,14 +12552,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.outputBinding = outputBinding + self.doc: None | Sequence[str] | str = doc + self.name: str = name + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.format: None | str = format + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -12910,11 +12944,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields: None | Sequence[CommandOutputRecordField] = fields + self.type_: Literal["record"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -13290,11 +13324,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols: Sequence[str] = symbols + self.type_: Literal["enum"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -13670,11 +13704,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items + self.type_: Literal["array"] = type_ + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] @@ -14406,17 +14440,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: CommandLineBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14989,14 +15023,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ - self.outputBinding = outputBinding + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.outputBinding: CommandOutputBinding | None = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16094,24 +16128,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[CommandInputParameter] = inputs + self.outputs: Sequence[CommandOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes + self.baseCommand: None | Sequence[str] | str = baseCommand + self.arguments: None | Sequence[CommandLineBinding | str] = arguments + self.stdin: None | str = stdin + self.stderr: None | str = stderr + self.stdout: None | str = stdout + self.successCodes: None | Sequence[i32] = successCodes + self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes + self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16657,12 +16691,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory + self.dockerPull: None | str = dockerPull + self.dockerLoad: None | str = dockerLoad + self.dockerFile: None | str = dockerFile + self.dockerImport: None | str = dockerImport + self.dockerImageId: None | str = dockerImageId + self.dockerOutputDirectory: None | str = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16848,7 +16882,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages + self.packages: Sequence[SoftwarePackage] = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17102,9 +17136,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.package: str = package + self.version: None | Sequence[str] = version + self.specs: None | Sequence[str] = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -17374,9 +17408,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.entryname: None | str = entryname + self.entry: str = entry + self.writable: None | bool = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) @@ -17551,7 +17585,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing + self.listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @@ -17727,7 +17761,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef + self.envDef: Sequence[EnvironmentDef] = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @@ -18454,14 +18488,14 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax + self.coresMin: None | float | i32 | str = coresMin + self.coresMax: None | float | i32 | str = coresMax + self.ramMin: None | float | i32 | str = ramMin + self.ramMax: None | float | i32 | str = ramMax + self.tmpdirMin: None | float | i32 | str = tmpdirMin + self.tmpdirMax: None | float | i32 | str = tmpdirMax + self.outdirMin: None | float | i32 | str = outdirMin + self.outdirMax: None | float | i32 | str = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18661,7 +18695,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse + self.enableReuse: bool | str = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @@ -18856,7 +18890,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess + self.networkAccess: bool | str = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @@ -19066,7 +19100,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.inplaceUpdate: bool = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @@ -19252,7 +19286,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ToolTimeLimit" - self.timelimit = timelimit + self.timelimit: i32 | str = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @@ -19749,13 +19783,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] @@ -20483,17 +20517,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.inputBinding: InputBinding | None = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21207,17 +21241,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "ExpressionTool" - self.expression = expression + self.expression: str = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21903,16 +21937,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.pickValue = pickValue - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.outputSource: None | Sequence[str] | str = outputSource + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21932,7 +21966,9 @@ def __init__( @trait class Sink(Saveable, metaclass=ABCMeta): - pass + source: None | Sequence[str] | str + linkMerge: Literal["merge_nested", "merge_flattened"] | None + pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): @@ -22648,15 +22684,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id - self.source = source - self.linkMerge = linkMerge - self.pickValue = pickValue - self.loadContents = loadContents - self.loadListing = loadListing - self.label = label - self.default = default - self.valueFrom = valueFrom + self.id: str = id + self.source: None | Sequence[str] | str = source + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.label: None | str = label + self.default: CWLObjectType | None = default + self.valueFrom: None | str = valueFrom attrs: ClassVar[Collection[str]] = frozenset( [ @@ -22833,7 +22869,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id + self.id: str = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) @@ -23633,17 +23669,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id - self.label = label - self.doc = doc - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.run = run - self.when = when - self.scatter = scatter - self.scatterMethod = scatterMethod + self.id: str = id + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.in_: Sequence[WorkflowStepInput] = in_ + self.out: Sequence[WorkflowStepOutput | str] = out + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any] = hints + self.run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str = run + self.when: None | str = when + self.scatter: None | Sequence[str] | str = scatter + self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -24398,17 +24434,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[WorkflowOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "Workflow" - self.steps = steps + self.steps: Sequence[WorkflowStep] = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25571,16 +25607,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | Sequence[str] | str = format + self.loadContents: None | bool = loadContents + self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.default: CWLObjectType | None = default + self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -26095,13 +26131,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ + self.label: None | str = label + self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles + self.streamable: None | bool = streamable + self.doc: None | Sequence[str] | str = doc + self.id: str = id + self.format: None | str = format + self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] @@ -26744,15 +26780,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[OperationInputParameter] = inputs + self.outputs: Sequence[OperationOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "Operation" attrs: ClassVar[Collection[str]] = frozenset( @@ -26935,7 +26971,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets = secrets + self.secrets: Sequence[str] = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) @@ -27622,17 +27658,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label: None | str = label + self.doc: None | Sequence[str] | str = doc + self.inputs: Sequence[WorkflowInputParameter] = inputs + self.outputs: Sequence[ExpressionToolOutputParameter] = outputs + self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements + self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints + self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.intent: None | Sequence[str] = intent self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -27826,7 +27862,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes = processes + self.processes: i32 | str = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) @@ -28187,10 +28223,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability + self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax + self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin + self.cudaVersionMin: str = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -28633,12 +28669,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.default = default - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.linkMerge = linkMerge - self.loopSource = loopSource - self.pickValue = pickValue - self.valueFrom = valueFrom + self.default: Any | None = default + self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge + self.loopSource: None | Sequence[str] | str = loopSource + self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue + self.valueFrom: None | str = valueFrom attrs: ClassVar[Collection[str]] = frozenset( ["default", "id", "linkMerge", "loopSource", "pickValue", "valueFrom"] @@ -28942,9 +28978,9 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Loop" - self.loop = loop - self.loopWhen = loopWhen - self.outputMethod = outputMethod + self.loop: Sequence[LoopInput] = loop + self.loopWhen: str = loopWhen + self.outputMethod: Literal["last", "all"] = outputMethod attrs: ClassVar[Collection[str]] = frozenset( ["class", "loop", "loopWhen", "outputMethod"] @@ -29116,7 +29152,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.shmSize: str = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 5f299f91..41f148f7 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -299,7 +299,7 @@ def check_all_types( items=src_typ, type_="array" ) else: - linkMerge: str | None = sink.linkMerge or ( + linkMerge = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) if sink.pickValue in ("first_non_null", "the_only_non_null"): From 6cd4aa04209e09ec58a7ec33907c5194ea0b294d Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 21 Dec 2025 11:31:15 +0100 Subject: [PATCH 10/23] expression-refactor: fix detection of non-string Sequences --- src/cwl_utils/cwl_v1_0_expression_refactor.py | 45 ++++++-------- src/cwl_utils/cwl_v1_1_expression_refactor.py | 45 ++++++-------- src/cwl_utils/cwl_v1_2_expression_refactor.py | 62 +++++++++---------- src/cwl_utils/types.py | 10 ++- 4 files changed, 76 insertions(+), 86 deletions(-) diff --git a/src/cwl_utils/cwl_v1_0_expression_refactor.py b/src/cwl_utils/cwl_v1_0_expression_refactor.py index 81692534..a3dd1002 100755 --- a/src/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_0_expression_refactor.py @@ -26,6 +26,7 @@ CWLParameterContext, CWLRuntimeParameterContext, is_file_or_directory, + is_sequence, ) @@ -145,7 +146,7 @@ def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: if isinstance(cwltype, cwl.ArraySchema): - if isinstance(cwltype.items, Sequence): + if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] @@ -174,7 +175,7 @@ def clean_type_ids( ) -> AnyTypeSchema: """Simplify type identifiers.""" result = copy.deepcopy(cwltype) - if isinstance(result, Sequence): + if is_sequence(result): for item in result: _clean_type_ids(item) else: @@ -191,7 +192,7 @@ def _has_expression(string: str) -> bool: def has_expression(field: str | Sequence[str]) -> bool: - if isinstance(field, Sequence): + if is_sequence(field): for entry in field: if _has_expression(entry): return True @@ -285,7 +286,7 @@ def _plain_input_schema_to_clt_input_schema( def plain_input_schema_to_clt_input_schema( input_type: InputTypeSchemas, ) -> CommandInputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_clt_input_schema(input_type_item) for input_type_item in input_type @@ -325,7 +326,7 @@ def _plain_input_schema_to_plain_output_schema( def plain_input_schema_to_plain_output_schema( input_type: InputTypeSchemas, ) -> OutputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_plain_output_schema(input_type_item) for input_type_item in input_type @@ -365,7 +366,7 @@ def _plain_output_type_to_clt_output_type( def plain_output_type_to_clt_output_type( output_type: OutputTypeSchemas, ) -> CommandOutputTypeSchemas: - if isinstance(output_type, Sequence): + if is_sequence(output_type): return [ _plain_output_type_to_clt_output_type(output_type_item) for output_type_item in output_type @@ -606,11 +607,11 @@ def generate_etool_from_expr( self_type = target assert self_type is not None new_type: InputTypeSchemas - if isinstance(self_type, Sequence): + if is_sequence(self_type): new_type_list: MutableSequence[BasicInputTypeSchemas] = [] for entry in self_type: clean_type = clean_type_ids(entry.type_) - if isinstance(clean_type, Sequence): + if is_sequence(clean_type): new_type_list.extend(clean_type) elif clean_type is None: pass @@ -622,27 +623,21 @@ def generate_etool_from_expr( inputs.append( cwl.InputParameter( id="self", - label=self_type.label if not isinstance(self_type, list) else None, + label=self_type.label if not is_sequence(self_type) else None, secondaryFiles=( - self_type.secondaryFiles - if not isinstance(self_type, list) - else None + self_type.secondaryFiles if not is_sequence(self_type) else None ), streamable=( - self_type.streamable if not isinstance(self_type, list) else None + self_type.streamable if not is_sequence(self_type) else None ), - doc=self_type.doc if not isinstance(self_type, list) else None, - format=self_type.format if not isinstance(self_type, list) else None, + doc=self_type.doc if not is_sequence(self_type) else None, + format=(self_type.format if not is_sequence(self_type) else None), type_=new_type, extension_fields=( - self_type.extension_fields - if not isinstance(self_type, list) - else None + self_type.extension_fields if not is_sequence(self_type) else None ), loadingOptions=( - self_type.loadingOptions - if not isinstance(self_type, list) - else None + self_type.loadingOptions if not is_sequence(self_type) else None ), ) ) @@ -1783,7 +1778,7 @@ def traverse_CommandLineTool( sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - if isinstance(orig_step_input.source, Sequence): + if is_sequence(orig_step_input.source): new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): new_orig_step_input_source[index] = source.split("#")[ @@ -2239,7 +2234,7 @@ def traverse_step( ) else: scattered_source_type = utils.type_for_source(parent, source) - if isinstance(scattered_source_type, list): + if is_sequence(scattered_source_type): for stype in scattered_source_type: self.append(example_input(stype.type_)) else: @@ -2265,7 +2260,7 @@ def traverse_step( source_id = source.split("#")[-1] input_source_id.append(source_id) temp_type = utils.type_for_source(step.run, source_id, parent) - if isinstance(temp_type, list): + if is_sequence(temp_type): for ttype in temp_type: if ttype not in source_types: source_types.append(ttype) @@ -2348,7 +2343,7 @@ def workflow_step_to_InputParameters( param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, Sequence): + if is_sequence(param): for p in param: if not p.type_: raise WorkflowException( diff --git a/src/cwl_utils/cwl_v1_1_expression_refactor.py b/src/cwl_utils/cwl_v1_1_expression_refactor.py index 40b19923..4a5104e1 100755 --- a/src/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_1_expression_refactor.py @@ -26,6 +26,7 @@ CWLParameterContext, CWLRuntimeParameterContext, is_file_or_directory, + is_sequence, ) @@ -147,7 +148,7 @@ def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: if isinstance(cwltype, cwl.ArraySchema): - if isinstance(cwltype.items, Sequence): + if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] @@ -176,7 +177,7 @@ def clean_type_ids( ) -> AnyTypeSchema: """Simplify type identifiers.""" result = copy.deepcopy(cwltype) - if isinstance(result, Sequence): + if is_sequence(result): for item in result: _clean_type_ids(item) else: @@ -193,7 +194,7 @@ def _has_expression(string: str) -> bool: def has_expression(field: str | Sequence[str]) -> bool: - if isinstance(field, Sequence): + if is_sequence(field): for entry in field: if _has_expression(entry): return True @@ -287,7 +288,7 @@ def _plain_input_schema_to_clt_input_schema( def plain_input_schema_to_clt_input_schema( input_type: InputTypeSchemas, ) -> CommandInputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_clt_input_schema(input_type_item) for input_type_item in input_type @@ -325,7 +326,7 @@ def _plain_input_schema_to_plain_output_schema( def plain_input_schema_to_plain_output_schema( input_type: InputTypeSchemas, ) -> OutputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_plain_output_schema(input_type_item) for input_type_item in input_type @@ -363,7 +364,7 @@ def _plain_output_type_to_clt_output_type( def plain_output_type_to_clt_output_type( output_type: OutputTypeSchemas, ) -> CommandOutputTypeSchemas: - if isinstance(output_type, Sequence): + if is_sequence(output_type): return [ _plain_output_type_to_clt_output_type(output_type_item) for output_type_item in output_type @@ -606,11 +607,11 @@ def generate_etool_from_expr( self_type = target assert self_type is not None new_type: InputTypeSchemas - if isinstance(self_type, Sequence): + if is_sequence(self_type): new_type_list: MutableSequence[BasicInputTypeSchemas] = [] for entry in self_type: clean_type = clean_type_ids(entry.type_) - if isinstance(clean_type, Sequence): + if is_sequence(clean_type): new_type_list.extend(clean_type) elif clean_type is None: pass @@ -622,27 +623,21 @@ def generate_etool_from_expr( inputs.append( cwl.WorkflowInputParameter( id="self", - label=self_type.label if not isinstance(self_type, list) else None, + label=self_type.label if not is_sequence(self_type) else None, secondaryFiles=( - self_type.secondaryFiles - if not isinstance(self_type, list) - else None + self_type.secondaryFiles if not is_sequence(self_type) else None ), streamable=( - self_type.streamable if not isinstance(self_type, list) else None + self_type.streamable if not is_sequence(self_type) else None ), - doc=self_type.doc if not isinstance(self_type, list) else None, - format=self_type.format if not isinstance(self_type, list) else None, + doc=self_type.doc if not is_sequence(self_type) else None, + format=(self_type.format if not is_sequence(self_type) else None), type_=new_type, extension_fields=( - self_type.extension_fields - if not isinstance(self_type, list) - else None + self_type.extension_fields if not is_sequence(self_type) else None ), loadingOptions=( - self_type.loadingOptions - if not isinstance(self_type, list) - else None + self_type.loadingOptions if not is_sequence(self_type) else None ), ) ) @@ -1796,7 +1791,7 @@ def traverse_CommandLineTool( sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - if isinstance(orig_step_input.source, Sequence): + if is_sequence(orig_step_input.source): new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): new_orig_step_input_source[index] = source.split("#")[ @@ -2254,7 +2249,7 @@ def traverse_step( ) else: scattered_source_type = utils.type_for_source(parent, source) - if isinstance(scattered_source_type, list): + if is_sequence(scattered_source_type): for stype in scattered_source_type: self.append(example_input(stype.type_)) else: @@ -2282,7 +2277,7 @@ def traverse_step( source_id = source.split("#")[-1] input_source_id.append(source_id) temp_type = utils.type_for_source(step.run, source_id, parent) - if isinstance(temp_type, list): + if is_sequence(temp_type): for ttype in temp_type: if ttype not in source_types: source_types.append(ttype) @@ -2365,7 +2360,7 @@ def workflow_step_to_WorkflowInputParameters( param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, Sequence): + if is_sequence(param): for p in param: if not p.type_: raise WorkflowException( diff --git a/src/cwl_utils/cwl_v1_2_expression_refactor.py b/src/cwl_utils/cwl_v1_2_expression_refactor.py index 47709bbe..e66102bd 100755 --- a/src/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_2_expression_refactor.py @@ -26,6 +26,7 @@ CWLParameterContext, CWLRuntimeParameterContext, is_file_or_directory, + is_sequence, ) @@ -147,7 +148,7 @@ def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: if isinstance(cwltype, cwl.ArraySchema): - if isinstance(cwltype.items, Sequence): + if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] @@ -176,7 +177,7 @@ def clean_type_ids( ) -> AnyTypeSchema: """Simplify type identifiers.""" result = copy.deepcopy(cwltype) - if isinstance(result, Sequence): + if is_sequence(result): for item in result: _clean_type_ids(item) else: @@ -193,7 +194,7 @@ def _has_expression(string: str) -> bool: def has_expression(field: str | Sequence[str]) -> bool: - if isinstance(field, Sequence): + if is_sequence(field): for entry in field: if _has_expression(entry): return True @@ -287,7 +288,7 @@ def _plain_input_schema_to_clt_input_schema( def plain_input_schema_to_clt_input_schema( input_type: InputTypeSchemas, ) -> CommandInputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_clt_input_schema(input_type_item) for input_type_item in input_type @@ -325,7 +326,7 @@ def _plain_input_schema_to_plain_output_schema( def plain_input_schema_to_plain_output_schema( input_type: InputTypeSchemas, ) -> OutputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_input_schema_to_plain_output_schema(input_type_item) for input_type_item in input_type @@ -363,7 +364,7 @@ def _plain_output_schema_to_plain_input_schema( def plain_output_schema_to_plain_input_schema( input_type: OutputTypeSchemas, ) -> InputTypeSchemas: - if isinstance(input_type, Sequence): + if is_sequence(input_type): return [ _plain_output_schema_to_plain_input_schema(input_type_item) for input_type_item in input_type @@ -401,7 +402,7 @@ def _plain_output_type_to_clt_output_type( def plain_output_type_to_clt_output_type( output_type: OutputTypeSchemas, ) -> CommandOutputTypeSchemas: - if isinstance(output_type, Sequence): + if is_sequence(output_type): return [ _plain_output_type_to_clt_output_type(output_type_item) for output_type_item in output_type @@ -647,11 +648,11 @@ def generate_etool_from_expr( self_type = target assert self_type is not None new_type: InputTypeSchemas - if isinstance(self_type, Sequence): + if is_sequence(self_type): new_type_list: MutableSequence[BasicInputTypeSchemas] = [] for entry in self_type: clean_type = clean_type_ids(entry.type_) - if isinstance(clean_type, Sequence): + if is_sequence(clean_type): new_type_list.extend(clean_type) elif clean_type is None: pass @@ -663,31 +664,21 @@ def generate_etool_from_expr( inputs.append( cwl.WorkflowInputParameter( id="self", - label=self_type.label if not isinstance(self_type, Sequence) else None, + label=self_type.label if not is_sequence(self_type) else None, secondaryFiles=( - self_type.secondaryFiles - if not isinstance(self_type, Sequence) - else None + self_type.secondaryFiles if not is_sequence(self_type) else None ), streamable=( - self_type.streamable - if not isinstance(self_type, Sequence) - else None - ), - doc=self_type.doc if not isinstance(self_type, Sequence) else None, - format=( - self_type.format if not isinstance(self_type, Sequence) else None + self_type.streamable if not is_sequence(self_type) else None ), + doc=self_type.doc if not is_sequence(self_type) else None, + format=(self_type.format if not is_sequence(self_type) else None), type_=new_type, extension_fields=( - self_type.extension_fields - if not isinstance(self_type, Sequence) - else None + self_type.extension_fields if not is_sequence(self_type) else None ), loadingOptions=( - self_type.loadingOptions - if not isinstance(self_type, Sequence) - else None + self_type.loadingOptions if not is_sequence(self_type) else None ), ) ) @@ -1071,20 +1062,25 @@ def process_workflow_inputs_and_outputs( id="", type_=plain_output_schema_to_plain_input_schema(target_type) ) assert param2.outputSource is not None - if not isinstance(param2.outputSource, Sequence): + if not is_sequence(param2.outputSource): sources = param2.outputSource.split("#")[-1] else: sources = [s.split("#")[-1] for s in param2.outputSource] source_type_items = utils.type_for_source(workflow, sources) if isinstance(source_type_items, cwl.ArraySchema): - if isinstance(source_type_items.items, Sequence): + if is_sequence(source_type_items.items): if "null" not in source_type_items.items: new_source_type_items_items = list(source_type_items.items) new_source_type_items_items.append("null") source_type_items.items = new_source_type_items_items elif source_type_items.items != "null": source_type_items.items = ["null", source_type_items.items] - elif isinstance(source_type_items, Sequence): + source_type_items = cwl.CommandInputArraySchema.fromDoc( + source_type_items.save(), + source_type_items.loadingOptions.baseuri, + source_type_items.loadingOptions, + ) + elif is_sequence(source_type_items): if "null" not in source_type_items: new_source_type_items = list(source_type_items) new_source_type_items.append("null") @@ -1955,7 +1951,7 @@ def traverse_CommandLineTool( sub_wf_inputs = process_inputs_to_etool_inputs(clt) orig_step_inputs = copy.deepcopy(step.in_) for orig_step_input in orig_step_inputs: - if isinstance(orig_step_input.source, Sequence): + if is_sequence(orig_step_input.source): new_orig_step_input_source = list(orig_step_input.source) for index, source in enumerate(orig_step_input.source): new_orig_step_input_source[index] = source.split("#")[ @@ -2420,7 +2416,7 @@ def traverse_step( ) else: scattered_source_type = utils.type_for_source(parent, source) - if isinstance(scattered_source_type, Sequence): + if is_sequence(scattered_source_type): for stype in scattered_source_type: self.append(example_input(stype.type_)) else: @@ -2448,7 +2444,7 @@ def traverse_step( source_id = source.split("#")[-1] input_source_id.append(source_id) temp_type = utils.type_for_source(step.run, source_id, parent) - if isinstance(temp_type, Sequence): + if is_sequence(temp_type): for ttype in temp_type: if ttype not in source_types: source_types.append(ttype) @@ -2531,7 +2527,7 @@ def workflow_step_to_WorkflowInputParameters( param = copy.deepcopy( utils.param_for_source_id(parent, sourcenames=inp.source) ) - if isinstance(param, Sequence): + if is_sequence(param): for p in param: if not p.type_: raise WorkflowException( diff --git a/src/cwl_utils/types.py b/src/cwl_utils/types.py index 6b7b0d83..dbc291f6 100644 --- a/src/cwl_utils/types.py +++ b/src/cwl_utils/types.py @@ -3,13 +3,13 @@ """Shared Python type definitions for commons JSON like CWL objects.""" import sys -from collections.abc import Mapping, MutableMapping, MutableSequence +from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence from typing import Any, Literal, TypeAlias, TypedDict, TypeGuard if sys.version_info >= (3, 13): - from typing import TypeIs + from typing import TypeIs as TypeIs else: - from typing_extensions import TypeIs + from typing_extensions import TypeIs as TypeIs if sys.version_info >= (3, 11): from typing import Required @@ -161,3 +161,7 @@ def is_file_or_directory( value: Any, ) -> TypeIs[CWLFileType | CWLDirectoryType]: return isinstance(value, Mapping) and value.get("class") in ("File", "Directory") + + +def is_sequence(thing: object) -> TypeIs[Sequence[Any]]: + return isinstance(thing, Sequence) and not isinstance(thing, str) From 629bef3e358229c779aa42f61152c268d8155d36 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 21 Dec 2025 12:01:33 +0100 Subject: [PATCH 11/23] bandit: allow asserts --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 5212d444..31b9b921 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,3 +135,4 @@ ignore = [ [tool.bandit] exclude_dirs = ["src/cwl_utils/tests"] +skips = ["B101"] From e2edb08f5c6b5d49a386ea519e607fc7b9cbb1d6 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 21 Dec 2025 14:19:28 +0100 Subject: [PATCH 12/23] inputs_schema_gen: type fixes --- src/cwl_utils/inputs_schema_gen.py | 73 ++++++++++++++++++------------ 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/src/cwl_utils/inputs_schema_gen.py b/src/cwl_utils/inputs_schema_gen.py index ad3389e0..562c11ee 100644 --- a/src/cwl_utils/inputs_schema_gen.py +++ b/src/cwl_utils/inputs_schema_gen.py @@ -6,9 +6,11 @@ """Generate JSON Schema from CWL inputs object.""" import argparse +import hashlib import json import logging import sys +from collections.abc import Sequence from contextlib import suppress from copy import deepcopy from importlib.resources import files @@ -17,6 +19,7 @@ from urllib.parse import urlparse import requests +from schema_salad.utils import json_dumps from cwl_utils.loghandler import _logger as _cwlutilslogger from cwl_utils.parser import ( @@ -35,6 +38,7 @@ cwl_v1_2, load_document_by_uri, ) +from cwl_utils.types import is_sequence from cwl_utils.utils import ( get_value_from_uri, is_local_uri, @@ -253,7 +257,11 @@ def generate_json_schema_property_from_input_parameter( """ # Get the input name and documentation for description input_name = get_value_from_uri(str(input_parameter.id)) - doc = input_parameter.doc + doc = ( + "\n".join(input_parameter.doc) + if is_sequence(input_parameter.doc) + else input_parameter.doc + ) required = get_is_required_from_input_parameter(input_parameter) return JSONSchemaProperty( @@ -264,27 +272,27 @@ def generate_json_schema_property_from_input_parameter( ) -def generate_definition_from_schema(schema: InputRecordSchema) -> dict[str, Any]: - """ - Given a schema, generate a JSON schema definition. +def generate_definition_from_schema( + schema: InputRecordSchema | InputArraySchema | InputEnumSchema, +) -> dict[str, Any]: + """Given a schema, generate a JSON schema definition.""" + # TODO: handle InputArraySchema & InputEnumSchema (from SchemaDefRequirement.types) - :param schema: - :return: - """ # Sanitise each field of the schema sanitised_fields = {} - if schema.fields is None: - return {} + if isinstance(schema, InputRecordSchema): + if schema.fields is None: + return {} - for field in schema.fields: - sanitised_fields.update( - { - get_value_from_uri(field.name): sanitise_schema_field( - {"type": field.type_} - ) - } - ) + for field in schema.fields: + sanitised_fields.update( + { + get_value_from_uri(field.name): sanitise_schema_field( + {"type": field.type_} + ) + } + ) # Generate JSON properties property_list = [] @@ -317,8 +325,17 @@ def generate_definition_from_schema(schema: InputRecordSchema) -> dict[str, Any] ) property_list.append(prop) + if not isinstance(schema, cwl_v1_0.InputArraySchema) or hasattr(schema, "name"): + schema_name = to_pascal_case(get_value_from_uri(str(schema.name))) + else: + schema_name = ( + "AnonymousInputArraySchema" + + hashlib.sha1( # nosec + json_dumps(schema.save()).encode("utf-8") + ).hexdigest() + ) return { - to_pascal_case(get_value_from_uri(str(schema.name))): { + schema_name: { "type": "object", "properties": {prop.name: prop.type_dict for prop in property_list}, "required": [prop.name for prop in property_list if prop.required], @@ -326,7 +343,7 @@ def generate_definition_from_schema(schema: InputRecordSchema) -> dict[str, Any] } -def cwl_to_jsonschema(cwl_obj: Workflow | CommandLineTool) -> Any: +def cwl_to_jsonschema(cwl_obj: Workflow | CommandLineTool) -> dict[str, object]: """ cwl_obj: A CWL Object. @@ -387,11 +404,9 @@ def get_complex_schema_values(idx_iter: str) -> InputRecordSchema: return input_record_schema - complex_schema_values: list[InputRecordSchema] = list( - map( - get_complex_schema_values, - complex_schema_keys, - ) + complex_schema_values: map[InputRecordSchema] = map( + get_complex_schema_values, + complex_schema_keys, ) # Load in all $imports to be referred by complex input types @@ -416,11 +431,9 @@ def get_complex_schema_values(idx_iter: str) -> InputRecordSchema: ) workflow_schema_definitions_list.extend( - list( - map( - generate_definition_from_schema, - schema_def_requirement.types, - ) + map( + generate_definition_from_schema, + schema_def_requirement.types, ) ) @@ -433,7 +446,7 @@ def get_complex_schema_values(idx_iter: str) -> InputRecordSchema: properties = list( map( generate_json_schema_property_from_input_parameter, - cwl_obj.inputs, + cast(Sequence[WorkflowInputParameter], cwl_obj.inputs), ) ) From a0119d4d5724062a9644e1cb4435f20e7516766c Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sun, 21 Dec 2025 22:01:17 +0100 Subject: [PATCH 13/23] Using LoadContents in type alias --- src/cwl_utils/parser/__init__.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index 3ff92077..df29b820 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -226,16 +226,8 @@ class NoType(ABC): Dirent: TypeAlias = cwl_v1_0.Dirent | cwl_v1_1.Dirent | cwl_v1_2.Dirent """Type Union for a CWL v1.x Dirent object.""" LoadContents: TypeAlias = ( - cwl_v1_1.CommandInputParameter - | cwl_v1_2.CommandInputParameter - | cwl_v1_1.CommandOutputBinding - | cwl_v1_2.CommandOutputBinding - | cwl_v1_1.InputRecordField - | cwl_v1_2.InputRecordField - | cwl_v1_1.WorkflowInputParameter - | cwl_v1_2.WorkflowInputParameter - | cwl_v1_1.WorkflowStepInput - | cwl_v1_2.WorkflowStepInput + cwl_v1_1.LoadContents + | cwl_v1_2.LoadContents ) """Type Union for a CWL v1.x LoadContents object.""" SchemaDefRequirement: TypeAlias = ( From 4b551e91e131c7195bdca9755be84434c236104c Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sun, 21 Dec 2025 16:27:52 +0100 Subject: [PATCH 14/23] WIP --- src/cwl_utils/cwl_v1_0_expression_refactor.py | 102 +----- src/cwl_utils/cwl_v1_1_expression_refactor.py | 102 +----- src/cwl_utils/cwl_v1_2_expression_refactor.py | 100 +---- src/cwl_utils/parser/__init__.py | 65 +++- src/cwl_utils/parser/cwl_v1_0_utils.py | 331 +++++++++++++++-- src/cwl_utils/parser/cwl_v1_1_utils.py | 332 +++++++++++++++-- src/cwl_utils/parser/cwl_v1_2_utils.py | 343 ++++++++++++++++-- 7 files changed, 995 insertions(+), 380 deletions(-) diff --git a/src/cwl_utils/cwl_v1_0_expression_refactor.py b/src/cwl_utils/cwl_v1_0_expression_refactor.py index a3dd1002..4b1eeaf4 100755 --- a/src/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_0_expression_refactor.py @@ -8,7 +8,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, Literal, TypeAlias, TypeVar, cast +from typing import Any, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -18,6 +18,17 @@ import cwl_utils.parser.cwl_v1_0_utils as utils from cwl_utils.errors import JavascriptException, WorkflowException from cwl_utils.expression import do_eval, interpolate +from cwl_utils.parser.cwl_v1_0_utils import ( + AnyTypeSchema, + BasicCommandInputTypeSchemas, + BasicCommandOutputTypeSchemas, + BasicInputTypeSchemas, + BasicOutputTypeSchemas, + CommandInputTypeSchemas, + CommandOutputTypeSchemas, + InputTypeSchemas, + OutputTypeSchemas, +) from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -57,91 +68,6 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) -InputTypeSchemas: TypeAlias = ( - BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] | None -) -BasicCommandInputTypeSchemas: TypeAlias = ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) -CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] | None -) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) -OutputTypeSchemas: TypeAlias = ( - BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] | None -) -BasicCommandOutputTypeSchemas: TypeAlias = ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) -CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] | None -) -AnyTypeSchema = TypeVar( - "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas -) - - def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: @@ -163,8 +89,6 @@ def _clean_type_ids( for field in cwltype.items.fields: field.name = field.name.split("/")[-1] elif isinstance(cwltype, cwl.RecordSchema): - if cwltype.name: - cwltype.name = cwltype.name.split("/")[-1] if cwltype.fields: for field in cwltype.fields: field.name = field.name.split("/")[-1] @@ -687,7 +611,7 @@ def get_input_for_id( """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] - for inp in cast(list[cwl.InputParameter], tool.inputs): + for inp in cast(list[cwl.CommandInputParameter], tool.inputs): if inp.id and inp.id.split("#")[-1].split("/")[-1] == name: return cwl.CommandInputParameter.fromDoc( inp.save(), inp.loadingOptions.baseuri, inp.loadingOptions diff --git a/src/cwl_utils/cwl_v1_1_expression_refactor.py b/src/cwl_utils/cwl_v1_1_expression_refactor.py index 4a5104e1..0e077ab9 100755 --- a/src/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_1_expression_refactor.py @@ -8,7 +8,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, Literal, TypeAlias, TypeVar, cast +from typing import Any, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -18,6 +18,17 @@ import cwl_utils.parser.cwl_v1_1_utils as utils from cwl_utils.errors import JavascriptException, WorkflowException from cwl_utils.expression import do_eval, interpolate +from cwl_utils.parser.cwl_v1_1_utils import ( + AnyTypeSchema, + BasicCommandInputTypeSchemas, + BasicCommandOutputTypeSchemas, + BasicInputTypeSchemas, + BasicOutputTypeSchemas, + CommandInputTypeSchemas, + CommandOutputTypeSchemas, + InputTypeSchemas, + OutputTypeSchemas, +) from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -57,93 +68,6 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] -BasicCommandInputTypeSchemas: TypeAlias = ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] -) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdout", - "stderr", - ] -) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] -BasicCommandOutputTypeSchemas: TypeAlias = ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdout", - "stderr", - ] -) -CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] -) -AnyTypeSchema = TypeVar( - "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas -) - - def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: @@ -165,8 +89,6 @@ def _clean_type_ids( for field in cwltype.items.fields: field.name = field.name.split("/")[-1] elif isinstance(cwltype, cwl.RecordSchema): - if cwltype.name: - cwltype.name = cwltype.name.split("/")[-1] if cwltype.fields: for field in cwltype.fields: field.name = field.name.split("/")[-1] diff --git a/src/cwl_utils/cwl_v1_2_expression_refactor.py b/src/cwl_utils/cwl_v1_2_expression_refactor.py index e66102bd..f4a5a195 100755 --- a/src/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_2_expression_refactor.py @@ -8,7 +8,7 @@ import uuid from collections.abc import MutableSequence, Sequence from contextlib import suppress -from typing import Any, Literal, TypeAlias, TypeVar, cast +from typing import Any, cast from ruamel import yaml from schema_salad.sourceline import SourceLine @@ -18,6 +18,17 @@ import cwl_utils.parser.cwl_v1_2_utils as utils from cwl_utils.errors import JavascriptException, WorkflowException from cwl_utils.expression import do_eval, interpolate +from cwl_utils.parser.cwl_v1_2_utils import ( + AnyTypeSchema, + BasicCommandInputTypeSchemas, + BasicCommandOutputTypeSchemas, + BasicInputTypeSchemas, + BasicOutputTypeSchemas, + CommandInputTypeSchemas, + CommandOutputTypeSchemas, + InputTypeSchemas, + OutputTypeSchemas, +) from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -57,93 +68,6 @@ def escape_expression_field(contents: str) -> str: return contents.replace("${", "$/{").replace("$(", "$/(") -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] -BasicCommandInputTypeSchemas: TypeAlias = ( - cwl.CommandInputArraySchema - | cwl.CommandInputEnumSchema - | cwl.CommandInputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] -) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdout", - "stderr", - ] -) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] -BasicCommandOutputTypeSchemas: TypeAlias = ( - cwl.CommandOutputArraySchema - | cwl.CommandOutputEnumSchema - | cwl.CommandOutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdout", - "stderr", - ] -) -CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] -) -AnyTypeSchema = TypeVar( - "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas -) - - def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index df29b820..70fc71f2 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -2,9 +2,9 @@ import os from abc import ABC -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from pathlib import Path -from typing import Any, Optional, TypeAlias, cast +from typing import Any, Literal, Optional, TypeAlias, cast from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -44,10 +44,20 @@ class NoType(ABC): cwl_v1_0.OutputArraySchema | cwl_v1_1.OutputArraySchema | cwl_v1_2.OutputArraySchema ) """Type union for a CWL v1.x OutputArraySchema object.""" +OutputArraySchemaTypes = ( + cwl_v1_0.OutputArraySchema, + cwl_v1_1.OutputArraySchema, + cwl_v1_2.OutputArraySchema, +) OutputEnumSchema: TypeAlias = ( cwl_v1_0.OutputEnumSchema | cwl_v1_1.OutputEnumSchema | cwl_v1_2.OutputEnumSchema ) """Type union for a CWL v1.x OutputEnumSchema object.""" +OutputEnumSchemaTypes = ( + cwl_v1_0.OutputEnumSchema, + cwl_v1_1.OutputEnumSchema, + cwl_v1_2.OutputEnumSchema, +) OutputRecordField: TypeAlias = ( cwl_v1_0.OutputRecordField | cwl_v1_1.OutputRecordField | cwl_v1_2.OutputRecordField ) @@ -58,9 +68,34 @@ class NoType(ABC): | cwl_v1_2.OutputRecordSchema ) """Type union for a CWL v1.x OutputRecordSchema object.""" +OutputRecordSchemaTypes = ( + cwl_v1_0.OutputRecordSchema, + cwl_v1_1.OutputRecordSchema, + cwl_v1_2.OutputRecordSchema, +) OutputSchema: TypeAlias = ( cwl_v1_0.OutputSchema | cwl_v1_1.OutputSchema | cwl_v1_2.OutputSchema ) +BasicOutputTypeSchemas: TypeAlias = ( + OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stderr", + "stdout", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] """Type union for a CWL v1.x OutputSchema object.""" Workflow: TypeAlias = cwl_v1_0.Workflow | cwl_v1_1.Workflow | cwl_v1_2.Workflow WorkflowTypes = (cwl_v1_0.Workflow, cwl_v1_1.Workflow, cwl_v1_2.Workflow) @@ -215,6 +250,27 @@ class NoType(ABC): cwl_v1_2.InputRecordSchema, ) """Type Union for a CWL v1.x RecordSchema object.""" + +BasicInputTypeSchemas: TypeAlias = ( + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] + File: TypeAlias = cwl_v1_0.File | cwl_v1_1.File | cwl_v1_2.File """Type Union for a CWL v1.x File object.""" SecondaryFileSchema: TypeAlias = ( @@ -225,10 +281,7 @@ class NoType(ABC): """Type Union for a CWL v1.x Directory object.""" Dirent: TypeAlias = cwl_v1_0.Dirent | cwl_v1_1.Dirent | cwl_v1_2.Dirent """Type Union for a CWL v1.x Dirent object.""" -LoadContents: TypeAlias = ( - cwl_v1_1.LoadContents - | cwl_v1_2.LoadContents -) +LoadContents: TypeAlias = cwl_v1_1.LoadContents | cwl_v1_2.LoadContents """Type Union for a CWL v1.x LoadContents object.""" SchemaDefRequirement: TypeAlias = ( cwl_v1_0.SchemaDefRequirement diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index de0affad..6f85a176 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import IO, Any, Literal, TypeAlias, TypeVar, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -16,6 +16,7 @@ import cwl_utils.parser.cwl_v1_0 as cwl import cwl_utils.parser.utils from cwl_utils.errors import WorkflowException +from cwl_utils.types import is_sequence from cwl_utils.utils import yaml_dumps CONTENT_LIMIT: int = 64 * 1024 @@ -24,6 +25,214 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _input_type_schema_to_cwl_v1_0_input_type_schema( + input_type: cwl_utils.parser.BasicInputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicInputTypeSchemas: + if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): + return cwl.InputArraySchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): + return cwl.InputEnumSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): + return cwl.InputRecordSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, str): + return input_type + raise WorkflowException(f"Unexpected input type: {input_type}.") + + +def input_type_schema_to_cwl_v1_0_input_type_schema( + input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions +) -> InputTypeSchemas: + if is_sequence(input_type): + return [ + _input_type_schema_to_cwl_v1_0_input_type_schema( + input_type_item, loading_options + ) + for input_type_item in input_type + ] + return _input_type_schema_to_cwl_v1_0_input_type_schema(input_type, loading_options) + + +def _output_type_schema_to_cwl_v1_0_output_type_schema( + output_type: cwl_utils.parser.BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): + return cwl.OutputArraySchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): + return cwl.OutputEnumSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): + return cwl.OutputRecordSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, str): + return output_type + raise WorkflowException(f"Unexpected output type: {output_type}.") + + +def output_type_schema_to_cwl_v1_0_output_type_schema( + output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions +) -> OutputTypeSchemas: + if is_sequence(output_type): + return [ + _output_type_schema_to_cwl_v1_0_output_type_schema( + output_type_item, loading_options + ) + for output_type_item in output_type + ] + return _output_type_schema_to_cwl_v1_0_output_type_schema( + output_type, loading_options + ) + + +def _in_output_type_schema_to_output_type_schema( + schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + match schema_type: + case cwl.ArraySchema(): + return cwl.OutputArraySchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case cwl.EnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case cwl.RecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case str(): + return schema_type + raise WorkflowException(f"Unexpected output type: {schema_type}.") + + +def in_output_type_schema_to_output_type_schema( + schema_type: ( + BasicInputTypeSchemas + | BasicOutputTypeSchemas + | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] + ), + loading_options: cwl.LoadingOptions, +) -> OutputTypeSchemas: + if is_sequence(schema_type): + return [ + _in_output_type_schema_to_output_type_schema( + schema_type_item, loading_options + ) + for schema_type_item in schema_type + ] + return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) + def _compare_records( src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False @@ -367,7 +576,7 @@ def merge_flatten_type(src: Any) -> Any: def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> InputTypeSchemas: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" @@ -376,10 +585,15 @@ def type_for_step_input( if step_run and step_run.inputs: for step_input in step_run.inputs: if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ + if step_input.type_ is not None: + step_input_type = input_type_schema_to_cwl_v1_0_input_type_schema( + step_input.type_, step.loadingOptions + ) + else: + step_input_type = "null" if step.scatter is not None and in_.id in aslist(step.scatter): - input_type = cwl.ArraySchema(items=input_type, type_="array") - return input_type + return cwl.InputArraySchema(items=step_input_type, type_="array") + return step_input_type return "Any" @@ -391,21 +605,31 @@ def type_for_step_output( step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) if step_run and step_run.outputs: - for step_output in step_run.outputs: + for output in step_run.outputs: if ( - step_output.id.split("#")[-1].split("/")[-1] + output.id.split("#")[-1].split("/")[-1] == sourcename.split("#")[-1].split("/")[-1] ): - output_type = step_output.type_ + output_type = output.type_ if step.scatter is not None: + if output_type is not None: + output_type_type = ( + output_type_schema_to_cwl_v1_0_output_type_schema( + output_type, step.loadingOptions + ) + ) + else: + output_type_type = "null" if step.scatterMethod == "nested_crossproduct": for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" + output_type_type = cwl.OutputArraySchema( + items=output_type_type, type_="array" ) + return output_type_type else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + return cwl.OutputArraySchema( + items=output_type_type, type_="array" + ) raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -415,35 +639,52 @@ def type_for_step_output( def type_for_source( - process: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, -) -> Any: +) -> ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas +): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] params = param_for_source_id(process, sourcenames, parent, scatter_context) if not isinstance(params, MutableSequence): - new_type = params.type_ + new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: if scatter_context[0][1] == "nested_crossproduct": for _ in range(scatter_context[0][0]): - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) else: - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) if linkMerge == "merge_nested": - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) elif linkMerge == "merge_flattened": new_type = merge_flatten_type(new_type) return new_type - new_type = [] + new_types: MutableSequence[InputTypeSchemas | OutputTypeSchemas] = [] for p, sc in zip(params, scatter_context): - if isinstance(p, str) and not any(_compare_type(t, p) for t in new_type): + if isinstance(p, str) and not any(_compare_type(t, p) for t in new_types): cur_type = p elif hasattr(p, "type_") and not any( - _compare_type(t, p.type_) for t in new_type + _compare_type(t, p.type_) for t in new_types ): cur_type = p.type_ else: @@ -452,25 +693,45 @@ def type_for_source( if sc is not None: if sc[1] == "nested_crossproduct": for _ in range(sc[0]): - cur_type = cwl.ArraySchema(items=cur_type, type_="array") + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) else: - cur_type = cwl.ArraySchema(items=cur_type, type_="array") - new_type.append(cur_type) - if len(new_type) == 1: - new_type = new_type[0] + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) + new_types.append(cur_type) + if len(new_types) == 1: + final_type: ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas + ) = new_types[0] + else: + final_type = new_types if linkMerge == "merge_nested": - return cwl.ArraySchema(items=new_type, type_="array") + final_type = cwl.OutputArraySchema( + items=final_type, + type_="array", + ) elif linkMerge == "merge_flattened": - return merge_flatten_type(new_type) + final_type = merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: - return cwl.ArraySchema(items=new_type, type_="array") - return new_type + return cwl.OutputArraySchema( + items=final_type, + type_="array", + ) + return final_type def param_for_source_id( - process: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index 8e57fcb5..30b30e25 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import IO, Any, Literal, TypeAlias, TypeVar, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -16,6 +16,7 @@ import cwl_utils.parser.cwl_v1_1 as cwl import cwl_utils.parser.utils from cwl_utils.errors import WorkflowException +from cwl_utils.types import is_sequence from cwl_utils.utils import yaml_dumps CONTENT_LIMIT: int = 64 * 1024 @@ -24,6 +25,220 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _input_type_schema_to_cwl_v1_1_input_type_schema( + input_type: cwl_utils.parser.BasicInputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicInputTypeSchemas: + if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): + return cwl.InputArraySchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): + return cwl.InputEnumSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): + return cwl.InputRecordSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, str): + return input_type + raise WorkflowException(f"Unexpected input type: {input_type}.") + + +def input_type_schema_to_cwl_v1_1_input_type_schema( + input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions +) -> InputTypeSchemas: + if is_sequence(input_type): + return [ + _input_type_schema_to_cwl_v1_1_input_type_schema( + input_type_item, loading_options + ) + for input_type_item in input_type + ] + return _input_type_schema_to_cwl_v1_1_input_type_schema(input_type, loading_options) + + +def _output_type_schema_to_cwl_v1_1_output_type_schema( + output_type: cwl_utils.parser.BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): + return cwl.OutputArraySchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): + return cwl.OutputEnumSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): + return cwl.OutputRecordSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, str): + return output_type + raise WorkflowException(f"Unexpected output type: {output_type}.") + + +def output_type_schema_to_cwl_v1_1_output_type_schema( + output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions +) -> OutputTypeSchemas: + if is_sequence(output_type): + return [ + _output_type_schema_to_cwl_v1_1_output_type_schema( + output_type_item, loading_options + ) + for output_type_item in output_type + ] + return _output_type_schema_to_cwl_v1_1_output_type_schema( + output_type, loading_options + ) + + +def _in_output_type_schema_to_output_type_schema( + schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + match schema_type: + case cwl.ArraySchema(): + return cwl.OutputArraySchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case cwl.EnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case cwl.RecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case str(): + return schema_type + raise WorkflowException(f"Unexpected output type: {schema_type}.") + + +def in_output_type_schema_to_output_type_schema( + schema_type: ( + BasicInputTypeSchemas + | BasicOutputTypeSchemas + | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] + ), + loading_options: cwl.LoadingOptions, +) -> OutputTypeSchemas: + if is_sequence(schema_type): + return [ + _in_output_type_schema_to_output_type_schema( + schema_type_item, loading_options + ) + for schema_type_item in schema_type + ] + return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) + def _compare_records( src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False @@ -382,7 +597,7 @@ def merge_flatten_type(src: Any) -> Any: def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> InputTypeSchemas: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" @@ -391,10 +606,15 @@ def type_for_step_input( if step_run and step_run.inputs: for step_input in step_run.inputs: if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ + if step_input.type_ is not None: + step_input_type = input_type_schema_to_cwl_v1_1_input_type_schema( + step_input.type_, step.loadingOptions + ) + else: + step_input_type = "null" if step.scatter is not None and in_.id in aslist(step.scatter): - input_type = cwl.ArraySchema(items=input_type, type_="array") - return input_type + return cwl.InputArraySchema(items=step_input_type, type_="array") + return step_input_type return "Any" @@ -413,14 +633,24 @@ def type_for_step_output( ): output_type = output.type_ if step.scatter is not None: + if output_type is not None: + output_type_type = ( + output_type_schema_to_cwl_v1_1_output_type_schema( + output_type, step.loadingOptions + ) + ) + else: + output_type_type = "null" if step.scatterMethod == "nested_crossproduct": for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" + output_type_type = cwl.OutputArraySchema( + items=output_type_type, type_="array" ) + return output_type_type else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + return cwl.OutputArraySchema( + items=output_type_type, type_="array" + ) raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -430,35 +660,52 @@ def type_for_step_output( def type_for_source( - process: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, -) -> Any: +) -> ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas +): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] params = param_for_source_id(process, sourcenames, parent, scatter_context) if not isinstance(params, MutableSequence): - new_type = params.type_ + new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: if scatter_context[0][1] == "nested_crossproduct": for _ in range(scatter_context[0][0]): - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) else: - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) if linkMerge == "merge_nested": - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) elif linkMerge == "merge_flattened": new_type = merge_flatten_type(new_type) return new_type - new_type = [] + new_types: MutableSequence[InputTypeSchemas | OutputTypeSchemas] = [] for p, sc in zip(params, scatter_context): - if isinstance(p, str) and not any(_compare_type(t, p) for t in new_type): + if isinstance(p, str) and not any(_compare_type(t, p) for t in new_types): cur_type = p elif hasattr(p, "type_") and not any( - _compare_type(t, p.type_) for t in new_type + _compare_type(t, p.type_) for t in new_types ): cur_type = p.type_ else: @@ -467,26 +714,45 @@ def type_for_source( if sc is not None: if sc[1] == "nested_crossproduct": for _ in range(sc[0]): - cur_type = cwl.ArraySchema(items=cur_type, type_="array") + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) else: - cur_type = cwl.ArraySchema(items=cur_type, type_="array") - new_type.append(cur_type) - if len(new_type) == 1: - new_type = new_type[0] + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) + new_types.append(cur_type) + if len(new_types) == 1: + final_type: ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas + ) = new_types[0] + else: + final_type = new_types if linkMerge == "merge_nested": - return cwl.ArraySchema(items=new_type, type_="array") + final_type = cwl.OutputArraySchema( + items=final_type, + type_="array", + ) elif linkMerge == "merge_flattened": - return merge_flatten_type(new_type) + final_type = merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: - return cwl.ArraySchema(items=new_type, type_="array") - else: - return new_type + return cwl.OutputArraySchema( + items=final_type, + type_="array", + ) + return final_type def param_for_source_id( - process: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 41f148f7..e68829f3 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -5,7 +5,7 @@ from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, cast +from typing import IO, Any, Literal, TypeAlias, TypeVar, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -16,6 +16,7 @@ import cwl_utils.parser.cwl_v1_2 as cwl import cwl_utils.parser.utils from cwl_utils.errors import WorkflowException +from cwl_utils.types import is_sequence from cwl_utils.utils import yaml_dumps CONTENT_LIMIT: int = 64 * 1024 @@ -24,6 +25,220 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) +BasicInputTypeSchemas: TypeAlias = ( + cwl.InputArraySchema + | cwl.InputEnumSchema + | cwl.InputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +BasicCommandInputTypeSchemas: TypeAlias = ( + cwl.CommandInputArraySchema + | cwl.CommandInputEnumSchema + | cwl.CommandInputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdin", + ] +) +CommandInputTypeSchemas: TypeAlias = ( + BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] +) +BasicOutputTypeSchemas: TypeAlias = ( + cwl.OutputArraySchema + | cwl.OutputEnumSchema + | cwl.OutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +BasicCommandOutputTypeSchemas: TypeAlias = ( + cwl.CommandOutputArraySchema + | cwl.CommandOutputEnumSchema + | cwl.CommandOutputRecordSchema + | str + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + "stdout", + "stderr", + ] +) +CommandOutputTypeSchemas: TypeAlias = ( + BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] +) +AnyTypeSchema = TypeVar( + "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas +) + + +def _input_type_schema_to_cwl_v1_2_input_type_schema( + input_type: cwl_utils.parser.BasicInputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicInputTypeSchemas: + if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): + return cwl.InputArraySchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): + return cwl.InputEnumSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): + return cwl.InputRecordSchema.fromDoc( + input_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(input_type, str): + return input_type + raise WorkflowException(f"Unexpected input type: {input_type}.") + + +def input_type_schema_to_cwl_v1_2_input_type_schema( + input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions +) -> InputTypeSchemas: + if is_sequence(input_type): + return [ + _input_type_schema_to_cwl_v1_2_input_type_schema( + input_type_item, loading_options + ) + for input_type_item in input_type + ] + return _input_type_schema_to_cwl_v1_2_input_type_schema(input_type, loading_options) + + +def _output_type_schema_to_cwl_v1_2_output_type_schema( + output_type: cwl_utils.parser.BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): + return cwl.OutputArraySchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): + return cwl.OutputEnumSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): + return cwl.OutputRecordSchema.fromDoc( + output_type.save(), + loading_options.baseuri, + loading_options, + ) + if isinstance(output_type, str): + return output_type + raise WorkflowException(f"Unexpected output type: {output_type}.") + + +def output_type_schema_to_cwl_v1_2_output_type_schema( + output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions +) -> OutputTypeSchemas: + if is_sequence(output_type): + return [ + _output_type_schema_to_cwl_v1_2_output_type_schema( + output_type_item, loading_options + ) + for output_type_item in output_type + ] + return _output_type_schema_to_cwl_v1_2_output_type_schema( + output_type, loading_options + ) + + +def _in_output_type_schema_to_output_type_schema( + schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, + loading_options: cwl.LoadingOptions, +) -> BasicOutputTypeSchemas: + match schema_type: + case cwl.ArraySchema(): + return cwl.OutputArraySchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case cwl.EnumSchema(): + return cwl.OutputEnumSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case cwl.RecordSchema(): + return cwl.OutputRecordSchema.fromDoc( + schema_type.save(), + loading_options.baseuri, + loading_options, + ) + case str(): + return schema_type + raise WorkflowException(f"Unexpected output type: {schema_type}.") + + +def in_output_type_schema_to_output_type_schema( + schema_type: ( + BasicInputTypeSchemas + | BasicOutputTypeSchemas + | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] + ), + loading_options: cwl.LoadingOptions, +) -> OutputTypeSchemas: + if is_sequence(schema_type): + return [ + _in_output_type_schema_to_output_type_schema( + schema_type_item, loading_options + ) + for schema_type_item in schema_type + ] + return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) + def _compare_records( src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False @@ -506,7 +721,7 @@ def merge_flatten_type(src: Any) -> Any: def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> Any: +) -> InputTypeSchemas: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" @@ -515,10 +730,15 @@ def type_for_step_input( if step_run and step_run.inputs: for step_input in step_run.inputs: if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - input_type = step_input.type_ + if step_input.type_ is not None: + step_input_type = input_type_schema_to_cwl_v1_2_input_type_schema( + step_input.type_, step.loadingOptions + ) + else: + step_input_type = "null" if step.scatter is not None and in_.id in aslist(step.scatter): - input_type = cwl.ArraySchema(items=input_type, type_="array") - return input_type + return cwl.InputArraySchema(items=step_input_type, type_="array") + return step_input_type return "Any" @@ -537,14 +757,24 @@ def type_for_step_output( ): output_type = output.type_ if step.scatter is not None: + if output_type is not None: + output_type_type = ( + output_type_schema_to_cwl_v1_2_output_type_schema( + output_type, step.loadingOptions + ) + ) + else: + output_type_type = "null" if step.scatterMethod == "nested_crossproduct": for _ in range(len(aslist(step.scatter))): - output_type = cwl.ArraySchema( - items=output_type, type_="array" + output_type_type = cwl.OutputArraySchema( + items=output_type_type, type_="array" ) + return output_type_type else: - output_type = cwl.ArraySchema(items=output_type, type_="array") - return output_type + return cwl.OutputArraySchema( + items=output_type_type, type_="array" + ) raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -554,44 +784,57 @@ def type_for_step_output( def type_for_source( - process: ( - cwl.CommandLineTool - | cwl.Workflow - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Operation - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, linkMerge: str | None = None, pickValue: str | None = None, -) -> Any: +) -> ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas +): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] params = param_for_source_id(process, sourcenames, parent, scatter_context) if not isinstance(params, MutableSequence): - new_type = params.type_ + new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: if scatter_context[0][1] == "nested_crossproduct": for _ in range(scatter_context[0][0]): - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) else: - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) if linkMerge == "merge_nested": - new_type = cwl.ArraySchema(items=new_type, type_="array") + new_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + new_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) elif linkMerge == "merge_flattened": new_type = merge_flatten_type(new_type) if pickValue is not None: if isinstance(new_type, cwl.ArraySchema): if pickValue in ("first_non_null", "the_only_non_null"): - new_type = new_type.items + return new_type.items return new_type - new_type = [] + new_types: MutableSequence[InputTypeSchemas | OutputTypeSchemas] = [] for p, sc in zip(params, scatter_context): - if isinstance(p, str) and not any(_compare_type(t, p) for t in new_type): + if isinstance(p, str) and not any(_compare_type(t, p) for t in new_types): cur_type = p elif hasattr(p, "type_") and not any( - _compare_type(t, p.type_) for t in new_type + _compare_type(t, p.type_) for t in new_types ): cur_type = p.type_ else: @@ -600,29 +843,49 @@ def type_for_source( if sc is not None: if sc[1] == "nested_crossproduct": for _ in range(sc[0]): - cur_type = cwl.ArraySchema(items=cur_type, type_="array") + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) else: - cur_type = cwl.ArraySchema(items=cur_type, type_="array") - new_type.append(cur_type) - if len(new_type) == 1: - new_type = new_type[0] + cur_type = cwl.OutputArraySchema( + items=in_output_type_schema_to_output_type_schema( + cur_type, process.loadingOptions # type: ignore[attr-defined] + ), + type_="array", + ) + new_types.append(cur_type) + if len(new_types) == 1: + final_type: ( + MutableSequence[InputTypeSchemas | OutputTypeSchemas] + | InputTypeSchemas + | OutputTypeSchemas + ) = new_types[0] + else: + final_type = new_types if linkMerge == "merge_nested": - new_type = cwl.ArraySchema(items=new_type, type_="array") + final_type = cwl.OutputArraySchema( + items=final_type, + type_="array", + ) elif linkMerge == "merge_flattened": - new_type = merge_flatten_type(new_type) + final_type = merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: - new_type = cwl.ArraySchema(items=new_type, type_="array") + final_type = cwl.OutputArraySchema( + items=final_type, + type_="array", + ) if pickValue is not None: - if isinstance(new_type, cwl.ArraySchema): + if isinstance(final_type, cwl.ArraySchema): if pickValue in ("first_non_null", "the_only_non_null"): - new_type = new_type.items - return new_type + return final_type.items + return final_type def param_for_source_id( - process: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ExpressionTool | cwl.ProcessGenerator - ), + process: cwl.Process, sourcenames: str | Sequence[str], parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, @@ -651,6 +914,8 @@ def param_for_source_id( cwl.CommandInputParameter | cwl.CommandOutputParameter | cwl.ExpressionToolOutputParameter + | cwl.OperationInputParameter + | cwl.OperationOutputParameter | cwl.WorkflowInputParameter | cwl.WorkflowOutputParameter ] = [] From c500aa9ebd6441cd24f20f3a7494560d1deb37c1 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Fri, 26 Dec 2025 10:47:23 +0100 Subject: [PATCH 15/23] Make `param_for_source_id` return any CWL parameter --- src/cwl_utils/parser/__init__.py | 4 ++ src/cwl_utils/parser/cwl_v1_0_utils.py | 33 ++++++++----- src/cwl_utils/parser/cwl_v1_1_utils.py | 36 ++++++++------ src/cwl_utils/parser/cwl_v1_2_utils.py | 42 ++++++++-------- src/cwl_utils/parser/utils.py | 67 +++++++++----------------- 5 files changed, 90 insertions(+), 92 deletions(-) diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index 70fc71f2..587a70c7 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -132,6 +132,10 @@ class NoType(ABC): | cwl_v1_2.WorkflowStepOutput ) """Type union for a CWL v1.x WorkflowStepOutput object.""" +OperationInputParameter: TypeAlias = cwl_v1_2.OperationInputParameter +"""Type union for a CWL v1.x WorkflowInputParameter object.""" +OperationOutputParameter: TypeAlias = cwl_v1_2.OperationOutputParameter +"""Type union for a CWL v1.x WorkflowOutputParameter object.""" CommandLineTool: TypeAlias = ( cwl_v1_0.CommandLineTool | cwl_v1_1.CommandLineTool | cwl_v1_2.CommandLineTool ) diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index 6f85a176..f715b61b 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -736,25 +736,34 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.InputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter | MutableSequence[ - cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.InputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.InputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index 30b30e25..f2b7c5d0 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -757,28 +757,34 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter | MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index e68829f3..4385cdc6 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -890,34 +890,34 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.OperationInputParameter - | cwl.OperationOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter | MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.OperationInputParameter - | cwl.OperationOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.OperationInputParameter - | cwl.OperationOutputParameter - | cwl.WorkflowInputParameter - | cwl.WorkflowOutputParameter + cwl_utils.parser.CommandInputParameter + | cwl_utils.parser.CommandOutputParameter + | cwl_utils.parser.ExpressionToolOutputParameter + | cwl_utils.parser.OperationInputParameter + | cwl_utils.parser.OperationOutputParameter + | cwl_utils.parser.WorkflowInputParameter + | cwl_utils.parser.WorkflowOutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/src/cwl_utils/parser/utils.py b/src/cwl_utils/parser/utils.py index d47c8a68..52fbb696 100644 --- a/src/cwl_utils/parser/utils.py +++ b/src/cwl_utils/parser/utils.py @@ -27,6 +27,13 @@ cwl_v1_2, cwl_v1_2_utils, load_document_by_uri, + CommandInputParameter, + CommandOutputParameter, + ExpressionToolOutputParameter, + OperationInputParameter, + OperationOutputParameter, + WorkflowInputParameter, + WorkflowOutputParameter, ) _logger = logging.getLogger("cwl_utils") @@ -431,50 +438,22 @@ def param_for_source_id( parent: Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - ( - MutableSequence[ - cwl_v1_0.CommandOutputParameter - | cwl_v1_0.ExpressionToolOutputParameter - | cwl_v1_0.InputParameter - | cwl_v1_0.WorkflowOutputParameter - ] - | cwl_v1_0.CommandOutputParameter - | cwl_v1_0.ExpressionToolOutputParameter - | cwl_v1_0.InputParameter - | cwl_v1_0.WorkflowOutputParameter - ) - | ( - MutableSequence[ - cwl_v1_1.CommandInputParameter - | cwl_v1_1.CommandOutputParameter - | cwl_v1_1.ExpressionToolOutputParameter - | cwl_v1_1.WorkflowInputParameter - | cwl_v1_1.WorkflowOutputParameter - ] - | cwl_v1_1.CommandInputParameter - | cwl_v1_1.CommandOutputParameter - | cwl_v1_1.ExpressionToolOutputParameter - | cwl_v1_1.WorkflowInputParameter - | cwl_v1_1.WorkflowOutputParameter - ) - | ( - MutableSequence[ - cwl_v1_2.CommandInputParameter - | cwl_v1_2.CommandOutputParameter - | cwl_v1_2.ExpressionToolOutputParameter - | cwl_v1_2.OperationInputParameter - | cwl_v1_2.OperationOutputParameter - | cwl_v1_2.WorkflowInputParameter - | cwl_v1_2.WorkflowOutputParameter - ] - | cwl_v1_2.CommandInputParameter - | cwl_v1_2.CommandOutputParameter - | cwl_v1_2.ExpressionToolOutputParameter - | cwl_v1_2.OperationInputParameter - | cwl_v1_2.OperationOutputParameter - | cwl_v1_2.WorkflowInputParameter - | cwl_v1_2.WorkflowOutputParameter - ) + CommandInputParameter + | CommandOutputParameter + | ExpressionToolOutputParameter + | OperationInputParameter + | OperationOutputParameter + | WorkflowInputParameter + | WorkflowOutputParameter + | MutableSequence[ + CommandInputParameter + | CommandOutputParameter + | ExpressionToolOutputParameter + | OperationInputParameter + | OperationOutputParameter + | WorkflowInputParameter + | WorkflowOutputParameter + ] ): match process.cwlVersion: case "v1.0": From cbf749d5fe15768304791f5b3c557a514c7fb31f Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Fri, 26 Dec 2025 17:29:02 +0100 Subject: [PATCH 16/23] Regenerate prsers with fixed CWL versions --- src/cwl_utils/parser/__init__.py | 50 +------ src/cwl_utils/parser/cwl_v1_0.py | 60 ++------ src/cwl_utils/parser/cwl_v1_0_utils.py | 194 +++++++------------------ src/cwl_utils/parser/cwl_v1_1.py | 66 ++------- src/cwl_utils/parser/cwl_v1_1_utils.py | 193 +++++++----------------- src/cwl_utils/parser/cwl_v1_2.py | 88 ++--------- src/cwl_utils/parser/cwl_v1_2_utils.py | 193 +++++++----------------- src/cwl_utils/parser/utils.py | 153 ++++++++++++++----- 8 files changed, 326 insertions(+), 671 deletions(-) diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index 587a70c7..be8c41ef 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -2,9 +2,9 @@ import os from abc import ABC -from collections.abc import MutableMapping, MutableSequence, Sequence +from collections.abc import MutableMapping, MutableSequence from pathlib import Path -from typing import Any, Literal, Optional, TypeAlias, cast +from typing import Any, Optional, TypeAlias, cast from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -76,26 +76,6 @@ class NoType(ABC): OutputSchema: TypeAlias = ( cwl_v1_0.OutputSchema | cwl_v1_1.OutputSchema | cwl_v1_2.OutputSchema ) -BasicOutputTypeSchemas: TypeAlias = ( - OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stderr", - "stdout", - ] -) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] """Type union for a CWL v1.x OutputSchema object.""" Workflow: TypeAlias = cwl_v1_0.Workflow | cwl_v1_1.Workflow | cwl_v1_2.Workflow WorkflowTypes = (cwl_v1_0.Workflow, cwl_v1_1.Workflow, cwl_v1_2.Workflow) @@ -132,10 +112,12 @@ class NoType(ABC): | cwl_v1_2.WorkflowStepOutput ) """Type union for a CWL v1.x WorkflowStepOutput object.""" +Operation: TypeAlias = cwl_v1_2.Operation +"""Type union for a CWL v1.x Operation object.""" OperationInputParameter: TypeAlias = cwl_v1_2.OperationInputParameter -"""Type union for a CWL v1.x WorkflowInputParameter object.""" +"""Type union for a CWL v1.x OperationInputParameter object.""" OperationOutputParameter: TypeAlias = cwl_v1_2.OperationOutputParameter -"""Type union for a CWL v1.x WorkflowOutputParameter object.""" +"""Type union for a CWL v1.x OperationOutputParameter object.""" CommandLineTool: TypeAlias = ( cwl_v1_0.CommandLineTool | cwl_v1_1.CommandLineTool | cwl_v1_2.CommandLineTool ) @@ -255,26 +237,6 @@ class NoType(ABC): ) """Type Union for a CWL v1.x RecordSchema object.""" -BasicInputTypeSchemas: TypeAlias = ( - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - "stdin", - ] -) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] - File: TypeAlias = cwl_v1_0.File | cwl_v1_1.File | cwl_v1_2.File """Type Union for a CWL v1.x File object.""" SecondaryFileSchema: TypeAlias = ( diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 9f1ee3e5..6a6e814b 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -8315,7 +8315,7 @@ class Process(Saveable, metaclass=ABCMeta): hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] label: None | str doc: None | str - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None + cwlVersion: Literal["v1.0"] | None class InlineJavascriptRequirement(ProcessRequirement): @@ -14691,7 +14691,7 @@ def __init__( hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, label: None | str = None, doc: None | str = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = None, + cwlVersion: Literal["v1.0"] | None = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, stdin: None | str = None, @@ -14718,7 +14718,7 @@ def __init__( self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints self.label: None | str = label self.doc: None | str = doc - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = cwlVersion + self.cwlVersion: Literal["v1.0"] | None = cwlVersion self.class_: Final[str] = "CommandLineTool" self.baseCommand: None | Sequence[str] | str = baseCommand self.arguments: None | Sequence[CommandLineBinding | str] = arguments @@ -18260,7 +18260,7 @@ def __init__( hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, label: None | str = None, doc: None | str = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = None, + cwlVersion: Literal["v1.0"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -18279,7 +18279,7 @@ def __init__( self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints self.label: None | str = label self.doc: None | str = doc - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = cwlVersion + self.cwlVersion: Literal["v1.0"] | None = cwlVersion self.class_: Final[str] = "ExpressionTool" self.expression: str = expression @@ -20986,7 +20986,7 @@ def __init__( hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, label: None | str = None, doc: None | str = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = None, + cwlVersion: Literal["v1.0"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -21005,7 +21005,7 @@ def __init__( self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints self.label: None | str = label self.doc: None | str = doc - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = cwlVersion + self.cwlVersion: Literal["v1.0"] | None = cwlVersion self.class_: Final[str] = "Workflow" self.steps: Sequence[WorkflowStep] = steps @@ -23201,7 +23201,7 @@ def __init__( hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, label: None | str = None, doc: None | str = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = None, + cwlVersion: Literal["v1.0"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23220,7 +23220,7 @@ def __init__( self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints self.label: None | str = label self.doc: None | str = doc - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0"] | None = cwlVersion + self.cwlVersion: Literal["v1.0"] | None = cwlVersion self.class_: Final[str] = "ProcessGenerator" self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run @@ -24054,16 +24054,6 @@ def __init__( "deep_listing": "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/deep_listing", "dotproduct": "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct", "double": "http://www.w3.org/2001/XMLSchema#double", - "draft-2": "https://w3id.org/cwl/cwl#draft-2", - "draft-3": "https://w3id.org/cwl/cwl#draft-3", - "draft-3.dev1": "https://w3id.org/cwl/cwl#draft-3.dev1", - "draft-3.dev2": "https://w3id.org/cwl/cwl#draft-3.dev2", - "draft-3.dev3": "https://w3id.org/cwl/cwl#draft-3.dev3", - "draft-3.dev4": "https://w3id.org/cwl/cwl#draft-3.dev4", - "draft-3.dev5": "https://w3id.org/cwl/cwl#draft-3.dev5", - "draft-4.dev1": "https://w3id.org/cwl/cwl#draft-4.dev1", - "draft-4.dev2": "https://w3id.org/cwl/cwl#draft-4.dev2", - "draft-4.dev3": "https://w3id.org/cwl/cwl#draft-4.dev3", "enum": "https://w3id.org/cwl/salad#enum", "flat_crossproduct": "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct", "float": "http://www.w3.org/2001/XMLSchema#float", @@ -24082,7 +24072,6 @@ def __init__( "string": "http://www.w3.org/2001/XMLSchema#string", "union": "https://w3id.org/cwl/salad#union", "v1.0": "https://w3id.org/cwl/cwl#v1.0", - "v1.0.dev4": "https://w3id.org/cwl/cwl#v1.0.dev4", }) _rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", @@ -24176,16 +24165,6 @@ def __init__( "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/deep_listing": "deep_listing", "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct": "dotproduct", "http://www.w3.org/2001/XMLSchema#double": "double", - "https://w3id.org/cwl/cwl#draft-2": "draft-2", - "https://w3id.org/cwl/cwl#draft-3": "draft-3", - "https://w3id.org/cwl/cwl#draft-3.dev1": "draft-3.dev1", - "https://w3id.org/cwl/cwl#draft-3.dev2": "draft-3.dev2", - "https://w3id.org/cwl/cwl#draft-3.dev3": "draft-3.dev3", - "https://w3id.org/cwl/cwl#draft-3.dev4": "draft-3.dev4", - "https://w3id.org/cwl/cwl#draft-3.dev5": "draft-3.dev5", - "https://w3id.org/cwl/cwl#draft-4.dev1": "draft-4.dev1", - "https://w3id.org/cwl/cwl#draft-4.dev2": "draft-4.dev2", - "https://w3id.org/cwl/cwl#draft-4.dev3": "draft-4.dev3", "https://w3id.org/cwl/salad#enum": "enum", "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct": "flat_crossproduct", "http://www.w3.org/2001/XMLSchema#float": "float", @@ -24204,7 +24183,6 @@ def __init__( "http://www.w3.org/2001/XMLSchema#string": "string", "https://w3id.org/cwl/salad#union": "union", "https://w3id.org/cwl/cwl#v1.0": "v1.0", - "https://w3id.org/cwl/cwl#v1.0.dev4": "v1.0.dev4", }) strtype: Final = _PrimitiveLoader(str) @@ -24288,25 +24266,9 @@ def __init__( union_of_None_type_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True ) CWLInputFileLoader: Final = map_of_union_of_None_type_or_CWLObjectTypeLoader -CWLVersionLoader: Final = _EnumLoader( - ( - "draft-2", - "draft-3.dev1", - "draft-3.dev2", - "draft-3.dev3", - "draft-3.dev4", - "draft-3.dev5", - "draft-3", - "draft-4.dev1", - "draft-4.dev2", - "draft-4.dev3", - "v1.0.dev4", - "v1.0", - ), - "CWLVersion", -) +CWLVersionLoader: Final = _EnumLoader(("v1.0",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ ExpressionLoader: Final = _ExpressionLoader(str) InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index f715b61b..4c51b200 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -106,88 +106,6 @@ ) -def _input_type_schema_to_cwl_v1_0_input_type_schema( - input_type: cwl_utils.parser.BasicInputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicInputTypeSchemas: - if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): - return cwl.InputArraySchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): - return cwl.InputEnumSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): - return cwl.InputRecordSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, str): - return input_type - raise WorkflowException(f"Unexpected input type: {input_type}.") - - -def input_type_schema_to_cwl_v1_0_input_type_schema( - input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions -) -> InputTypeSchemas: - if is_sequence(input_type): - return [ - _input_type_schema_to_cwl_v1_0_input_type_schema( - input_type_item, loading_options - ) - for input_type_item in input_type - ] - return _input_type_schema_to_cwl_v1_0_input_type_schema(input_type, loading_options) - - -def _output_type_schema_to_cwl_v1_0_output_type_schema( - output_type: cwl_utils.parser.BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicOutputTypeSchemas: - if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): - return cwl.OutputArraySchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): - return cwl.OutputEnumSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): - return cwl.OutputRecordSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, str): - return output_type - raise WorkflowException(f"Unexpected output type: {output_type}.") - - -def output_type_schema_to_cwl_v1_0_output_type_schema( - output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions -) -> OutputTypeSchemas: - if is_sequence(output_type): - return [ - _output_type_schema_to_cwl_v1_0_output_type_schema( - output_type_item, loading_options - ) - for output_type_item in output_type - ] - return _output_type_schema_to_cwl_v1_0_output_type_schema( - output_type, loading_options - ) - - def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, loading_options: cwl.LoadingOptions, @@ -573,63 +491,62 @@ def merge_flatten_type(src: Any) -> Any: return cwl.ArraySchema(type_="array", items=src) +def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: + return cwl.InputArraySchema(type_="array", items=type_) + + +def to_output_array(type_: OutputTypeSchemas) -> cwl.OutputArraySchema: + return cwl.OutputArraySchema(type_="array", items=type_) + + def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> InputTypeSchemas: +) -> cwl_utils.parser.utils.InputTypeSchemas | None: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" step_run = cwl_utils.parser.utils.load_step(step) 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 step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - if step_input.type_ is not None: - step_input_type = input_type_schema_to_cwl_v1_0_input_type_schema( - step_input.type_, step.loadingOptions - ) - else: - step_input_type = "null" - if step.scatter is not None and in_.id in aslist(step.scatter): - return cwl.InputArraySchema(items=step_input_type, type_="array") - return step_input_type + for step_input in step_run.inputs: + if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: + input_type = step_input.type_ + if ( + input_type is not None + and step.scatter is not None + and in_.id in aslist(step.scatter) + ): + input_type = cwl_utils.parser.utils.to_input_array( + input_type, step_run.cwlVersion or "v1.0" + ) + return input_type return "Any" def type_for_step_output( step: cwl.WorkflowStep, sourcename: str, -) -> Any: +) -> cwl_utils.parser.utils.OutputTypeSchemas | None: """Determine the type for the given step output.""" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.outputs: - for output in step_run.outputs: - if ( - output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - output_type = output.type_ - if step.scatter is not None: - if output_type is not None: - output_type_type = ( - output_type_schema_to_cwl_v1_0_output_type_schema( - output_type, step.loadingOptions - ) - ) - else: - output_type_type = "null" - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type_type = cwl.OutputArraySchema( - items=output_type_type, type_="array" - ) - return output_type_type - else: - return cwl.OutputArraySchema( - items=output_type_type, type_="array" + for output in step_run.outputs: + if ( + output.id.split("#")[-1].split("/")[-1] + == sourcename.split("#")[-1].split("/")[-1] + ): + output_type = output.type_ + if output_type is not None and step.scatter is not None: + if step.scatterMethod == "nested_crossproduct": + for _ in range(len(aslist(step.scatter))): + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.0" ) + else: + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.0" + ) + return output_type raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -804,26 +721,25 @@ def param_for_source_id( ): params.append(output) if scatter_context is not None: - if isinstance(step.scatter, str): - scatter_context.append( - ( - 1, - step.scatterMethod - or "dotproduct", + match step.scatter: + case str(): + scatter_context.append( + ( + 1, + step.scatterMethod + or "dotproduct", + ) ) - ) - elif isinstance( - step.scatter, MutableSequence - ): - scatter_context.append( - ( - len(step.scatter), - step.scatterMethod - or "dotproduct", + case Sequence(): + scatter_context.append( + ( + len(step.scatter), + step.scatterMethod + or "dotproduct", + ) ) - ) - else: - scatter_context.append(None) + case _: + scatter_context.append(None) if len(params) == 1: return params[0] elif len(params) > 1: diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index f75e9657..f229e0b0 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -8099,7 +8099,7 @@ class Process(Identified, Labeled, Documented, metaclass=ABCMeta): outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter] requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None + cwlVersion: Literal["v1.1"] | None class InlineJavascriptRequirement(ProcessRequirement): @@ -16031,7 +16031,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = None, + cwlVersion: Literal["v1.1"] | None = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, stdin: None | str = None, @@ -16058,7 +16058,7 @@ def __init__( self.outputs: Sequence[CommandOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = cwlVersion + self.cwlVersion: Literal["v1.1"] | None = cwlVersion self.class_: Final[str] = "CommandLineTool" self.baseCommand: None | Sequence[str] | str = baseCommand self.arguments: None | Sequence[CommandLineBinding | str] = arguments @@ -21086,7 +21086,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = None, + cwlVersion: Literal["v1.1"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -21105,7 +21105,7 @@ def __init__( self.outputs: Sequence[ExpressionToolOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = cwlVersion + self.cwlVersion: Literal["v1.1"] | None = cwlVersion self.class_: Final[str] = "ExpressionTool" self.expression: str = expression @@ -23953,7 +23953,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = None, + cwlVersion: Literal["v1.1"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23972,7 +23972,7 @@ def __init__( self.outputs: Sequence[WorkflowOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = cwlVersion + self.cwlVersion: Literal["v1.1"] | None = cwlVersion self.class_: Final[str] = "Workflow" self.steps: Sequence[WorkflowStep] = steps @@ -25253,7 +25253,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = None, + cwlVersion: Literal["v1.1"] | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25272,7 +25272,7 @@ def __init__( self.outputs: Sequence[ExpressionToolOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1"] | None = cwlVersion + self.cwlVersion: Literal["v1.1"] | None = cwlVersion self.class_: Final[str] = "ProcessGenerator" self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run @@ -26117,16 +26117,6 @@ def __init__( "deep_listing": "https://w3id.org/cwl/cwl#LoadListingEnum/deep_listing", "dotproduct": "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct", "double": "http://www.w3.org/2001/XMLSchema#double", - "draft-2": "https://w3id.org/cwl/cwl#draft-2", - "draft-3": "https://w3id.org/cwl/cwl#draft-3", - "draft-3.dev1": "https://w3id.org/cwl/cwl#draft-3.dev1", - "draft-3.dev2": "https://w3id.org/cwl/cwl#draft-3.dev2", - "draft-3.dev3": "https://w3id.org/cwl/cwl#draft-3.dev3", - "draft-3.dev4": "https://w3id.org/cwl/cwl#draft-3.dev4", - "draft-3.dev5": "https://w3id.org/cwl/cwl#draft-3.dev5", - "draft-4.dev1": "https://w3id.org/cwl/cwl#draft-4.dev1", - "draft-4.dev2": "https://w3id.org/cwl/cwl#draft-4.dev2", - "draft-4.dev3": "https://w3id.org/cwl/cwl#draft-4.dev3", "enum": "https://w3id.org/cwl/salad#enum", "flat_crossproduct": "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct", "float": "http://www.w3.org/2001/XMLSchema#float", @@ -26145,10 +26135,7 @@ def __init__( "stdout": "https://w3id.org/cwl/cwl#stdout", "string": "http://www.w3.org/2001/XMLSchema#string", "union": "https://w3id.org/cwl/salad#union", - "v1.0": "https://w3id.org/cwl/cwl#v1.0", - "v1.0.dev4": "https://w3id.org/cwl/cwl#v1.0.dev4", "v1.1": "https://w3id.org/cwl/cwl#v1.1", - "v1.1.0-dev1": "https://w3id.org/cwl/cwl#v1.1.0-dev1", }) _rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", @@ -26253,16 +26240,6 @@ def __init__( "https://w3id.org/cwl/cwl#LoadListingEnum/deep_listing": "deep_listing", "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct": "dotproduct", "http://www.w3.org/2001/XMLSchema#double": "double", - "https://w3id.org/cwl/cwl#draft-2": "draft-2", - "https://w3id.org/cwl/cwl#draft-3": "draft-3", - "https://w3id.org/cwl/cwl#draft-3.dev1": "draft-3.dev1", - "https://w3id.org/cwl/cwl#draft-3.dev2": "draft-3.dev2", - "https://w3id.org/cwl/cwl#draft-3.dev3": "draft-3.dev3", - "https://w3id.org/cwl/cwl#draft-3.dev4": "draft-3.dev4", - "https://w3id.org/cwl/cwl#draft-3.dev5": "draft-3.dev5", - "https://w3id.org/cwl/cwl#draft-4.dev1": "draft-4.dev1", - "https://w3id.org/cwl/cwl#draft-4.dev2": "draft-4.dev2", - "https://w3id.org/cwl/cwl#draft-4.dev3": "draft-4.dev3", "https://w3id.org/cwl/salad#enum": "enum", "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct": "flat_crossproduct", "http://www.w3.org/2001/XMLSchema#float": "float", @@ -26281,10 +26258,7 @@ def __init__( "https://w3id.org/cwl/cwl#stdout": "stdout", "http://www.w3.org/2001/XMLSchema#string": "string", "https://w3id.org/cwl/salad#union": "union", - "https://w3id.org/cwl/cwl#v1.0": "v1.0", - "https://w3id.org/cwl/cwl#v1.0.dev4": "v1.0.dev4", "https://w3id.org/cwl/cwl#v1.1": "v1.1", - "https://w3id.org/cwl/cwl#v1.1.0-dev1": "v1.1.0-dev1", }) strtype: Final = _PrimitiveLoader(str) @@ -26456,27 +26430,9 @@ def __init__( CWLInputFileLoader: Final = ( map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader ) -CWLVersionLoader: Final = _EnumLoader( - ( - "draft-2", - "draft-3.dev1", - "draft-3.dev2", - "draft-3.dev3", - "draft-3.dev4", - "draft-3.dev5", - "draft-3", - "draft-4.dev1", - "draft-4.dev2", - "draft-4.dev3", - "v1.0.dev4", - "v1.0", - "v1.1.0-dev1", - "v1.1", - ), - "CWLVersion", -) +CWLVersionLoader: Final = _EnumLoader(("v1.1",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ LoadListingEnumLoader: Final = _EnumLoader( ( diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index f2b7c5d0..2eda1792 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -40,10 +40,11 @@ "string", "File", "Directory", - "stdin", ] ) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +InputTypeSchemas: TypeAlias = ( + BasicInputTypeSchemas | Literal["stdin"] | Sequence[BasicInputTypeSchemas] +) BasicCommandInputTypeSchemas: TypeAlias = ( cwl.CommandInputArraySchema | cwl.CommandInputEnumSchema @@ -59,11 +60,12 @@ "string", "File", "Directory", - "stdin", ] ) CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] + BasicCommandInputTypeSchemas + | Literal["stdin"] + | Sequence[BasicCommandInputTypeSchemas] ) BasicOutputTypeSchemas: TypeAlias = ( cwl.OutputArraySchema @@ -80,11 +82,13 @@ "string", "File", "Directory", - "stdout", - "stderr", ] ) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +OutputTypeSchemas: TypeAlias = ( + BasicOutputTypeSchemas + | Literal["stderr", "stdout"] + | Sequence[BasicOutputTypeSchemas] +) BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema @@ -100,100 +104,18 @@ "string", "File", "Directory", - "stdout", - "stderr", ] ) CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] + BasicCommandOutputTypeSchemas + | Literal["stderr", "stdout"] + | Sequence[BasicCommandOutputTypeSchemas] ) AnyTypeSchema = TypeVar( "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas ) -def _input_type_schema_to_cwl_v1_1_input_type_schema( - input_type: cwl_utils.parser.BasicInputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicInputTypeSchemas: - if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): - return cwl.InputArraySchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): - return cwl.InputEnumSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): - return cwl.InputRecordSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, str): - return input_type - raise WorkflowException(f"Unexpected input type: {input_type}.") - - -def input_type_schema_to_cwl_v1_1_input_type_schema( - input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions -) -> InputTypeSchemas: - if is_sequence(input_type): - return [ - _input_type_schema_to_cwl_v1_1_input_type_schema( - input_type_item, loading_options - ) - for input_type_item in input_type - ] - return _input_type_schema_to_cwl_v1_1_input_type_schema(input_type, loading_options) - - -def _output_type_schema_to_cwl_v1_1_output_type_schema( - output_type: cwl_utils.parser.BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicOutputTypeSchemas: - if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): - return cwl.OutputArraySchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): - return cwl.OutputEnumSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): - return cwl.OutputRecordSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, str): - return output_type - raise WorkflowException(f"Unexpected output type: {output_type}.") - - -def output_type_schema_to_cwl_v1_1_output_type_schema( - output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions -) -> OutputTypeSchemas: - if is_sequence(output_type): - return [ - _output_type_schema_to_cwl_v1_1_output_type_schema( - output_type_item, loading_options - ) - for output_type_item in output_type - ] - return _output_type_schema_to_cwl_v1_1_output_type_schema( - output_type, loading_options - ) - - def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, loading_options: cwl.LoadingOptions, @@ -594,63 +516,62 @@ def merge_flatten_type(src: Any) -> Any: return cwl.ArraySchema(type_="array", items=src) +def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: + return cwl.InputArraySchema(type_="array", items=type_) + + +def to_output_array(type_: OutputTypeSchemas) -> cwl.OutputArraySchema: + return cwl.OutputArraySchema(type_="array", items=type_) + + def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> InputTypeSchemas: +) -> cwl_utils.parser.utils.InputTypeSchemas | None: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" step_run = cwl_utils.parser.utils.load_step(step) 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 step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - if step_input.type_ is not None: - step_input_type = input_type_schema_to_cwl_v1_1_input_type_schema( - step_input.type_, step.loadingOptions - ) - else: - step_input_type = "null" - if step.scatter is not None and in_.id in aslist(step.scatter): - return cwl.InputArraySchema(items=step_input_type, type_="array") - return step_input_type + for step_input in step_run.inputs: + if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: + input_type = step_input.type_ + if ( + input_type is not None + and step.scatter is not None + and in_.id in aslist(step.scatter) + ): + input_type = cwl_utils.parser.utils.to_input_array( + input_type, step_run.cwlVersion or "v1.1" + ) + return input_type return "Any" def type_for_step_output( step: cwl.WorkflowStep, sourcename: str, -) -> Any: +) -> cwl_utils.parser.utils.OutputTypeSchemas | None: """Determine the type for the given step output.""" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.outputs: - for output in step_run.outputs: - if ( - output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - output_type = output.type_ - if step.scatter is not None: - if output_type is not None: - output_type_type = ( - output_type_schema_to_cwl_v1_1_output_type_schema( - output_type, step.loadingOptions - ) - ) - else: - output_type_type = "null" - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type_type = cwl.OutputArraySchema( - items=output_type_type, type_="array" - ) - return output_type_type - else: - return cwl.OutputArraySchema( - items=output_type_type, type_="array" + for output in step_run.outputs: + if ( + output.id.split("#")[-1].split("/")[-1] + == sourcename.split("#")[-1].split("/")[-1] + ): + output_type = output.type_ + if output_type is not None and step.scatter is not None: + if step.scatterMethod == "nested_crossproduct": + for _ in range(len(aslist(step.scatter))): + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.1" ) + else: + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.1" + ) + return output_type raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -825,8 +746,8 @@ def param_for_source_id( ): params.append(output) if scatter_context is not None: - if scatter_context is not None: - if isinstance(step.scatter, str): + match step.scatter: + case str(): scatter_context.append( ( 1, @@ -834,9 +755,7 @@ def param_for_source_id( or "dotproduct", ) ) - elif isinstance( - step.scatter, MutableSequence - ): + case Sequence(): scatter_context.append( ( len(step.scatter), @@ -844,7 +763,7 @@ def param_for_source_id( or "dotproduct", ) ) - else: + case _: scatter_context.append(None) if len(params) == 1: return params[0] diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index 34e379b2..be96ca70 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -8099,7 +8099,7 @@ class Process(Identified, Labeled, Documented, metaclass=ABCMeta): outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter] requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None + cwlVersion: Literal["v1.2"] | None intent: None | Sequence[str] @@ -16107,7 +16107,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, @@ -16135,7 +16135,7 @@ def __init__( self.outputs: Sequence[CommandOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "CommandLineTool" self.baseCommand: None | Sequence[str] | str = baseCommand @@ -21228,7 +21228,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -21248,7 +21248,7 @@ def __init__( self.outputs: Sequence[ExpressionToolOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "ExpressionTool" self.expression: str = expression @@ -24421,7 +24421,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -24441,7 +24441,7 @@ def __init__( self.outputs: Sequence[WorkflowOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "Workflow" self.steps: Sequence[WorkflowStep] = steps @@ -26767,7 +26767,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -26787,7 +26787,7 @@ def __init__( self.outputs: Sequence[OperationOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "Operation" @@ -27645,7 +27645,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = None, + cwlVersion: Literal["v1.2"] | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -27665,7 +27665,7 @@ def __init__( self.outputs: Sequence[ExpressionToolOutputParameter] = outputs self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["draft-2", "draft-3.dev1", "draft-3.dev2", "draft-3.dev3", "draft-3.dev4", "draft-3.dev5", "draft-3", "draft-4.dev1", "draft-4.dev2", "draft-4.dev3", "v1.0.dev4", "v1.0", "v1.1.0-dev1", "v1.1", "v1.2.0-dev1", "v1.2.0-dev2", "v1.2.0-dev3", "v1.2.0-dev4", "v1.2.0-dev5", "v1.2"] | None = cwlVersion + self.cwlVersion: Literal["v1.2"] | None = cwlVersion self.intent: None | Sequence[str] = intent self.class_: Final[str] = "ProcessGenerator" self.run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str = run @@ -29268,16 +29268,6 @@ def __init__( "deep_listing": "https://w3id.org/cwl/cwl#LoadListingEnum/deep_listing", "dotproduct": "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct", "double": "http://www.w3.org/2001/XMLSchema#double", - "draft-2": "https://w3id.org/cwl/cwl#draft-2", - "draft-3": "https://w3id.org/cwl/cwl#draft-3", - "draft-3.dev1": "https://w3id.org/cwl/cwl#draft-3.dev1", - "draft-3.dev2": "https://w3id.org/cwl/cwl#draft-3.dev2", - "draft-3.dev3": "https://w3id.org/cwl/cwl#draft-3.dev3", - "draft-3.dev4": "https://w3id.org/cwl/cwl#draft-3.dev4", - "draft-3.dev5": "https://w3id.org/cwl/cwl#draft-3.dev5", - "draft-4.dev1": "https://w3id.org/cwl/cwl#draft-4.dev1", - "draft-4.dev2": "https://w3id.org/cwl/cwl#draft-4.dev2", - "draft-4.dev3": "https://w3id.org/cwl/cwl#draft-4.dev3", "enum": "https://w3id.org/cwl/salad#enum", "first_non_null": "https://w3id.org/cwl/cwl#PickValueMethod/first_non_null", "flat_crossproduct": "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct", @@ -29299,16 +29289,7 @@ def __init__( "string": "http://www.w3.org/2001/XMLSchema#string", "the_only_non_null": "https://w3id.org/cwl/cwl#PickValueMethod/the_only_non_null", "union": "https://w3id.org/cwl/salad#union", - "v1.0": "https://w3id.org/cwl/cwl#v1.0", - "v1.0.dev4": "https://w3id.org/cwl/cwl#v1.0.dev4", - "v1.1": "https://w3id.org/cwl/cwl#v1.1", - "v1.1.0-dev1": "https://w3id.org/cwl/cwl#v1.1.0-dev1", "v1.2": "https://w3id.org/cwl/cwl#v1.2", - "v1.2.0-dev1": "https://w3id.org/cwl/cwl#v1.2.0-dev1", - "v1.2.0-dev2": "https://w3id.org/cwl/cwl#v1.2.0-dev2", - "v1.2.0-dev3": "https://w3id.org/cwl/cwl#v1.2.0-dev3", - "v1.2.0-dev4": "https://w3id.org/cwl/cwl#v1.2.0-dev4", - "v1.2.0-dev5": "https://w3id.org/cwl/cwl#v1.2.0-dev5", }) _rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", @@ -29421,16 +29402,6 @@ def __init__( "https://w3id.org/cwl/cwl#LoadListingEnum/deep_listing": "deep_listing", "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct": "dotproduct", "http://www.w3.org/2001/XMLSchema#double": "double", - "https://w3id.org/cwl/cwl#draft-2": "draft-2", - "https://w3id.org/cwl/cwl#draft-3": "draft-3", - "https://w3id.org/cwl/cwl#draft-3.dev1": "draft-3.dev1", - "https://w3id.org/cwl/cwl#draft-3.dev2": "draft-3.dev2", - "https://w3id.org/cwl/cwl#draft-3.dev3": "draft-3.dev3", - "https://w3id.org/cwl/cwl#draft-3.dev4": "draft-3.dev4", - "https://w3id.org/cwl/cwl#draft-3.dev5": "draft-3.dev5", - "https://w3id.org/cwl/cwl#draft-4.dev1": "draft-4.dev1", - "https://w3id.org/cwl/cwl#draft-4.dev2": "draft-4.dev2", - "https://w3id.org/cwl/cwl#draft-4.dev3": "draft-4.dev3", "https://w3id.org/cwl/salad#enum": "enum", "https://w3id.org/cwl/cwl#PickValueMethod/first_non_null": "first_non_null", "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct": "flat_crossproduct", @@ -29452,16 +29423,7 @@ def __init__( "http://www.w3.org/2001/XMLSchema#string": "string", "https://w3id.org/cwl/cwl#PickValueMethod/the_only_non_null": "the_only_non_null", "https://w3id.org/cwl/salad#union": "union", - "https://w3id.org/cwl/cwl#v1.0": "v1.0", - "https://w3id.org/cwl/cwl#v1.0.dev4": "v1.0.dev4", - "https://w3id.org/cwl/cwl#v1.1": "v1.1", - "https://w3id.org/cwl/cwl#v1.1.0-dev1": "v1.1.0-dev1", "https://w3id.org/cwl/cwl#v1.2": "v1.2", - "https://w3id.org/cwl/cwl#v1.2.0-dev1": "v1.2.0-dev1", - "https://w3id.org/cwl/cwl#v1.2.0-dev2": "v1.2.0-dev2", - "https://w3id.org/cwl/cwl#v1.2.0-dev3": "v1.2.0-dev3", - "https://w3id.org/cwl/cwl#v1.2.0-dev4": "v1.2.0-dev4", - "https://w3id.org/cwl/cwl#v1.2.0-dev5": "v1.2.0-dev5", }) strtype: Final = _PrimitiveLoader(str) @@ -29635,33 +29597,9 @@ def __init__( CWLInputFileLoader: Final = ( map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader ) -CWLVersionLoader: Final = _EnumLoader( - ( - "draft-2", - "draft-3.dev1", - "draft-3.dev2", - "draft-3.dev3", - "draft-3.dev4", - "draft-3.dev5", - "draft-3", - "draft-4.dev1", - "draft-4.dev2", - "draft-4.dev3", - "v1.0.dev4", - "v1.0", - "v1.1.0-dev1", - "v1.1", - "v1.2.0-dev1", - "v1.2.0-dev2", - "v1.2.0-dev3", - "v1.2.0-dev4", - "v1.2.0-dev5", - "v1.2", - ), - "CWLVersion", -) +CWLVersionLoader: Final = _EnumLoader(("v1.2",), "CWLVersion") """ -Version symbols for published CWL document versions. +Current version symbol for CWL documents. """ LoadListingEnumLoader: Final = _EnumLoader( ( diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 4385cdc6..b2cdade7 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -40,10 +40,11 @@ "string", "File", "Directory", - "stdin", ] ) -InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] +InputTypeSchemas: TypeAlias = ( + BasicInputTypeSchemas | Literal["stdin"] | Sequence[BasicInputTypeSchemas] +) BasicCommandInputTypeSchemas: TypeAlias = ( cwl.CommandInputArraySchema | cwl.CommandInputEnumSchema @@ -59,11 +60,12 @@ "string", "File", "Directory", - "stdin", ] ) CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] + BasicCommandInputTypeSchemas + | Literal["stdin"] + | Sequence[BasicCommandInputTypeSchemas] ) BasicOutputTypeSchemas: TypeAlias = ( cwl.OutputArraySchema @@ -80,11 +82,13 @@ "string", "File", "Directory", - "stdout", - "stderr", ] ) -OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] +OutputTypeSchemas: TypeAlias = ( + BasicOutputTypeSchemas + | Literal["stderr", "stdout"] + | Sequence[BasicOutputTypeSchemas] +) BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema @@ -100,100 +104,18 @@ "string", "File", "Directory", - "stdout", - "stderr", ] ) CommandOutputTypeSchemas: TypeAlias = ( - BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] + BasicCommandOutputTypeSchemas + | Literal["stderr", "stdout"] + | Sequence[BasicCommandOutputTypeSchemas] ) AnyTypeSchema = TypeVar( "AnyTypeSchema", bound=InputTypeSchemas | CommandOutputTypeSchemas ) -def _input_type_schema_to_cwl_v1_2_input_type_schema( - input_type: cwl_utils.parser.BasicInputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicInputTypeSchemas: - if isinstance(input_type, cwl_utils.parser.InputArraySchemaTypes): - return cwl.InputArraySchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputEnumSchemaTypes): - return cwl.InputEnumSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, cwl_utils.parser.InputRecordSchemaTypes): - return cwl.InputRecordSchema.fromDoc( - input_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(input_type, str): - return input_type - raise WorkflowException(f"Unexpected input type: {input_type}.") - - -def input_type_schema_to_cwl_v1_2_input_type_schema( - input_type: cwl_utils.parser.InputTypeSchemas, loading_options: cwl.LoadingOptions -) -> InputTypeSchemas: - if is_sequence(input_type): - return [ - _input_type_schema_to_cwl_v1_2_input_type_schema( - input_type_item, loading_options - ) - for input_type_item in input_type - ] - return _input_type_schema_to_cwl_v1_2_input_type_schema(input_type, loading_options) - - -def _output_type_schema_to_cwl_v1_2_output_type_schema( - output_type: cwl_utils.parser.BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, -) -> BasicOutputTypeSchemas: - if isinstance(output_type, cwl_utils.parser.OutputArraySchemaTypes): - return cwl.OutputArraySchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputEnumSchemaTypes): - return cwl.OutputEnumSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, cwl_utils.parser.OutputRecordSchemaTypes): - return cwl.OutputRecordSchema.fromDoc( - output_type.save(), - loading_options.baseuri, - loading_options, - ) - if isinstance(output_type, str): - return output_type - raise WorkflowException(f"Unexpected output type: {output_type}.") - - -def output_type_schema_to_cwl_v1_2_output_type_schema( - output_type: cwl_utils.parser.OutputTypeSchemas, loading_options: cwl.LoadingOptions -) -> OutputTypeSchemas: - if is_sequence(output_type): - return [ - _output_type_schema_to_cwl_v1_2_output_type_schema( - output_type_item, loading_options - ) - for output_type_item in output_type - ] - return _output_type_schema_to_cwl_v1_2_output_type_schema( - output_type, loading_options - ) - - def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, loading_options: cwl.LoadingOptions, @@ -718,63 +640,62 @@ def merge_flatten_type(src: Any) -> Any: return cwl.ArraySchema(type_="array", items=src) +def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: + return cwl.InputArraySchema(type_="array", items=type_) + + +def to_output_array(type_: OutputTypeSchemas) -> cwl.OutputArraySchema: + return cwl.OutputArraySchema(type_="array", items=type_) + + def type_for_step_input( step: cwl.WorkflowStep, in_: cwl.WorkflowStepInput, -) -> InputTypeSchemas: +) -> cwl_utils.parser.utils.InputTypeSchemas | None: """Determine the type for the given step input.""" if in_.valueFrom is not None: return "Any" step_run = cwl_utils.parser.utils.load_step(step) 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 step_input.id.split("#")[-1] == in_.id.split("#")[-1]: - if step_input.type_ is not None: - step_input_type = input_type_schema_to_cwl_v1_2_input_type_schema( - step_input.type_, step.loadingOptions - ) - else: - step_input_type = "null" - if step.scatter is not None and in_.id in aslist(step.scatter): - return cwl.InputArraySchema(items=step_input_type, type_="array") - return step_input_type + for step_input in step_run.inputs: + if step_input.id.split("#")[-1] == in_.id.split("#")[-1]: + input_type = step_input.type_ + if ( + input_type is not None + and step.scatter is not None + and in_.id in aslist(step.scatter) + ): + input_type = cwl_utils.parser.utils.to_input_array( + input_type, step_run.cwlVersion or "v1.2" + ) + return input_type return "Any" def type_for_step_output( step: cwl.WorkflowStep, sourcename: str, -) -> Any: +) -> cwl_utils.parser.utils.OutputTypeSchemas | None: """Determine the type for the given step output.""" step_run = cwl_utils.parser.utils.load_step(step) cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - if step_run and step_run.outputs: - for output in step_run.outputs: - if ( - output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - output_type = output.type_ - if step.scatter is not None: - if output_type is not None: - output_type_type = ( - output_type_schema_to_cwl_v1_2_output_type_schema( - output_type, step.loadingOptions - ) - ) - else: - output_type_type = "null" - if step.scatterMethod == "nested_crossproduct": - for _ in range(len(aslist(step.scatter))): - output_type_type = cwl.OutputArraySchema( - items=output_type_type, type_="array" - ) - return output_type_type - else: - return cwl.OutputArraySchema( - items=output_type_type, type_="array" + for output in step_run.outputs: + if ( + output.id.split("#")[-1].split("/")[-1] + == sourcename.split("#")[-1].split("/")[-1] + ): + output_type = output.type_ + if output_type is not None and step.scatter is not None: + if step.scatterMethod == "nested_crossproduct": + for _ in range(len(aslist(step.scatter))): + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.2" ) + else: + output_type = cwl_utils.parser.utils.to_output_array( + output_type, step_run.cwlVersion or "v1.2" + ) + return output_type raise ValidationException( "param {} not found in {}.".format( sourcename, @@ -958,8 +879,8 @@ def param_for_source_id( ): params.append(output) if scatter_context is not None: - if scatter_context is not None: - if isinstance(step.scatter, str): + match step.scatter: + case str(): scatter_context.append( ( 1, @@ -967,9 +888,7 @@ def param_for_source_id( or "dotproduct", ) ) - elif isinstance( - step.scatter, MutableSequence - ): + case Sequence(): scatter_context.append( ( len(step.scatter), @@ -977,7 +896,7 @@ def param_for_source_id( or "dotproduct", ) ) - else: + case _: scatter_context.append(None) if len(params) == 1: return params[0] diff --git a/src/cwl_utils/parser/utils.py b/src/cwl_utils/parser/utils.py index 52fbb696..69b93a37 100644 --- a/src/cwl_utils/parser/utils.py +++ b/src/cwl_utils/parser/utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence from pathlib import Path from types import ModuleType -from typing import Any, Final, Optional, cast +from typing import Any, Final, Optional, cast, Literal, TypeAlias, overload from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -34,11 +34,41 @@ OperationOutputParameter, WorkflowInputParameter, WorkflowOutputParameter, + OutputArraySchema, + InputArraySchema, ) _logger = logging.getLogger("cwl_utils") +BasicInputTypeSchemas: TypeAlias = ( + cwl_v1_0_utils.BasicInputTypeSchemas + | cwl_v1_1_utils.BasicInputTypeSchemas + | cwl_v1_2_utils.BasicInputTypeSchemas +) + + +InputTypeSchemas: TypeAlias = ( + cwl_v1_0_utils.InputTypeSchemas + | cwl_v1_1_utils.InputTypeSchemas + | cwl_v1_2_utils.InputTypeSchemas +) + + +BasicOutputTypeSchemas: TypeAlias = ( + cwl_v1_0_utils.BasicOutputTypeSchemas + | cwl_v1_1_utils.BasicOutputTypeSchemas + | cwl_v1_2_utils.BasicOutputTypeSchemas +) + + +OutputTypeSchemas: TypeAlias = ( + cwl_v1_0_utils.OutputTypeSchemas + | cwl_v1_1_utils.OutputTypeSchemas + | cwl_v1_2_utils.OutputTypeSchemas +) + + def convert_stdstreams_to_files(process: Process) -> None: """Convert stdin, stdout and stderr type shortcuts to files.""" match process: @@ -221,7 +251,7 @@ def static_checker(workflow: Workflow) -> None: type_dict, ) workflow_outputs_val = cwl_v1_0_utils.check_all_types( - src_dict, cast(cwl_v1_0.Workflow, workflow).outputs, type_dict + src_dict, workflow.outputs, type_dict ) case "v1.1": parser = cwl_v1_1 @@ -231,7 +261,7 @@ def static_checker(workflow: Workflow) -> None: type_dict, ) workflow_outputs_val = cwl_v1_1_utils.check_all_types( - src_dict, cast(cwl_v1_1.Workflow, workflow).outputs, type_dict + src_dict, workflow.outputs, type_dict ) case "v1.2": parser = cwl_v1_2 @@ -342,6 +372,78 @@ def static_checker(workflow: Workflow) -> None: raise ValidationException(all_exception_msg) +@overload +def to_input_array( + type_: InputTypeSchemas, cwlVersion: Literal["v1.0"] +) -> cwl_v1_0.InputArraySchema: ... + + +@overload +def to_input_array( + type_: InputTypeSchemas, cwlVersion: Literal["v1.1"] +) -> cwl_v1_1.InputArraySchema: ... + + +@overload +def to_input_array( + type_: InputTypeSchemas, cwlVersion: Literal["v1.2"] +) -> cwl_v1_2.InputArraySchema: ... + + +def to_input_array( + type_: InputTypeSchemas, cwlVersion: Literal["v1.0", "v1.1", "v1.2"] +) -> InputArraySchema: + match cwlVersion: + case "v1.0": + return cwl_v1_0_utils.to_input_array( + cast(cwl_v1_0_utils.InputTypeSchemas, type_) + ) + case "v1.1": + return cwl_v1_1_utils.to_input_array( + cast(cwl_v1_1_utils.InputTypeSchemas, type_) + ) + case "v1.2": + return cwl_v1_2_utils.to_input_array( + cast(cwl_v1_2_utils.InputTypeSchemas, type_) + ) + + +@overload +def to_output_array( + type_: OutputTypeSchemas, cwlVersion: Literal["v1.0"] +) -> cwl_v1_0.OutputArraySchema: ... + + +@overload +def to_output_array( + type_: OutputTypeSchemas, cwlVersion: Literal["v1.1"] +) -> cwl_v1_1.OutputArraySchema: ... + + +@overload +def to_output_array( + type_: OutputTypeSchemas, cwlVersion: Literal["v1.2"] +) -> cwl_v1_2.OutputArraySchema: ... + + +def to_output_array( + type_: OutputTypeSchemas, cwlVersion: Literal["v1.0", "v1.1", "v1.2"] +) -> OutputArraySchema: + match cwlVersion: + case "v1.0": + return cwl_v1_0_utils.to_output_array( + cast(cwl_v1_0_utils.OutputTypeSchemas, type_) + ) + case "v1.1": + return cwl_v1_1_utils.to_output_array( + cast(cwl_v1_1_utils.OutputTypeSchemas, type_) + ) + case "v1.2": + return cwl_v1_2_utils.to_output_array( + cast(cwl_v1_2_utils.OutputTypeSchemas, type_) + ) + + def type_for_source( process: Process, sourcenames: str | list[str], @@ -353,36 +455,21 @@ def type_for_source( match process.cwlVersion: case "v1.0": return cwl_v1_0_utils.type_for_source( - cast( - cwl_v1_0.CommandLineTool - | cwl_v1_0.Workflow - | cwl_v1_0.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_0.Workflow | None, parent), linkMerge, ) case "v1.1": return cwl_v1_1_utils.type_for_source( - cast( - cwl_v1_1.CommandLineTool - | cwl_v1_1.Workflow - | cwl_v1_1.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_1.Workflow | None, parent), linkMerge, ) case "v1.2": return cwl_v1_2_utils.type_for_source( - cast( - cwl_v1_2.CommandLineTool - | cwl_v1_2.Workflow - | cwl_v1_2.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_2.Workflow | None, parent), linkMerge, @@ -398,7 +485,7 @@ def type_for_source( def type_for_step_input( step: WorkflowStep, in_: WorkflowStepInput, cwlVersion: str -) -> Any: +) -> InputTypeSchemas | None: """Determine the type for the given step output.""" match cwlVersion: case "v1.0": @@ -413,9 +500,13 @@ def type_for_step_input( return cwl_v1_2_utils.type_for_step_input( cast(cwl_v1_2.WorkflowStep, step), cast(cwl_v1_2.WorkflowStepInput, in_) ) + case _: + raise Exception(f"Unsupported CWL version {cwlVersion}") -def type_for_step_output(step: WorkflowStep, sourcename: str, cwlVersion: str) -> Any: +def type_for_step_output( + step: WorkflowStep, sourcename: str, cwlVersion: str +) -> OutputTypeSchemas | None: """Determine the type for the given step output.""" match cwlVersion: case "v1.0": @@ -430,6 +521,8 @@ def type_for_step_output(step: WorkflowStep, sourcename: str, cwlVersion: str) - return cwl_v1_2_utils.type_for_step_output( cast(cwl_v1_2.WorkflowStep, step), sourcename ) + case _: + raise Exception(f"Unsupported CWL version {cwlVersion}") def param_for_source_id( @@ -458,24 +551,14 @@ def param_for_source_id( match process.cwlVersion: case "v1.0": return cwl_v1_0_utils.param_for_source_id( - cast( - cwl_v1_0.CommandLineTool - | cwl_v1_0.Workflow - | cwl_v1_0.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_0.Workflow, parent), scatter_context, ) case "v1.1": return cwl_v1_1_utils.param_for_source_id( - cast( - cwl_v1_1.CommandLineTool - | cwl_v1_1.Workflow - | cwl_v1_1.ExpressionTool, - process, - ), + process, sourcenames, cast(cwl_v1_1.Workflow, parent), scatter_context, From dccf400c367e538a33bf926b0b4ea2662520b797 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sat, 4 Apr 2026 20:27:32 +0200 Subject: [PATCH 17/23] Regenerate parsers without abstract classes --- .gitignore | 3 - src/cwl_utils/parser/cwl_v1_0.py | 732 ++++++++--------- src/cwl_utils/parser/cwl_v1_0_utils.py | 26 +- src/cwl_utils/parser/cwl_v1_1.py | 914 ++++++++++----------- src/cwl_utils/parser/cwl_v1_1_utils.py | 26 +- src/cwl_utils/parser/cwl_v1_2.py | 1002 +++++++++++------------- src/cwl_utils/parser/cwl_v1_2_utils.py | 67 +- src/cwl_utils/types.py | 4 +- 8 files changed, 1243 insertions(+), 1531 deletions(-) diff --git a/.gitignore b/.gitignore index 376eb398..0900bed7 100644 --- a/.gitignore +++ b/.gitignore @@ -111,9 +111,6 @@ testenv*/ # PyCharm .idea/ -# UV -uv.lock - # Backup files *.orig *~ diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 6a6e814b..69e2713b 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -14,13 +14,13 @@ import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec from abc import ABCMeta, abstractmethod -from collections.abc import MutableMapping, MutableSequence, Sequence from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 +from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from mypy_extensions import i32, i64, trait -from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from mypy_extensions import i32, i64 from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -213,7 +213,6 @@ def graph(self) -> Graph: return graph -@trait class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @@ -1186,12 +1185,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_0" -@trait -class Documented(Saveable, metaclass=ABCMeta): - doc: None | Sequence[str] | str - - -class RecordField(Documented): +class RecordField(Saveable): """ A field of a record. """ @@ -1456,9 +1450,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ + self.doc = doc + self.name = name + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1650,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[RecordField] = fields - self.type_: Literal["record"] = type_ + self.fields = fields + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1922,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2122,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items - self.type_: Literal["array"] = type_ + self.items = items + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2321,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_: Literal["map"] = type_ - self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values + self.type_ = type_ + self.values = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2520,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names - self.type_: Literal["union"] = type_ + self.names = names + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2719,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items - self.type_: Literal["array"] = type_ + self.items = items + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2986,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ + self.doc = doc + self.name = name + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3186,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CWLRecordField] = fields - self.type_: Literal["record"] = type_ + self.fields = fields + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3984,17 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "File" - self.location: None | str = location - self.path: None | str = path - self.basename: None | str = basename - self.dirname: None | str = dirname - self.nameroot: None | str = nameroot - self.nameext: None | str = nameext - self.checksum: None | str = checksum - self.size: None | i32 = size - self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles - self.format: None | str = format - self.contents: None | str = contents + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4054,7 +4048,7 @@ class Directory(Saveable): the same Directory. When executing a CommandLineTool, Directories must be recursively staged - first and have local values of `path` assigend. + first and have local values of `path` assigned. Directory objects in CommandLineTool output must provide either a `location` URI or a `path` property in the context of the tool execution @@ -4396,54 +4390,16 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location: None | str = location - self.path: None | str = path - self.basename: None | str = basename - self.listing: None | Sequence[Directory | File] = listing + self.location = location + self.path = path + self.basename = basename + self.listing = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] ) -@trait -class SchemaBase(Saveable, metaclass=ABCMeta): - label: None | str - - -@trait -class Parameter(SchemaBase, metaclass=ABCMeta): - """ - Define an input or output parameter to a process. - - """ - - label: None | str - secondaryFiles: None | Sequence[str] | str - streamable: None | bool - doc: None | Sequence[str] | str - - -@trait -class InputBinding(Saveable, metaclass=ABCMeta): - loadContents: None | bool - - -@trait -class OutputBinding(Saveable, metaclass=ABCMeta): - pass - - -@trait -class InputSchema(SchemaBase, metaclass=ABCMeta): - label: None | str - - -@trait -class OutputSchema(SchemaBase, metaclass=ABCMeta): - label: None | str - - class InputRecordField(CWLRecordField): name: str @@ -4816,18 +4772,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.inputBinding: CommandLineBinding | None = inputBinding - self.label: None | str = label + self.doc = doc + self.name = name + self.type_ = type_ + self.inputBinding = inputBinding + self.label = label attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "inputBinding", "label"] ) -class InputRecordSchema(CWLRecordSchema, InputSchema): +class InputRecordSchema(CWLRecordSchema): name: str def __eq__(self, other: Any) -> bool: @@ -5142,15 +5098,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[InputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) -class InputEnumSchema(EnumSchema, InputSchema): +class InputEnumSchema(EnumSchema): name: str def __eq__(self, other: Any) -> bool: @@ -5524,18 +5480,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.inputBinding: CommandLineBinding | None = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "inputBinding"] ) -class InputArraySchema(CWLArraySchema, InputSchema): +class InputArraySchema(CWLArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): return bool( @@ -5842,10 +5798,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.inputBinding: CommandLineBinding | None = inputBinding + self.items = items + self.type_ = type_ + self.label = label + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "inputBinding"] @@ -6170,17 +6126,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ - self.outputBinding: CommandOutputBinding | None = outputBinding + self.doc = doc + self.name = name + self.type_ = type_ + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "outputBinding"] ) -class OutputRecordSchema(CWLRecordSchema, OutputSchema): +class OutputRecordSchema(CWLRecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): return bool( @@ -6430,14 +6386,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[OutputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label + self.fields = fields + self.type_ = type_ + self.label = label attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label"]) -class OutputEnumSchema(EnumSchema, OutputSchema): +class OutputEnumSchema(EnumSchema): name: str def __eq__(self, other: Any) -> bool: @@ -6811,18 +6767,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.outputBinding: CommandOutputBinding | None = outputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "outputBinding"] ) -class OutputArraySchema(CWLArraySchema, OutputSchema): +class OutputArraySchema(CWLArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): return bool( @@ -7129,17 +7085,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.outputBinding: CommandOutputBinding | None = outputBinding + self.items = items + self.type_ = type_ + self.label = label + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "outputBinding"] ) -class InputParameter(Parameter): +class InputParameter(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -7743,15 +7699,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | Sequence[str] | str = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | Sequence[str] | str = format - self.inputBinding: CommandLineBinding | None = inputBinding - self.default: CWLObjectType | None = default - self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.inputBinding = inputBinding + self.default = default + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -7768,7 +7724,7 @@ def __init__( ) -class OutputParameter(Parameter): +class OutputParameter(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -8262,13 +8218,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | Sequence[str] | str = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.outputBinding: CommandOutputBinding | None = outputBinding - self.format: None | str = format + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format attrs: ClassVar[Collection[str]] = frozenset( [ @@ -8283,42 +8239,7 @@ def __init__( ) -@trait -class ProcessRequirement(Saveable, metaclass=ABCMeta): - """ - A process requirement declares a prerequisite that may or must be fulfilled - before executing a process. See [`Process.hints`](#process) and - [`Process.requirements`](#process). - - Process requirements are the primary mechanism for specifying extensions to - the CWL core specification. - - """ - - pass - - -@trait -class Process(Saveable, metaclass=ABCMeta): - """ - - The base executable type in CWL is the `Process` object defined by the - document. Note that the `Process` object is abstract and cannot be - directly executed. - - """ - - id: None | str - inputs: Sequence[InputParameter] - outputs: Sequence[OutputParameter] - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] - label: None | str - doc: None | str - cwlVersion: Literal["v1.0"] | None - - -class InlineJavascriptRequirement(ProcessRequirement): +class InlineJavascriptRequirement(Saveable): """ Indicates that the workflow platform must support inline Javascript expressions. If this requirement is not present, the workflow platform must not perform expression @@ -8495,12 +8416,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib: None | Sequence[str] = expressionLib + self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) -class SchemaDefRequirement(ProcessRequirement): +class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when interpreting the `inputs` and `outputs` fields. When a `type` field @@ -8676,7 +8597,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types: Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema] = types + self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8884,13 +8805,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName: str = envName - self.envValue: str = envValue + self.envName = envName + self.envValue = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) -class CommandLineBinding(InputBinding): +class CommandLineBinding(Saveable): """ When listed under `inputBinding` in the input schema, the term @@ -9416,13 +9337,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents: None | bool = loadContents - self.position: None | i32 = position - self.prefix: None | str = prefix - self.separate: None | bool = separate - self.itemSeparator: None | str = itemSeparator - self.valueFrom: None | str = valueFrom - self.shellQuote: None | bool = shellQuote + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9437,7 +9358,7 @@ def __init__( ) -class CommandOutputBinding(OutputBinding): +class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced by a CommandLineTool. @@ -9706,9 +9627,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.glob: None | Sequence[str] | str = glob - self.loadContents: None | bool = loadContents - self.outputEval: None | str = outputEval + self.glob = glob + self.loadContents = loadContents + self.outputEval = outputEval attrs: ClassVar[Collection[str]] = frozenset(["glob", "loadContents", "outputEval"]) @@ -10085,11 +10006,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.inputBinding: CommandLineBinding | None = inputBinding - self.label: None | str = label + self.doc = doc + self.name = name + self.type_ = type_ + self.inputBinding = inputBinding + self.label = label attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "inputBinding", "label"] @@ -10411,10 +10332,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CommandInputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @@ -10793,11 +10714,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.inputBinding: CommandLineBinding | None = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "inputBinding"] @@ -11111,10 +11032,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.inputBinding: CommandLineBinding | None = inputBinding + self.items = items + self.type_ = type_ + self.label = label + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "inputBinding"] @@ -11439,10 +11360,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.outputBinding: CommandOutputBinding | None = outputBinding + self.doc = doc + self.name = name + self.type_ = type_ + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "outputBinding"] @@ -11764,10 +11685,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CommandOutputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @@ -12146,11 +12067,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.outputBinding: CommandOutputBinding | None = outputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "outputBinding"] @@ -12464,10 +12385,10 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.outputBinding: CommandOutputBinding | None = outputBinding + self.items = items + self.type_ = type_ + self.label = label + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "outputBinding"] @@ -13082,15 +13003,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | Sequence[str] | str = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | Sequence[str] | str = format - self.inputBinding: CommandLineBinding | None = inputBinding - self.default: CWLObjectType | None = default - self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.inputBinding = inputBinding + self.default = default + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -13660,14 +13581,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | Sequence[str] | str = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.outputBinding: CommandOutputBinding | None = outputBinding - self.format: None | str = format - self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | None | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -13683,7 +13604,7 @@ def __init__( ) -class CommandLineTool(Process): +class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -14711,23 +14632,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs: Sequence[CommandInputParameter] = inputs - self.outputs: Sequence[CommandOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints - self.label: None | str = label - self.doc: None | str = doc - self.cwlVersion: Literal["v1.0"] | None = cwlVersion + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion self.class_: Final[str] = "CommandLineTool" - self.baseCommand: None | Sequence[str] | str = baseCommand - self.arguments: None | Sequence[CommandLineBinding | str] = arguments - self.stdin: None | str = stdin - self.stderr: None | str = stderr - self.stdout: None | str = stdout - self.successCodes: None | Sequence[i32] = successCodes - self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes - self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14752,7 +14673,7 @@ def __init__( ) -class DockerRequirement(ProcessRequirement): +class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a [Docker](http://docker.com) container, and specifies how to fetch or build @@ -15254,12 +15175,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "DockerRequirement" - self.dockerPull: None | str = dockerPull - self.dockerLoad: None | str = dockerLoad - self.dockerFile: None | str = dockerFile - self.dockerImport: None | str = dockerImport - self.dockerImageId: None | str = dockerImageId - self.dockerOutputDirectory: None | str = dockerOutputDirectory + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -15274,7 +15195,7 @@ def __init__( ) -class SoftwareRequirement(ProcessRequirement): +class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of the defined process. @@ -15445,7 +15366,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages: Sequence[SoftwarePackage] = packages + self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -15699,9 +15620,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package: str = package - self.version: None | Sequence[str] = version - self.specs: None | Sequence[str] = specs + self.package = package + self.version = version + self.specs = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -15967,14 +15888,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname: None | str = entryname - self.entry: str = entry - self.writable: None | bool = writable + self.entryname = entryname + self.entry = entry + self.writable = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) -class InitialWorkDirRequirement(ProcessRequirement): +class InitialWorkDirRequirement(Saveable): """ Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. """ @@ -16143,12 +16064,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing: Sequence[Directory | Dirent | File | str] | str = listing + self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) -class EnvVarRequirement(ProcessRequirement): +class EnvVarRequirement(Saveable): """ Define a list of environment variables which will be set in the execution environment of the tool. See `EnvironmentDef` for details. @@ -16319,17 +16240,17 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef: Sequence[EnvironmentDef] = envDef + self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) -class ShellCommandRequirement(ProcessRequirement): +class ShellCommandRequirement(Saveable): """ Modify the behavior of CommandLineTool to generate a single string containing a shell command line. Each item in the argument list must be joined into a string separated by single spaces and quoted to prevent - intepretation by the shell, unless `CommandLineBinding` for that argument + interpretation by the shell, unless `CommandLineBinding` for that argument contains `shellQuote: false`. If `shellQuote: false` is specified, the argument is joined into the command string without quoting, which allows the use of shell metacharacters such as `|` for pipes. @@ -16448,7 +16369,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ResourceRequirement(ProcessRequirement): +class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -17041,14 +16962,14 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ResourceRequirement" - self.coresMin: None | i32 | str = coresMin - self.coresMax: None | i32 | str = coresMax - self.ramMin: None | i32 | str = ramMin - self.ramMax: None | i32 | str = ramMax - self.tmpdirMin: None | i32 | str = tmpdirMin - self.tmpdirMax: None | i32 | str = tmpdirMax - self.outdirMin: None | i32 | str = outdirMin - self.outdirMax: None | i32 | str = outdirMax + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -17614,14 +17535,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | Sequence[str] | str = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.outputBinding: CommandOutputBinding | None = outputBinding - self.format: None | str = format - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -17637,7 +17558,7 @@ def __init__( ) -class ExpressionTool(Process): +class ExpressionTool(Saveable): """ Execute an expression as a Workflow step. @@ -18272,16 +18193,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs: Sequence[InputParameter] = inputs - self.outputs: Sequence[ExpressionToolOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints - self.label: None | str = label - self.doc: None | str = doc - self.cwlVersion: Literal["v1.0"] | None = cwlVersion + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion self.class_: Final[str] = "ExpressionTool" - self.expression: str = expression + self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18964,16 +18885,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | Sequence[str] | str = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.outputBinding: CommandOutputBinding | None = outputBinding - self.format: None | str = format - self.outputSource: None | Sequence[str] | str = outputSource - self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18991,13 +18912,7 @@ def __init__( ) -@trait -class Sink(Saveable, metaclass=ABCMeta): - source: None | Sequence[str] | str - linkMerge: Literal["merge_nested", "merge_flattened"] | None - - -class WorkflowStepInput(Sink): +class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input @@ -19409,11 +19324,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.source: None | Sequence[str] | str = source - self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge - self.id: str = id - self.default: CWLObjectType | None = default - self.valueFrom: None | str = valueFrom + self.source = source + self.linkMerge = linkMerge + self.id = id + self.default = default + self.valueFrom = valueFrom attrs: ClassVar[Collection[str]] = frozenset( ["source", "linkMerge", "id", "default", "valueFrom"] @@ -19576,7 +19491,7 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id + self.id = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) @@ -20295,16 +20210,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id - self.in_: Sequence[WorkflowStepInput] = in_ - self.out: Sequence[WorkflowStepOutput | str] = out - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any] = hints - self.label: None | str = label - self.doc: None | str = doc - self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run - self.scatter: None | Sequence[str] | str = scatter - self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod + self.id = id + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.run = run + self.scatter = scatter + self.scatterMethod = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -20322,7 +20237,7 @@ def __init__( ) -class Workflow(Process): +class Workflow(Saveable): """ A workflow describes a set of **steps** and the **dependencies** between those steps. When a step produces output that will be consumed by a @@ -20342,7 +20257,7 @@ class Workflow(Process): The `source` field expresses the dependency of one parameter on another such that when a value is associated with the parameter specified by `source`, that value is propagated to the destination parameter. When all - data links inbound to a given step are fufilled, the step is ready to + data links inbound to a given step are fulfilled, the step is ready to execute. ## Workflow success and failure @@ -20998,16 +20913,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs: Sequence[InputParameter] = inputs - self.outputs: Sequence[WorkflowOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints - self.label: None | str = label - self.doc: None | str = doc - self.cwlVersion: Literal["v1.0"] | None = cwlVersion + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion self.class_: Final[str] = "Workflow" - self.steps: Sequence[WorkflowStep] = steps + self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21025,7 +20940,7 @@ def __init__( ) -class SubworkflowFeatureRequirement(ProcessRequirement): +class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in the `run` field of [WorkflowStep](#WorkflowStep). @@ -21144,7 +21059,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ScatterFeatureRequirement(ProcessRequirement): +class ScatterFeatureRequirement(Saveable): """ Indicates that the workflow platform must support the `scatter` and `scatterMethod` fields of [WorkflowStep](#WorkflowStep). @@ -21263,7 +21178,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class MultipleInputFeatureRequirement(ProcessRequirement): +class MultipleInputFeatureRequirement(Saveable): """ Indicates that the workflow platform must support multiple inbound data links listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). @@ -21382,7 +21297,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class StepInputExpressionRequirement(ProcessRequirement): +class StepInputExpressionRequirement(Saveable): """ Indicate that the workflow platform must support the `valueFrom` field of [WorkflowStepInput](#WorkflowStepInput). @@ -21501,7 +21416,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class LoadListingRequirement(ProcessRequirement): +class LoadListingRequirement(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, LoadListingRequirement): return bool( @@ -21671,12 +21586,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] = loadListing + self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) -class InplaceUpdateRequirement(ProcessRequirement): +class InplaceUpdateRequirement(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): return bool( @@ -21847,12 +21762,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate: bool = inplaceUpdate + self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) -class Secrets(ProcessRequirement): +class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -22016,12 +21931,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets: Sequence[str] = secrets + self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) -class TimeLimit(ProcessRequirement): +class TimeLimit(Saveable): """ Set an upper limit on the execution time of a CommandLineTool or ExpressionTool. A tool execution which exceeds the time limit may @@ -22199,12 +22114,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "TimeLimit" - self.timelimit: i32 | str = timelimit + self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) -class WorkReuse(ProcessRequirement): +class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on the assumption that same code and same input produce same @@ -22387,12 +22302,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse: bool | str = enableReuse + self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) -class NetworkAccess(ProcessRequirement): +class NetworkAccess(Saveable): """ Indicate whether a process requires outgoing IPv4/IPv6 network access. Choice of IPv4 or IPv6 is implementation and site @@ -22582,12 +22497,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess: bool | str = networkAccess + self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) -class ProcessGenerator(Process): +class ProcessGenerator(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -23213,16 +23128,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs: Sequence[InputParameter] = inputs - self.outputs: Sequence[ExpressionToolOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = hints - self.label: None | str = label - self.doc: None | str = doc - self.cwlVersion: Literal["v1.0"] | None = cwlVersion + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion self.class_: Final[str] = "ProcessGenerator" - self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run + self.run = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23240,7 +23155,7 @@ def __init__( ) -class MPIRequirement(ProcessRequirement): +class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. @@ -23415,12 +23330,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes: i32 | str = processes + self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) -class CUDARequirement(ProcessRequirement): +class CUDARequirement(Saveable): """ Require support for NVIDA CUDA (GPU hardware acceleration). @@ -23776,10 +23691,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability - self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax - self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin - self.cudaVersionMin: str = cudaVersionMin + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23792,7 +23707,7 @@ def __init__( ) -class ShmSize(ProcessRequirement): +class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -23957,7 +23872,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize: str = shmSize + self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -25536,6 +25451,39 @@ def __init__( "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) +Documented: TypeAlias = RecordField +Parameter: TypeAlias = InputParameter | OutputParameter +InputBinding: TypeAlias = CommandLineBinding +OutputBinding: TypeAlias = CommandOutputBinding +InputSchema: TypeAlias = InputArraySchema | InputEnumSchema | InputRecordSchema +OutputSchema: TypeAlias = OutputArraySchema | OutputEnumSchema | OutputRecordSchema +ProcessRequirement: TypeAlias = ( + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse +) +Process: TypeAlias = CommandLineTool | ExpressionTool | ProcessGenerator | Workflow +Sink: TypeAlias = WorkflowStepInput +SchemaBase: TypeAlias = InputSchema | OutputSchema | Parameter + def load_document( doc: Any, diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index 4c51b200..74c4a38e 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -324,7 +324,14 @@ def check_all_types( case _: raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: - if isinstance(sourceField, str): + if is_sequence(sourceField): + linkMerge = sink.linkMerge or ( + "merge_nested" if len(sourceField) > 1 else None + ) + srcs_of_sink = [] + for parm_id in sourceField: + srcs_of_sink += [src_dict[parm_id]] + else: parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( @@ -332,13 +339,6 @@ def check_all_types( ) srcs_of_sink = [src_dict[parm_id]] linkMerge = None - else: - linkMerge = sink.linkMerge or ( - "merge_nested" if len(sourceField) > 1 else None - ) - srcs_of_sink = [] - for parm_id in sourceField: - srcs_of_sink += [src_dict[parm_id]] for src in srcs_of_sink: check_result = check_types( type_dict[cast(str, src.id)], @@ -575,21 +575,21 @@ def type_for_source( for _ in range(scatter_context[0][0]): new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) else: new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) if linkMerge == "merge_nested": new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) @@ -612,14 +612,14 @@ def type_for_source( for _ in range(sc[0]): cur_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - cur_type, process.loadingOptions # type: ignore[attr-defined] + cur_type, process.loadingOptions ), type_="array", ) else: cur_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - cur_type, process.loadingOptions # type: ignore[attr-defined] + cur_type, process.loadingOptions ), type_="array", ) diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index f229e0b0..e571c050 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -14,13 +14,13 @@ import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec from abc import ABCMeta, abstractmethod -from collections.abc import MutableMapping, MutableSequence, Sequence from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 +from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from mypy_extensions import i32, i64, trait -from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from mypy_extensions import i32, i64 from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -213,7 +213,6 @@ def graph(self) -> Graph: return graph -@trait class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @@ -1186,12 +1185,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_1" -@trait -class Documented(Saveable, metaclass=ABCMeta): - doc: None | Sequence[str] | str - - -class RecordField(Documented): +class RecordField(Saveable): """ A field of a record. """ @@ -1456,9 +1450,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ + self.doc = doc + self.name = name + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1650,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[RecordField] = fields - self.type_: Literal["record"] = type_ + self.fields = fields + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1922,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2122,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items - self.type_: Literal["array"] = type_ + self.items = items + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2321,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_: Literal["map"] = type_ - self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values + self.type_ = type_ + self.values = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2520,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names - self.type_: Literal["union"] = type_ + self.names = names + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2719,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items - self.type_: Literal["array"] = type_ + self.items = items + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2986,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ + self.doc = doc + self.name = name + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3186,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CWLRecordField] = fields - self.type_: Literal["record"] = type_ + self.fields = fields + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3984,17 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "File" - self.location: None | str = location - self.path: None | str = path - self.basename: None | str = basename - self.dirname: None | str = dirname - self.nameroot: None | str = nameroot - self.nameext: None | str = nameext - self.checksum: None | str = checksum - self.size: None | i32 = size - self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles - self.format: None | str = format - self.contents: None | str = contents + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4054,7 +4048,7 @@ class Directory(Saveable): the same Directory. When executing a CommandLineTool, Directories must be recursively staged - first and have local values of `path` assigend. + first and have local values of `path` assigned. Directory objects in CommandLineTool output must provide either a `location` URI or a `path` property in the context of the tool execution @@ -4396,68 +4390,16 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location: None | str = location - self.path: None | str = path - self.basename: None | str = basename - self.listing: None | Sequence[Directory | File] = listing + self.location = location + self.path = path + self.basename = basename + self.listing = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] ) -@trait -class Labeled(Saveable, metaclass=ABCMeta): - label: None | str - - -@trait -class Identified(Saveable, metaclass=ABCMeta): - id: None | str - - -@trait -class IdentifierRequired(Identified, metaclass=ABCMeta): - id: str - - -@trait -class LoadContents(Saveable, metaclass=ABCMeta): - loadContents: None | bool - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None - - -@trait -class FieldBase(Labeled, metaclass=ABCMeta): - label: None | str - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] - streamable: None | bool - - -@trait -class InputFormat(Saveable, metaclass=ABCMeta): - format: None | Sequence[str] | str - - -@trait -class OutputFormat(Saveable, metaclass=ABCMeta): - format: None | str - - -@trait -class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): - """ - Define an input or output parameter to a process. - - """ - - label: None | str - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] - streamable: None | bool - doc: None | Sequence[str] | str - id: str - - class InputBinding(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, InputBinding): @@ -4600,33 +4542,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents: None | bool = loadContents + self.loadContents = loadContents attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) -@trait -class IOSchema(Labeled, Documented, metaclass=ABCMeta): - label: None | str - doc: None | Sequence[str] | str - name: None | str - - -@trait -class InputSchema(IOSchema, metaclass=ABCMeta): - label: None | str - doc: None | Sequence[str] | str - name: None | str - - -@trait -class OutputSchema(IOSchema, metaclass=ABCMeta): - label: None | str - doc: None | Sequence[str] | str - name: None | str - - -class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): +class InputRecordField(CWLRecordField): name: str def __eq__(self, other: Any) -> bool: @@ -5234,15 +5155,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset( [ @@ -5259,7 +5180,7 @@ def __init__( ) -class InputRecordSchema(CWLRecordSchema, InputSchema): +class InputRecordSchema(CWLRecordSchema): name: str def __eq__(self, other: Any) -> bool: @@ -5628,18 +5549,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[InputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] ) -class InputEnumSchema(EnumSchema, InputSchema): +class InputEnumSchema(EnumSchema): name: str def __eq__(self, other: Any) -> bool: @@ -6008,18 +5929,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] ) -class InputArraySchema(CWLArraySchema, InputSchema): +class InputArraySchema(CWLArraySchema): name: str def __eq__(self, other: Any) -> bool: @@ -6388,18 +6309,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] ) -class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): +class OutputRecordField(CWLRecordField): name: str def __eq__(self, other: Any) -> bool: @@ -6891,20 +6812,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.format: None | str = format + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] ) -class OutputRecordSchema(CWLRecordSchema, OutputSchema): +class OutputRecordSchema(CWLRecordSchema): name: str def __eq__(self, other: Any) -> bool: @@ -7273,18 +7194,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[OutputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] ) -class OutputEnumSchema(EnumSchema, OutputSchema): +class OutputEnumSchema(EnumSchema): name: str def __eq__(self, other: Any) -> bool: @@ -7653,18 +7574,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] ) -class OutputArraySchema(CWLArraySchema, OutputSchema): +class OutputArraySchema(CWLArraySchema): name: str def __eq__(self, other: Any) -> bool: @@ -8033,76 +7954,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] ) -@trait -class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): - label: None | str - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] - streamable: None | bool - doc: None | Sequence[str] | str - id: str - format: None | Sequence[str] | str - loadContents: None | bool - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None - default: CWLObjectType | None - - -@trait -class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): - label: None | str - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] - streamable: None | bool - doc: None | Sequence[str] | str - id: str - format: None | str - - -@trait -class ProcessRequirement(Saveable, metaclass=ABCMeta): - """ - A process requirement declares a prerequisite that may or must be fulfilled - before executing a process. See [`Process.hints`](#process) and - [`Process.requirements`](#process). - - Process requirements are the primary mechanism for specifying extensions to - the CWL core specification. - - """ - - pass - - -@trait -class Process(Identified, Labeled, Documented, metaclass=ABCMeta): - """ - - The base executable type in CWL is the `Process` object defined by the - document. Note that the `Process` object is abstract and cannot be - directly executed. - - """ - - id: None | str - label: None | str - doc: None | Sequence[str] | str - inputs: Sequence[CommandInputParameter | WorkflowInputParameter] - outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter] - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] - cwlVersion: Literal["v1.1"] | None - - -class InlineJavascriptRequirement(ProcessRequirement): +class InlineJavascriptRequirement(Saveable): """ Indicates that the workflow platform must support inline Javascript expressions. If this requirement is not present, the workflow platform must not perform expression @@ -8279,17 +8142,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib: None | Sequence[str] = expressionLib + self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) -@trait -class CommandInputSchema(Saveable, metaclass=ABCMeta): - pass - - -class SchemaDefRequirement(ProcessRequirement): +class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when interpreting the `inputs` and `outputs` fields. When a `type` field @@ -8465,7 +8323,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] = types + self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8665,13 +8523,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern: str = pattern - self.required: None | bool | str = required + self.pattern = pattern + self.required = required attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) -class LoadListingRequirement(ProcessRequirement): +class LoadListingRequirement(Saveable): """ Specify the desired behavior for loading the `listing` field of a Directory object for use by expressions. @@ -8846,7 +8704,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9054,8 +8912,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName: str = envName - self.envValue: str = envValue + self.envName = envName + self.envValue = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @@ -9586,13 +9444,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents: None | bool = loadContents - self.position: None | i32 | str = position - self.prefix: None | str = prefix - self.separate: None | bool = separate - self.itemSeparator: None | str = itemSeparator - self.valueFrom: None | str = valueFrom - self.shellQuote: None | bool = shellQuote + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9607,7 +9465,7 @@ def __init__( ) -class CommandOutputBinding(LoadContents): +class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced by a CommandLineTool. @@ -9933,22 +9791,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.glob: None | Sequence[str] | str = glob - self.outputEval: None | str = outputEval + self.loadContents = loadContents + self.loadListing = loadListing + self.glob = glob + self.outputEval = outputEval attrs: ClassVar[Collection[str]] = frozenset( ["loadContents", "loadListing", "glob", "outputEval"] ) -@trait -class CommandLineBindable(Saveable, metaclass=ABCMeta): - inputBinding: CommandLineBinding | None - - -class CommandInputRecordField(InputRecordField, CommandLineBindable): +class CommandInputRecordField(InputRecordField): name: str def __eq__(self, other: Any) -> bool: @@ -10614,16 +10467,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.inputBinding: CommandLineBinding | None = inputBinding + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -10641,9 +10494,7 @@ def __init__( ) -class CommandInputRecordSchema( - InputRecordSchema, CommandInputSchema, CommandLineBindable -): +class CommandInputRecordSchema(InputRecordSchema): name: str def __eq__(self, other: Any) -> bool: @@ -11078,19 +10929,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CommandInputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding: CommandLineBinding | None = inputBinding + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name", "inputBinding"] ) -class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): +class CommandInputEnumSchema(InputEnumSchema): name: str def __eq__(self, other: Any) -> bool: @@ -11525,21 +11376,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputBinding: CommandLineBinding | None = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc", "inputBinding"] ) -class CommandInputArraySchema( - InputArraySchema, CommandInputSchema, CommandLineBindable -): +class CommandInputArraySchema(InputArraySchema): name: str def __eq__(self, other: Any) -> bool: @@ -11967,12 +11816,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding: CommandLineBinding | None = inputBinding + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name", "inputBinding"] @@ -12529,14 +12378,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.format: None | str = format - self.outputBinding: CommandOutputBinding | None = outputBinding + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -12921,11 +12770,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CommandOutputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -13301,11 +13150,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -13681,18 +13530,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] ) -class CommandInputParameter(InputParameter): +class CommandInputParameter(Saveable): """ An input parameter for a CommandLineTool. """ @@ -14417,17 +14266,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.default: CWLObjectType | None = default - self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.inputBinding: CommandLineBinding | None = inputBinding + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14446,7 +14295,7 @@ def __init__( ) -class CommandOutputParameter(OutputParameter): +class CommandOutputParameter(Saveable): """ An output parameter for a CommandLineTool. """ @@ -15000,14 +14849,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | str = format - self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.outputBinding: CommandOutputBinding | None = outputBinding + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -15023,7 +14872,7 @@ def __init__( ) -class CommandLineTool(Process): +class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -16051,23 +15900,23 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[CommandInputParameter] = inputs - self.outputs: Sequence[CommandOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.1"] | None = cwlVersion + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion self.class_: Final[str] = "CommandLineTool" - self.baseCommand: None | Sequence[str] | str = baseCommand - self.arguments: None | Sequence[CommandLineBinding | str] = arguments - self.stdin: None | str = stdin - self.stderr: None | str = stderr - self.stdout: None | str = stdout - self.successCodes: None | Sequence[i32] = successCodes - self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes - self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16092,7 +15941,7 @@ def __init__( ) -class DockerRequirement(ProcessRequirement): +class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a [Docker](http://docker.com) or Docker-compatible (such as @@ -16612,12 +16461,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "DockerRequirement" - self.dockerPull: None | str = dockerPull - self.dockerLoad: None | str = dockerLoad - self.dockerFile: None | str = dockerFile - self.dockerImport: None | str = dockerImport - self.dockerImageId: None | str = dockerImageId - self.dockerOutputDirectory: None | str = dockerOutputDirectory + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16632,7 +16481,7 @@ def __init__( ) -class SoftwareRequirement(ProcessRequirement): +class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of the defined process. @@ -16803,7 +16652,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages: Sequence[SoftwarePackage] = packages + self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17057,9 +16906,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package: str = package - self.version: None | Sequence[str] = version - self.specs: None | Sequence[str] = specs + self.package = package + self.version = version + self.specs = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -17325,14 +17174,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname: None | str = entryname - self.entry: str = entry - self.writable: None | bool = writable + self.entryname = entryname + self.entry = entry + self.writable = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) -class InitialWorkDirRequirement(ProcessRequirement): +class InitialWorkDirRequirement(Saveable): """ Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. """ @@ -17501,12 +17350,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str = listing + self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) -class EnvVarRequirement(ProcessRequirement): +class EnvVarRequirement(Saveable): """ Define a list of environment variables which will be set in the execution environment of the tool. See `EnvironmentDef` for details. @@ -17677,17 +17526,17 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef: Sequence[EnvironmentDef] = envDef + self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) -class ShellCommandRequirement(ProcessRequirement): +class ShellCommandRequirement(Saveable): """ Modify the behavior of CommandLineTool to generate a single string containing a shell command line. Each item in the argument list must be joined into a string separated by single spaces and quoted to prevent - intepretation by the shell, unless `CommandLineBinding` for that argument + interpretation by the shell, unless `CommandLineBinding` for that argument contains `shellQuote: false`. If `shellQuote: false` is specified, the argument is joined into the command string without quoting, which allows the use of shell metacharacters such as `|` for pipes. @@ -17806,7 +17655,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ResourceRequirement(ProcessRequirement): +class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -18399,14 +18248,14 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ResourceRequirement" - self.coresMin: None | i32 | str = coresMin - self.coresMax: None | i32 | str = coresMax - self.ramMin: None | i32 | str = ramMin - self.ramMax: None | i32 | str = ramMax - self.tmpdirMin: None | i32 | str = tmpdirMin - self.tmpdirMax: None | i32 | str = tmpdirMax - self.outdirMin: None | i32 | str = outdirMin - self.outdirMax: None | i32 | str = outdirMax + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18423,12 +18272,12 @@ def __init__( ) -class WorkReuse(ProcessRequirement): +class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on the assumption that same code and same input produce same results), control whether to enable or disable the reuse behavior - for a particular tool or step (to accomodate situations where that + for a particular tool or step (to accommodate situations where that assumption is incorrect). A reused step is not executed but instead returns the same output as the original execution. @@ -18606,12 +18455,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse: bool | str = enableReuse + self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) -class NetworkAccess(ProcessRequirement): +class NetworkAccess(Saveable): """ Indicate whether a process requires outgoing IPv4/IPv6 network access. Choice of IPv4 or IPv6 is implementation and site @@ -18626,7 +18475,7 @@ class NetworkAccess(ProcessRequirement): may apply their own security policies to restrict what is accessible by the tool. - Enabling network access does not imply a publically routable IP + Enabling network access does not imply a publicly routable IP address or the ability to accept inbound connections. """ @@ -18801,12 +18650,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess: bool | str = networkAccess + self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) -class InplaceUpdateRequirement(ProcessRequirement): +class InplaceUpdateRequirement(Saveable): """ If `inplaceUpdate` is true, then an implementation supporting this @@ -18824,7 +18673,7 @@ class InplaceUpdateRequirement(ProcessRequirement): read-only in every step. Workflow steps which modify a file must produce the modified file - as output. Downstream steps which futher process the file must + as output. Downstream steps which further process the file must use the output of previous steps, and not refer to a common input (this is necessary for both ordering and correctness). @@ -19011,12 +18860,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate: bool = inplaceUpdate + self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) -class ToolTimeLimit(ProcessRequirement): +class ToolTimeLimit(Saveable): """ Set an upper limit on the execution time of a CommandLineTool. A CommandLineTool whose execution duration exceeds the time @@ -19197,12 +19046,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ToolTimeLimit" - self.timelimit: i32 | str = timelimit + self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) -class ExpressionToolOutputParameter(OutputParameter): +class ExpressionToolOutputParameter(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -19694,20 +19543,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | str = format - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] ) -class WorkflowInputParameter(InputParameter): +class WorkflowInputParameter(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -20428,17 +20277,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.default: CWLObjectType | None = default - self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.inputBinding: InputBinding | None = inputBinding + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -20457,7 +20306,7 @@ def __init__( ) -class ExpressionTool(Process): +class ExpressionTool(Saveable): """ An ExpressionTool is a type of Process object that can be run by itself or as a Workflow step. It executes a pure Javascript expression that has @@ -21098,16 +20947,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[WorkflowInputParameter] = inputs - self.outputs: Sequence[ExpressionToolOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.1"] | None = cwlVersion + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion self.class_: Final[str] = "ExpressionTool" - self.expression: str = expression + self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21125,7 +20974,7 @@ def __init__( ) -class WorkflowOutputParameter(OutputParameter): +class WorkflowOutputParameter(Saveable): """ Describe an output parameter of a workflow. The parameter must be connected to one or more parameters defined in the workflow that @@ -21734,15 +21583,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | str = format - self.outputSource: None | Sequence[str] | str = outputSource - self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21759,19 +21608,13 @@ def __init__( ) -@trait -class Sink(Saveable, metaclass=ABCMeta): - source: None | Sequence[str] | str - linkMerge: Literal["merge_nested", "merge_flattened"] | None - - -class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): +class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input parameters of the process specified by the `run` field. Only input parameters declared by the target process will be passed through at runtime to the process - though additonal parameters may be specified (for use within `valueFrom` + though additional parameters may be specified (for use within `valueFrom` expressions for instance) - unconnected or unused parameters do not represent an error condition. @@ -22358,14 +22201,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id - self.source: None | Sequence[str] | str = source - self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.label: None | str = label - self.default: CWLObjectType | None = default - self.valueFrom: None | str = valueFrom + self.id = id + self.source = source + self.linkMerge = linkMerge + self.loadContents = loadContents + self.loadListing = loadListing + self.label = label + self.default = default + self.valueFrom = valueFrom attrs: ClassVar[Collection[str]] = frozenset( [ @@ -22381,7 +22224,7 @@ def __init__( ) -class WorkflowStepOutput(IdentifierRequired): +class WorkflowStepOutput(Saveable): """ Associate an output parameter of the underlying process with a workflow parameter. The workflow parameter (given in the `id` field) be may be used @@ -22541,12 +22384,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id + self.id = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) -class WorkflowStep(IdentifierRequired, Labeled, Documented): +class WorkflowStep(Saveable): """ A workflow step is an executable element of a workflow. It specifies the underlying process implementation (such as `CommandLineTool` or another @@ -23262,16 +23105,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.in_: Sequence[WorkflowStepInput] = in_ - self.out: Sequence[WorkflowStepOutput | str] = out - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any] = hints - self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run - self.scatter: None | Sequence[str] | str = scatter - self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod + self.id = id + self.label = label + self.doc = doc + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.run = run + self.scatter = scatter + self.scatterMethod = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23289,7 +23132,7 @@ def __init__( ) -class Workflow(Process): +class Workflow(Saveable): """ A workflow describes a set of **steps** and the **dependencies** between those steps. When a step produces output that will be consumed by a @@ -23309,7 +23152,7 @@ class Workflow(Process): The `source` field expresses the dependency of one parameter on another such that when a value is associated with the parameter specified by `source`, that value is propagated to the destination parameter. When all - data links inbound to a given step are fufilled, the step is ready to + data links inbound to a given step are fulfilled, the step is ready to execute. ## Workflow success and failure @@ -23965,16 +23808,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[WorkflowInputParameter] = inputs - self.outputs: Sequence[WorkflowOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.1"] | None = cwlVersion + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion self.class_: Final[str] = "Workflow" - self.steps: Sequence[WorkflowStep] = steps + self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23992,7 +23835,7 @@ def __init__( ) -class SubworkflowFeatureRequirement(ProcessRequirement): +class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in the `run` field of [WorkflowStep](#WorkflowStep). @@ -24111,7 +23954,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ScatterFeatureRequirement(ProcessRequirement): +class ScatterFeatureRequirement(Saveable): """ Indicates that the workflow platform must support the `scatter` and `scatterMethod` fields of [WorkflowStep](#WorkflowStep). @@ -24230,7 +24073,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class MultipleInputFeatureRequirement(ProcessRequirement): +class MultipleInputFeatureRequirement(Saveable): """ Indicates that the workflow platform must support multiple inbound data links listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). @@ -24349,7 +24192,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class StepInputExpressionRequirement(ProcessRequirement): +class StepInputExpressionRequirement(Saveable): """ Indicate that the workflow platform must support the `valueFrom` field of [WorkflowStepInput](#WorkflowStepInput). @@ -24468,7 +24311,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class Secrets(ProcessRequirement): +class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -24632,12 +24475,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets: Sequence[str] = secrets + self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) -class ProcessGenerator(Process): +class ProcessGenerator(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -25265,16 +25108,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[WorkflowInputParameter] = inputs - self.outputs: Sequence[ExpressionToolOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.1"] | None = cwlVersion + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion self.class_: Final[str] = "ProcessGenerator" - self.run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str = run + self.run = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25292,7 +25135,7 @@ def __init__( ) -class MPIRequirement(ProcessRequirement): +class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. @@ -25467,12 +25310,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes: i32 | str = processes + self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) -class CUDARequirement(ProcessRequirement): +class CUDARequirement(Saveable): """ Require support for NVIDA CUDA (GPU hardware acceleration). @@ -25828,10 +25671,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability - self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax - self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin - self.cudaVersionMin: str = cudaVersionMin + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25844,7 +25687,7 @@ def __init__( ) -class ShmSize(ProcessRequirement): +class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -26009,7 +25852,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize: str = shmSize + self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -27711,6 +27554,61 @@ def __init__( "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) +Sink: TypeAlias = WorkflowStepInput +InputSchema: TypeAlias = InputArraySchema | InputEnumSchema | InputRecordSchema +OutputSchema: TypeAlias = OutputArraySchema | OutputEnumSchema | OutputRecordSchema +InputParameter: TypeAlias = CommandInputParameter | WorkflowInputParameter +OutputParameter: TypeAlias = ( + CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter +) +ProcessRequirement: TypeAlias = ( + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse +) +Process: TypeAlias = CommandLineTool | ExpressionTool | ProcessGenerator | Workflow +CommandInputSchema: TypeAlias = ( + CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema +) +CommandLineBindable: TypeAlias = ( + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordField + | CommandInputRecordSchema +) +IOSchema: TypeAlias = InputSchema | OutputSchema +LoadContents: TypeAlias = ( + CommandOutputBinding | InputParameter | InputRecordField | WorkflowStepInput +) +InputFormat: TypeAlias = InputParameter | InputRecordField +OutputFormat: TypeAlias = OutputParameter | OutputRecordField +Parameter: TypeAlias = InputParameter | OutputParameter +Documented: TypeAlias = IOSchema | Parameter | Process | RecordField | WorkflowStep +IdentifierRequired: TypeAlias = ( + Parameter | WorkflowStep | WorkflowStepInput | WorkflowStepOutput +) +FieldBase: TypeAlias = InputRecordField | OutputRecordField | Parameter +Identified: TypeAlias = IdentifierRequired | Process +Labeled: TypeAlias = FieldBase | IOSchema | Process | WorkflowStep | WorkflowStepInput + def load_document( doc: Any, diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index 2eda1792..2331fbaa 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -334,7 +334,14 @@ def check_all_types( case _: raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: - if isinstance(sourceField, str): + if is_sequence(sourceField): + linkMerge = sink.linkMerge or ( + "merge_nested" if len(sourceField) > 1 else None + ) + srcs_of_sink = [] + for parm_id in sourceField: + srcs_of_sink += [src_dict[parm_id]] + else: parm_id = sourceField if parm_id not in src_dict: raise SourceLine(sink, sourceName, ValidationException).makeError( @@ -342,13 +349,6 @@ def check_all_types( ) srcs_of_sink = [src_dict[parm_id]] linkMerge = None - else: - linkMerge = sink.linkMerge or ( - "merge_nested" if len(sourceField) > 1 else None - ) - srcs_of_sink = [] - for parm_id in sourceField: - srcs_of_sink += [src_dict[parm_id]] for src in srcs_of_sink: check_result = check_types( type_dict[cast(str, src.id)], @@ -600,21 +600,21 @@ def type_for_source( for _ in range(scatter_context[0][0]): new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) else: new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) if linkMerge == "merge_nested": new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) @@ -637,14 +637,14 @@ def type_for_source( for _ in range(sc[0]): cur_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - cur_type, process.loadingOptions # type: ignore[attr-defined] + cur_type, process.loadingOptions ), type_="array", ) else: cur_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - cur_type, process.loadingOptions # type: ignore[attr-defined] + cur_type, process.loadingOptions ), type_="array", ) diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index be96ca70..4b7fa99d 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -14,13 +14,13 @@ import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 import xml.sax # nosec from abc import ABCMeta, abstractmethod -from collections.abc import MutableMapping, MutableSequence, Sequence from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 +from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from mypy_extensions import i32, i64, trait -from typing import Any, Final, Generic, TypeAlias, TypeVar, cast +from mypy_extensions import i32, i64 from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit from urllib.request import pathname2url @@ -213,7 +213,6 @@ def graph(self) -> Graph: return graph -@trait class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @@ -1186,12 +1185,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_2" -@trait -class Documented(Saveable, metaclass=ABCMeta): - doc: None | Sequence[str] | str - - -class RecordField(Documented): +class RecordField(Saveable): """ A field of a record. """ @@ -1456,9 +1450,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = type_ + self.doc = doc + self.name = name + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -1656,8 +1650,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[RecordField] = fields - self.type_: Literal["record"] = type_ + self.fields = fields + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -1928,9 +1922,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) @@ -2128,8 +2122,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = items - self.type_: Literal["array"] = type_ + self.items = items + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2327,8 +2321,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_: Literal["map"] = type_ - self.values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = values + self.type_ = type_ + self.values = values attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) @@ -2526,8 +2520,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str = names - self.type_: Literal["union"] = type_ + self.names = names + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) @@ -2725,8 +2719,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = items - self.type_: Literal["array"] = type_ + self.items = items + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) @@ -2992,9 +2986,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str = type_ + self.doc = doc + self.name = name + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) @@ -3192,8 +3186,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CWLRecordField] = fields - self.type_: Literal["record"] = type_ + self.fields = fields + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) @@ -3990,17 +3984,17 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "File" - self.location: None | str = location - self.path: None | str = path - self.basename: None | str = basename - self.dirname: None | str = dirname - self.nameroot: None | str = nameroot - self.nameext: None | str = nameext - self.checksum: None | str = checksum - self.size: None | i32 = size - self.secondaryFiles: None | Sequence[Directory | File] = secondaryFiles - self.format: None | str = format - self.contents: None | str = contents + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents attrs: ClassVar[Collection[str]] = frozenset( [ @@ -4396,68 +4390,16 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Directory" - self.location: None | str = location - self.path: None | str = path - self.basename: None | str = basename - self.listing: None | Sequence[Directory | File] = listing + self.location = location + self.path = path + self.basename = basename + self.listing = listing attrs: ClassVar[Collection[str]] = frozenset( ["class", "location", "path", "basename", "listing"] ) -@trait -class Labeled(Saveable, metaclass=ABCMeta): - label: None | str - - -@trait -class Identified(Saveable, metaclass=ABCMeta): - id: None | str - - -@trait -class IdentifierRequired(Identified, metaclass=ABCMeta): - id: str - - -@trait -class LoadContents(Saveable, metaclass=ABCMeta): - loadContents: None | bool - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None - - -@trait -class FieldBase(Labeled, metaclass=ABCMeta): - label: None | str - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] - streamable: None | bool - - -@trait -class InputFormat(Saveable, metaclass=ABCMeta): - format: None | Sequence[str] | str - - -@trait -class OutputFormat(Saveable, metaclass=ABCMeta): - format: None | str - - -@trait -class Parameter(FieldBase, Documented, IdentifierRequired, metaclass=ABCMeta): - """ - Define an input or output parameter to a process. - - """ - - label: None | str - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] - streamable: None | bool - doc: None | Sequence[str] | str - id: str - - class InputBinding(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, InputBinding): @@ -4600,33 +4542,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents: None | bool = loadContents + self.loadContents = loadContents attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) -@trait -class IOSchema(Labeled, Documented, metaclass=ABCMeta): - label: None | str - doc: None | Sequence[str] | str - name: None | str - - -@trait -class InputSchema(IOSchema, metaclass=ABCMeta): - label: None | str - doc: None | Sequence[str] | str - name: None | str - - -@trait -class OutputSchema(IOSchema, metaclass=ABCMeta): - label: None | str - doc: None | Sequence[str] | str - name: None | str - - -class InputRecordField(CWLRecordField, FieldBase, InputFormat, LoadContents): +class InputRecordField(CWLRecordField): name: str def __eq__(self, other: Any) -> bool: @@ -5234,15 +5155,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset( [ @@ -5259,7 +5180,7 @@ def __init__( ) -class InputRecordSchema(CWLRecordSchema, InputSchema): +class InputRecordSchema(CWLRecordSchema): name: str def __eq__(self, other: Any) -> bool: @@ -5628,18 +5549,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[InputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] ) -class InputEnumSchema(EnumSchema, InputSchema): +class InputEnumSchema(EnumSchema): name: str def __eq__(self, other: Any) -> bool: @@ -6008,18 +5929,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] ) -class InputArraySchema(CWLArraySchema, InputSchema): +class InputArraySchema(CWLArraySchema): name: str def __eq__(self, other: Any) -> bool: @@ -6388,18 +6309,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] ) -class OutputRecordField(CWLRecordField, FieldBase, OutputFormat): +class OutputRecordField(CWLRecordField): name: str def __eq__(self, other: Any) -> bool: @@ -6891,20 +6812,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.format: None | str = format + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format attrs: ClassVar[Collection[str]] = frozenset( ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] ) -class OutputRecordSchema(CWLRecordSchema, OutputSchema): +class OutputRecordSchema(CWLRecordSchema): name: str def __eq__(self, other: Any) -> bool: @@ -7273,18 +7194,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[OutputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] ) -class OutputEnumSchema(EnumSchema, OutputSchema): +class OutputEnumSchema(EnumSchema): name: str def __eq__(self, other: Any) -> bool: @@ -7653,18 +7574,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] ) -class OutputArraySchema(CWLArraySchema, OutputSchema): +class OutputArraySchema(CWLArraySchema): name: str def __eq__(self, other: Any) -> bool: @@ -8033,77 +7954,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] ) -@trait -class InputParameter(Parameter, InputFormat, LoadContents, metaclass=ABCMeta): - label: None | str - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] - streamable: None | bool - doc: None | Sequence[str] | str - id: str - format: None | Sequence[str] | str - loadContents: None | bool - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None - default: CWLObjectType | None - - -@trait -class OutputParameter(Parameter, OutputFormat, metaclass=ABCMeta): - label: None | str - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] - streamable: None | bool - doc: None | Sequence[str] | str - id: str - format: None | str - - -@trait -class ProcessRequirement(Saveable, metaclass=ABCMeta): - """ - A process requirement declares a prerequisite that may or must be fulfilled - before executing a process. See [`Process.hints`](#process) and - [`Process.requirements`](#process). - - Process requirements are the primary mechanism for specifying extensions to - the CWL core specification. - - """ - - pass - - -@trait -class Process(Identified, Labeled, Documented, metaclass=ABCMeta): - """ - - The base executable type in CWL is the `Process` object defined by the - document. Note that the `Process` object is abstract and cannot be - directly executed. - - """ - - id: None | str - label: None | str - doc: None | Sequence[str] | str - inputs: Sequence[CommandInputParameter | OperationInputParameter | WorkflowInputParameter] - outputs: Sequence[CommandOutputParameter | ExpressionToolOutputParameter | OperationOutputParameter | WorkflowOutputParameter] - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] - cwlVersion: Literal["v1.2"] | None - intent: None | Sequence[str] - - -class InlineJavascriptRequirement(ProcessRequirement): +class InlineJavascriptRequirement(Saveable): """ Indicates that the workflow platform must support inline Javascript expressions. If this requirement is not present, the workflow platform must not perform expression @@ -8280,17 +8142,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib: None | Sequence[str] = expressionLib + self.expressionLib = expressionLib attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) -@trait -class CommandInputSchema(Saveable, metaclass=ABCMeta): - pass - - -class SchemaDefRequirement(ProcessRequirement): +class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when interpreting the `inputs` and `outputs` fields. When a `type` field @@ -8471,7 +8328,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SchemaDefRequirement" - self.types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] = types + self.types = types attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @@ -8688,13 +8545,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.pattern: str = pattern - self.required: None | bool | str = required + self.pattern = pattern + self.required = required attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) -class LoadListingRequirement(ProcessRequirement): +class LoadListingRequirement(Saveable): """ Specify the desired behavior for loading the `listing` field of a Directory object for use by expressions. @@ -8869,7 +8726,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "LoadListingRequirement" - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing + self.loadListing = loadListing attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @@ -9077,8 +8934,8 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName: str = envName - self.envValue: str = envValue + self.envName = envName + self.envValue = envValue attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @@ -9609,13 +9466,13 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents: None | bool = loadContents - self.position: None | i32 | str = position - self.prefix: None | str = prefix - self.separate: None | bool = separate - self.itemSeparator: None | str = itemSeparator - self.valueFrom: None | str = valueFrom - self.shellQuote: None | bool = shellQuote + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote attrs: ClassVar[Collection[str]] = frozenset( [ @@ -9630,7 +9487,7 @@ def __init__( ) -class CommandOutputBinding(LoadContents): +class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced by a CommandLineTool. @@ -9956,22 +9813,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.glob: None | Sequence[str] | str = glob - self.outputEval: None | str = outputEval + self.loadContents = loadContents + self.loadListing = loadListing + self.glob = glob + self.outputEval = outputEval attrs: ClassVar[Collection[str]] = frozenset( ["loadContents", "loadListing", "glob", "outputEval"] ) -@trait -class CommandLineBindable(Saveable, metaclass=ABCMeta): - inputBinding: CommandLineBinding | None - - -class CommandInputRecordField(InputRecordField, CommandLineBindable): +class CommandInputRecordField(InputRecordField): name: str def __eq__(self, other: Any) -> bool: @@ -10637,16 +10489,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.inputBinding: CommandLineBinding | None = inputBinding + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -10664,9 +10516,7 @@ def __init__( ) -class CommandInputRecordSchema( - InputRecordSchema, CommandInputSchema, CommandLineBindable -): +class CommandInputRecordSchema(InputRecordSchema): name: str def __eq__(self, other: Any) -> bool: @@ -11101,19 +10951,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CommandInputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding: CommandLineBinding | None = inputBinding + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name", "inputBinding"] ) -class CommandInputEnumSchema(InputEnumSchema, CommandInputSchema, CommandLineBindable): +class CommandInputEnumSchema(InputEnumSchema): name: str def __eq__(self, other: Any) -> bool: @@ -11548,21 +11398,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputBinding: CommandLineBinding | None = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc", "inputBinding"] ) -class CommandInputArraySchema( - InputArraySchema, CommandInputSchema, CommandLineBindable -): +class CommandInputArraySchema(InputArraySchema): name: str def __eq__(self, other: Any) -> bool: @@ -11990,12 +11838,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding: CommandLineBinding | None = inputBinding + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name", "inputBinding"] @@ -12552,14 +12400,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc: None | Sequence[str] | str = doc - self.name: str = name - self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.format: None | str = format - self.outputBinding: CommandOutputBinding | None = outputBinding + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -12944,11 +12792,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields: None | Sequence[CommandOutputRecordField] = fields - self.type_: Literal["record"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["fields", "type", "label", "doc", "name"] @@ -13324,11 +13172,11 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols: Sequence[str] = symbols - self.type_: Literal["enum"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc attrs: ClassVar[Collection[str]] = frozenset( ["name", "symbols", "type", "label", "doc"] @@ -13704,18 +13552,18 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = items - self.type_: Literal["array"] = type_ - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.name: str = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( ["items", "type", "label", "doc", "name"] ) -class CommandInputParameter(InputParameter): +class CommandInputParameter(Saveable): """ An input parameter for a CommandLineTool. """ @@ -14440,17 +14288,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.default: CWLObjectType | None = default - self.type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.inputBinding: CommandLineBinding | None = inputBinding + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -14469,7 +14317,7 @@ def __init__( ) -class CommandOutputParameter(OutputParameter): +class CommandOutputParameter(Saveable): """ An output parameter for a CommandLineTool. """ @@ -15023,14 +14871,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | str = format - self.type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.outputBinding: CommandOutputBinding | None = outputBinding + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -15046,7 +14894,7 @@ def __init__( ) -class CommandLineTool(Process): +class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -16128,24 +15976,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[CommandInputParameter] = inputs - self.outputs: Sequence[CommandOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.2"] | None = cwlVersion - self.intent: None | Sequence[str] = intent + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent self.class_: Final[str] = "CommandLineTool" - self.baseCommand: None | Sequence[str] | str = baseCommand - self.arguments: None | Sequence[CommandLineBinding | str] = arguments - self.stdin: None | str = stdin - self.stderr: None | str = stderr - self.stdout: None | str = stdout - self.successCodes: None | Sequence[i32] = successCodes - self.temporaryFailCodes: None | Sequence[i32] = temporaryFailCodes - self.permanentFailCodes: None | Sequence[i32] = permanentFailCodes + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16171,7 +16019,7 @@ def __init__( ) -class DockerRequirement(ProcessRequirement): +class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a [Docker](https://docker.com) or Docker-compatible (such as @@ -16691,12 +16539,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "DockerRequirement" - self.dockerPull: None | str = dockerPull - self.dockerLoad: None | str = dockerLoad - self.dockerFile: None | str = dockerFile - self.dockerImport: None | str = dockerImport - self.dockerImageId: None | str = dockerImageId - self.dockerOutputDirectory: None | str = dockerOutputDirectory + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ @@ -16711,7 +16559,7 @@ def __init__( ) -class SoftwareRequirement(ProcessRequirement): +class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of the defined process. @@ -16882,7 +16730,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "SoftwareRequirement" - self.packages: Sequence[SoftwarePackage] = packages + self.packages = packages attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @@ -17136,9 +16984,9 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package: str = package - self.version: None | Sequence[str] = version - self.specs: None | Sequence[str] = specs + self.package = package + self.version = version + self.specs = specs attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @@ -17408,14 +17256,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname: None | str = entryname - self.entry: str = entry - self.writable: None | bool = writable + self.entryname = entryname + self.entry = entry + self.writable = writable attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) -class InitialWorkDirRequirement(ProcessRequirement): +class InitialWorkDirRequirement(Saveable): """ Define a list of files and subdirectories that must be staged by the workflow platform prior to executing the command line tool. Normally files are staged within the designated output directory. However, when running inside containers, files may be staged at arbitrary locations, see discussion for [`Dirent.entryname`](#Dirent). Together with `DockerRequirement.dockerOutputDirectory` it is possible to control the locations of both input and output files when running in containers. @@ -17585,12 +17433,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str = listing + self.listing = listing attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) -class EnvVarRequirement(ProcessRequirement): +class EnvVarRequirement(Saveable): """ Define a list of environment variables which will be set in the execution environment of the tool. See `EnvironmentDef` for details. @@ -17761,12 +17609,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "EnvVarRequirement" - self.envDef: Sequence[EnvironmentDef] = envDef + self.envDef = envDef attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) -class ShellCommandRequirement(ProcessRequirement): +class ShellCommandRequirement(Saveable): """ Modify the behavior of CommandLineTool to generate a single string containing a shell command line. Each item in the `arguments` list must @@ -17890,7 +17738,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ResourceRequirement(ProcessRequirement): +class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -18488,14 +18336,14 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ResourceRequirement" - self.coresMin: None | float | i32 | str = coresMin - self.coresMax: None | float | i32 | str = coresMax - self.ramMin: None | float | i32 | str = ramMin - self.ramMax: None | float | i32 | str = ramMax - self.tmpdirMin: None | float | i32 | str = tmpdirMin - self.tmpdirMax: None | float | i32 | str = tmpdirMax - self.outdirMin: None | float | i32 | str = outdirMin - self.outdirMax: None | float | i32 | str = outdirMax + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ @@ -18512,7 +18360,7 @@ def __init__( ) -class WorkReuse(ProcessRequirement): +class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on the assumption that same code and same input produce same @@ -18695,12 +18543,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "WorkReuse" - self.enableReuse: bool | str = enableReuse + self.enableReuse = enableReuse attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) -class NetworkAccess(ProcessRequirement): +class NetworkAccess(Saveable): """ Indicate whether a process requires outgoing IPv4/IPv6 network access. Choice of IPv4 or IPv6 is implementation and site @@ -18890,12 +18738,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "NetworkAccess" - self.networkAccess: bool | str = networkAccess + self.networkAccess = networkAccess attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) -class InplaceUpdateRequirement(ProcessRequirement): +class InplaceUpdateRequirement(Saveable): """ If `inplaceUpdate` is true, then an implementation supporting this @@ -19100,12 +18948,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate: bool = inplaceUpdate + self.inplaceUpdate = inplaceUpdate attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) -class ToolTimeLimit(ProcessRequirement): +class ToolTimeLimit(Saveable): """ Set an upper limit on the execution time of a CommandLineTool. A CommandLineTool whose execution duration exceeds the time @@ -19286,12 +19134,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ToolTimeLimit" - self.timelimit: i32 | str = timelimit + self.timelimit = timelimit attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) -class ExpressionToolOutputParameter(OutputParameter): +class ExpressionToolOutputParameter(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -19783,20 +19631,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | str = format - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] ) -class WorkflowInputParameter(InputParameter): +class WorkflowInputParameter(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -20517,17 +20365,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.default: CWLObjectType | None = default - self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ - self.inputBinding: InputBinding | None = inputBinding + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -20546,7 +20394,7 @@ def __init__( ) -class ExpressionTool(Process): +class ExpressionTool(Saveable): """ An ExpressionTool is a type of Process object that can be run by itself or as a Workflow step. It executes a pure Javascript expression that has @@ -21241,17 +21089,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[WorkflowInputParameter] = inputs - self.outputs: Sequence[ExpressionToolOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.2"] | None = cwlVersion - self.intent: None | Sequence[str] = intent + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent self.class_: Final[str] = "ExpressionTool" - self.expression: str = expression + self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21270,7 +21118,7 @@ def __init__( ) -class WorkflowOutputParameter(OutputParameter): +class WorkflowOutputParameter(Saveable): """ Describe an output parameter of a workflow. The parameter must be connected to one or more parameters defined in the workflow that @@ -21937,16 +21785,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | str = format - self.outputSource: None | Sequence[str] | str = outputSource - self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge - self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.pickValue = pickValue + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -21964,14 +21812,7 @@ def __init__( ) -@trait -class Sink(Saveable, metaclass=ABCMeta): - source: None | Sequence[str] | str - linkMerge: Literal["merge_nested", "merge_flattened"] | None - pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None - - -class WorkflowStepInput(IdentifierRequired, Sink, LoadContents, Labeled): +class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input @@ -22684,15 +22525,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id - self.source: None | Sequence[str] | str = source - self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge - self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.label: None | str = label - self.default: CWLObjectType | None = default - self.valueFrom: None | str = valueFrom + self.id = id + self.source = source + self.linkMerge = linkMerge + self.pickValue = pickValue + self.loadContents = loadContents + self.loadListing = loadListing + self.label = label + self.default = default + self.valueFrom = valueFrom attrs: ClassVar[Collection[str]] = frozenset( [ @@ -22709,7 +22550,7 @@ def __init__( ) -class WorkflowStepOutput(IdentifierRequired): +class WorkflowStepOutput(Saveable): """ Associate an output parameter of the underlying process with a workflow parameter. The workflow parameter (given in the `id` field) be may be used @@ -22869,12 +22710,12 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id + self.id = id attrs: ClassVar[Collection[str]] = frozenset(["id"]) -class WorkflowStep(IdentifierRequired, Labeled, Documented): +class WorkflowStep(Saveable): """ A workflow step is an executable element of a workflow. It specifies the underlying process implementation (such as `CommandLineTool` or another @@ -23669,17 +23510,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.in_: Sequence[WorkflowStepInput] = in_ - self.out: Sequence[WorkflowStepOutput | str] = out - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any] = hints - self.run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str = run - self.when: None | str = when - self.scatter: None | Sequence[str] | str = scatter - self.scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = scatterMethod + self.id = id + self.label = label + self.doc = doc + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.run = run + self.when = when + self.scatter = scatter + self.scatterMethod = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23698,7 +23539,7 @@ def __init__( ) -class Workflow(Process): +class Workflow(Saveable): """ A workflow describes a set of **steps** and the **dependencies** between those steps. When a step produces output that will be consumed by a @@ -24434,17 +24275,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[WorkflowInputParameter] = inputs - self.outputs: Sequence[WorkflowOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.2"] | None = cwlVersion - self.intent: None | Sequence[str] = intent + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent self.class_: Final[str] = "Workflow" - self.steps: Sequence[WorkflowStep] = steps + self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -24463,7 +24304,7 @@ def __init__( ) -class SubworkflowFeatureRequirement(ProcessRequirement): +class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in the `run` field of [WorkflowStep](#WorkflowStep). @@ -24582,7 +24423,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class ScatterFeatureRequirement(ProcessRequirement): +class ScatterFeatureRequirement(Saveable): """ Indicates that the workflow platform must support the `scatter` and `scatterMethod` fields of [WorkflowStep](#WorkflowStep). @@ -24701,7 +24542,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class MultipleInputFeatureRequirement(ProcessRequirement): +class MultipleInputFeatureRequirement(Saveable): """ Indicates that the workflow platform must support multiple inbound data links listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). @@ -24820,7 +24661,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class StepInputExpressionRequirement(ProcessRequirement): +class StepInputExpressionRequirement(Saveable): """ Indicate that the workflow platform must support the `valueFrom` field of [WorkflowStepInput](#WorkflowStepInput). @@ -24939,7 +24780,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) -class OperationInputParameter(InputParameter): +class OperationInputParameter(Saveable): """ Describe an input parameter of an operation. @@ -25607,16 +25448,16 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | Sequence[str] | str = format - self.loadContents: None | bool = loadContents - self.loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = loadListing - self.default: CWLObjectType | None = default - self.type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25634,7 +25475,7 @@ def __init__( ) -class OperationOutputParameter(OutputParameter): +class OperationOutputParameter(Saveable): """ Describe an output parameter of an operation. @@ -26131,20 +25972,20 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label: None | str = label - self.secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = secondaryFiles - self.streamable: None | bool = streamable - self.doc: None | Sequence[str] | str = doc - self.id: str = id - self.format: None | str = format - self.type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] ) -class Operation(Process): +class Operation(Saveable): """ This record describes an abstract operation. It is a potential step of a workflow that has not yet been bound to a concrete @@ -26780,15 +26621,15 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[OperationInputParameter] = inputs - self.outputs: Sequence[OperationOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.2"] | None = cwlVersion - self.intent: None | Sequence[str] = intent + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent self.class_: Final[str] = "Operation" attrs: ClassVar[Collection[str]] = frozenset( @@ -26807,7 +26648,7 @@ def __init__( ) -class Secrets(ProcessRequirement): +class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): return bool(self.class_ == other.class_ and self.secrets == other.secrets) @@ -26971,12 +26812,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Secrets" - self.secrets: Sequence[str] = secrets + self.secrets = secrets attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) -class ProcessGenerator(Process): +class ProcessGenerator(Saveable): id: str def __eq__(self, other: Any) -> bool: @@ -27658,17 +27499,17 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label: None | str = label - self.doc: None | Sequence[str] | str = doc - self.inputs: Sequence[WorkflowInputParameter] = inputs - self.outputs: Sequence[ExpressionToolOutputParameter] = outputs - self.requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = requirements - self.hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = hints - self.cwlVersion: Literal["v1.2"] | None = cwlVersion - self.intent: None | Sequence[str] = intent + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent self.class_: Final[str] = "ProcessGenerator" - self.run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str = run + self.run = run attrs: ClassVar[Collection[str]] = frozenset( [ @@ -27687,7 +27528,7 @@ def __init__( ) -class MPIRequirement(ProcessRequirement): +class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. @@ -27862,12 +27703,12 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "MPIRequirement" - self.processes: i32 | str = processes + self.processes = processes attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) -class CUDARequirement(ProcessRequirement): +class CUDARequirement(Saveable): """ Require support for NVIDA CUDA (GPU hardware acceleration). @@ -28223,10 +28064,10 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability: Sequence[str] | str = cudaComputeCapability - self.cudaDeviceCountMax: None | i32 | str = cudaDeviceCountMax - self.cudaDeviceCountMin: None | i32 | str = cudaDeviceCountMin - self.cudaVersionMin: str = cudaVersionMin + self.cudaComputeCapability = cudaComputeCapability + self.cudaDeviceCountMax = cudaDeviceCountMax + self.cudaDeviceCountMin = cudaDeviceCountMin + self.cudaVersionMin = cudaVersionMin attrs: ClassVar[Collection[str]] = frozenset( [ @@ -28669,19 +28510,19 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.default: Any | None = default - self.id: str = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.linkMerge: Literal["merge_nested", "merge_flattened"] | None = linkMerge - self.loopSource: None | Sequence[str] | str = loopSource - self.pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = pickValue - self.valueFrom: None | str = valueFrom + self.default = default + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.linkMerge = linkMerge + self.loopSource = loopSource + self.pickValue = pickValue + self.valueFrom = valueFrom attrs: ClassVar[Collection[str]] = frozenset( ["default", "id", "linkMerge", "loopSource", "pickValue", "valueFrom"] ) -class Loop(ProcessRequirement): +class Loop(Saveable): """ Prototype to enable workflow-level looping of a step. @@ -28978,16 +28819,16 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "Loop" - self.loop: Sequence[LoopInput] = loop - self.loopWhen: str = loopWhen - self.outputMethod: Literal["last", "all"] = outputMethod + self.loop = loop + self.loopWhen = loopWhen + self.outputMethod = outputMethod attrs: ClassVar[Collection[str]] = frozenset( ["class", "loop", "loopWhen", "outputMethod"] ) -class ShmSize(ProcessRequirement): +class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) @@ -29152,7 +28993,7 @@ def __init__( else: self.loadingOptions = LoadingOptions() self.class_: Final[str] = "ShmSize" - self.shmSize: str = shmSize + self.shmSize = shmSize attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) @@ -30954,6 +30795,69 @@ def __init__( "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" ) +Sink: TypeAlias = WorkflowStepInput +InputSchema: TypeAlias = InputArraySchema | InputEnumSchema | InputRecordSchema +OutputSchema: TypeAlias = OutputArraySchema | OutputEnumSchema | OutputRecordSchema +InputParameter: TypeAlias = ( + CommandInputParameter | OperationInputParameter | WorkflowInputParameter +) +OutputParameter: TypeAlias = ( + CommandOutputParameter + | ExpressionToolOutputParameter + | OperationOutputParameter + | WorkflowOutputParameter +) +ProcessRequirement: TypeAlias = ( + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse +) +Process: TypeAlias = ( + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow +) +CommandInputSchema: TypeAlias = ( + CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema +) +CommandLineBindable: TypeAlias = ( + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordField + | CommandInputRecordSchema +) +IOSchema: TypeAlias = InputSchema | OutputSchema +LoadContents: TypeAlias = ( + CommandOutputBinding | InputParameter | InputRecordField | WorkflowStepInput +) +InputFormat: TypeAlias = InputParameter | InputRecordField +OutputFormat: TypeAlias = OutputParameter | OutputRecordField +Parameter: TypeAlias = InputParameter | OutputParameter +Documented: TypeAlias = IOSchema | Parameter | Process | RecordField | WorkflowStep +IdentifierRequired: TypeAlias = ( + Parameter | WorkflowStep | WorkflowStepInput | WorkflowStepOutput +) +FieldBase: TypeAlias = InputRecordField | OutputRecordField | Parameter +Identified: TypeAlias = IdentifierRequired | Process +Labeled: TypeAlias = FieldBase | IOSchema | Process | WorkflowStep | WorkflowStepInput + def load_document( doc: Any, diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index b2cdade7..1e42a706 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -9,7 +9,7 @@ from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException -from schema_salad.sourceline import SourceLine, add_lc_filename +from schema_salad.sourceline import add_lc_filename, SourceLine from schema_salad.utils import aslist, json_dumps, yaml_no_ts import cwl_utils.parser @@ -358,7 +358,7 @@ def check_all_types( case _: raise WorkflowException(f"Invalid sink type {sink.__class__.__name__}") if sourceField is not None: - if isinstance(sourceField, Sequence) and len (sourceField) > 1: + if is_sequence(sourceField) and len(sourceField) > 1: linkMerge: str | None = sink.linkMerge or ( "merge_nested" if len(sourceField) > 1 else None ) @@ -383,7 +383,7 @@ def check_all_types( src_dict[parm_id], sink, linkMerge, - message="Source is from conditional step, but pickValue is not used", + message="Source is from conditional step and may produce `null`", ) ) type_dict[src_dict[parm_id].id] = src_typ @@ -393,7 +393,7 @@ def check_all_types( items=src_typ, type_="array" ) else: - if isinstance(sourceField, Sequence): + if is_sequence(sourceField): parm_id = sourceField[0] else: parm_id = sourceField @@ -413,54 +413,19 @@ 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[sink.id] - if "null" not in src_typ: - src_typ = ["null"] + cast(list[Any], src_typ) - if ( - not isinstance(snk_typ, MutableSequence) - or "null" not in snk_typ - ): - validation["warning"].append( - SrcSink( - src_dict[parm_id], - sink, - linkMerge, - message="Source is from conditional step and may produce `null`", - ) + validation["warning"].append( + SrcSink( + src_dict[parm_id], + sink, + linkMerge, + message="Source is from conditional step, but pickValue is not used", ) - type_dict[src_dict[parm_id].id] = src_typ + ) if _is_all_output_method_loop_step(param_to_step, parm_id): src_typ = type_dict[src_dict[parm_id].id] type_dict[src_dict[parm_id].id] = cwl.ArraySchema( items=src_typ, type_="array" ) - else: - linkMerge = sink.linkMerge or ( - "merge_nested" if len(sourceField) > 1 else None - ) - if sink.pickValue in ("first_non_null", "the_only_non_null"): - linkMerge = None - srcs_of_sink = [] - for parm_id in sourceField: - srcs_of_sink += [src_dict[parm_id]] - if ( - _is_conditional_step(param_to_step, parm_id) - and sink.pickValue is not None - ): - validation["warning"].append( - SrcSink( - src_dict[parm_id], - sink, - linkMerge, - message="Source is from conditional step, but pickValue is not used", - ) - ) - if _is_all_output_method_loop_step(param_to_step, parm_id): - src_typ = type_dict[src_dict[parm_id].id] - type_dict[src_dict[parm_id].id] = cwl.ArraySchema( - items=src_typ, type_="array" - ) for src in srcs_of_sink: check_result = check_types( type_dict[cast(str, src.id)], @@ -725,21 +690,21 @@ def type_for_source( for _ in range(scatter_context[0][0]): new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) else: new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) if linkMerge == "merge_nested": new_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - new_type, process.loadingOptions # type: ignore[attr-defined] + new_type, process.loadingOptions ), type_="array", ) @@ -766,14 +731,14 @@ def type_for_source( for _ in range(sc[0]): cur_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - cur_type, process.loadingOptions # type: ignore[attr-defined] + cur_type, process.loadingOptions ), type_="array", ) else: cur_type = cwl.OutputArraySchema( items=in_output_type_schema_to_output_type_schema( - cur_type, process.loadingOptions # type: ignore[attr-defined] + cur_type, process.loadingOptions ), type_="array", ) diff --git a/src/cwl_utils/types.py b/src/cwl_utils/types.py index dbc291f6..03f601c5 100644 --- a/src/cwl_utils/types.py +++ b/src/cwl_utils/types.py @@ -7,9 +7,9 @@ from typing import Any, Literal, TypeAlias, TypedDict, TypeGuard if sys.version_info >= (3, 13): - from typing import TypeIs as TypeIs + from typing import TypeIs else: - from typing_extensions import TypeIs as TypeIs + from typing_extensions import TypeIs if sys.version_info >= (3, 11): from typing import Required From 7ab48bdbf162f90958cae67dec2af54816e07919 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sun, 5 Apr 2026 19:58:52 +0200 Subject: [PATCH 18/23] Regenerate parsers with generic Loaders --- src/cwl_utils/parser/__init__.py | 5 +- src/cwl_utils/parser/cwl_v1_0.py | 2878 +++++++++++++++++++-------- src/cwl_utils/parser/cwl_v1_1.py | 2988 ++++++++++++++++++++-------- src/cwl_utils/parser/cwl_v1_2.py | 3143 +++++++++++++++++++++--------- 4 files changed, 6473 insertions(+), 2541 deletions(-) diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index be8c41ef..c77a6be9 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -4,7 +4,7 @@ from abc import ABC from collections.abc import MutableMapping, MutableSequence from pathlib import Path -from typing import Any, Optional, TypeAlias, cast +from typing import Any, Optional, TypeAlias, cast, TypeVar from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -255,7 +255,8 @@ class NoType(ABC): | cwl_v1_2.SchemaDefRequirement ) """Type Union for a CWL v1.x SchemaDefRequirement object.""" -_Loader: TypeAlias = cwl_v1_0._Loader | cwl_v1_1._Loader | cwl_v1_2._Loader +__T = TypeVar("__T", covariant=True) +_Loader: TypeAlias = cwl_v1_0._Loader[__T] | cwl_v1_1._Loader[__T] | cwl_v1_2._Loader[__T] """Type union for a CWL v1.x _Loader.""" diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 69e2713b..23db1d74 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -45,7 +45,9 @@ IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +E = TypeVar("E", bound=str) S = TypeVar("S", bound="Saveable") +T = TypeVar("T", covariant=True) class LoadingOptions: @@ -236,11 +238,11 @@ def save( def load_field( val: Any | None, - fieldtype: "_Loader", + fieldtype: _Loader[T], baseuri: str, loadingOptions: LoadingOptions, lc: Any | None = None, -) -> Any: +) -> T: """Load field.""" if isinstance(val, MutableMapping): if "$import" in val: @@ -442,7 +444,8 @@ def expand_url( return url -class _Loader: +class _Loader(Generic[T], metaclass=ABCMeta): + @abstractmethod def load( self, doc: Any, @@ -450,11 +453,10 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any | None: - pass + ) -> T: ... -class _AnyLoader(_Loader): +class _AnyLoader(_Loader[Any]): def load( self, doc: Any, @@ -468,8 +470,8 @@ def load( raise ValidationException("Expected non-null") -class _PrimitiveLoader(_Loader): - def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: +class _PrimitiveLoader(_Loader[T]): + def __init__(self, tp: type[T]) -> None: self.tp: Final = tp def load( @@ -479,7 +481,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -488,8 +490,8 @@ def __repr__(self) -> str: return str(self.tp) -class _ArrayLoader(_Loader): - def __init__(self, items: _Loader) -> None: +class _ArrayLoader(_Loader[Sequence[T]]): + def __init__(self, items: _Loader[T]) -> None: self.items: Final = items def load( @@ -499,7 +501,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> list[Any]: + ) -> list[T]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -545,10 +547,10 @@ def __repr__(self) -> str: return f"array<{self.items}>" -class _MapLoader(_Loader): +class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, - values: _Loader, + values: _Loader[T], name: str | None = None, container: str | None = None, no_link_check: bool | None = None, @@ -565,7 +567,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> dict[str, Any]: + ) -> dict[str, T]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -588,7 +590,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" -class _EnumLoader(_Loader): +class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -600,17 +602,17 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> str: + ) -> E: if doc in self.symbols: - return cast(str, doc) + return cast(E, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: return self.name -class _SecondaryDSLLoader(_Loader): - def __init__(self, inner: _Loader) -> None: +class _SecondaryDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner def load( @@ -620,7 +622,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: r: Final[list[dict[str, Any]]] = [] match doc: case MutableSequence() as dlist: @@ -682,7 +684,7 @@ def load( return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader, Generic[S]): +class _RecordLoader(_Loader[S]): def __init__( self, classtype: type[S], @@ -716,7 +718,7 @@ def __repr__(self) -> str: return str(self.classtype.__name__) -class _ExpressionLoader(_Loader): +class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -737,12 +739,12 @@ def load( return doc -class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: +class _UnionLoader(_Loader[T]): + def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -752,7 +754,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: errors: Final = [] if lc is None: @@ -827,10 +829,10 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) -class _URILoader(_Loader): +class _URILoader(_Loader[T]): def __init__( self, - inner: _Loader, + inner: _Loader[T], scoped_id: bool, vocab_term: bool, scoped_ref: int | None, @@ -849,7 +851,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check @@ -896,8 +898,8 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: +class _TypeDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -944,7 +946,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -966,8 +968,8 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: +class _IdMapLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -979,7 +981,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -1006,12 +1008,12 @@ def load( def _document_load( - loader: _Loader, + loader: _Loader[T], doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, LoadingOptions]: +) -> tuple[T, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1076,11 +1078,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader, + loader: _Loader[T], url: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, LoadingOptions]: +) -> tuple[T, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1266,14 +1268,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -1394,13 +1396,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1415,7 +1417,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -1738,14 +1740,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -1867,13 +1868,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1888,7 +1889,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -2802,14 +2803,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -2930,13 +2931,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -2951,7 +2952,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -4479,14 +4480,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -4701,7 +4702,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, inputBinding=inputBinding, @@ -4709,7 +4710,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -4724,7 +4725,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -4861,14 +4862,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -5036,14 +5036,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5058,7 +5058,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -5187,14 +5187,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -5410,7 +5409,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -5418,7 +5417,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5433,7 +5432,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -5886,14 +5885,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -6061,14 +6060,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6083,7 +6082,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -6474,14 +6473,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -6697,7 +6695,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -6705,7 +6703,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6720,7 +6718,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -7190,14 +7188,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -7599,7 +7597,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -7611,7 +7609,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -7626,7 +7624,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -7815,14 +7813,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -8130,7 +8128,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -8140,7 +8138,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -8155,7 +8153,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -9713,14 +9711,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -9935,7 +9933,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, inputBinding=inputBinding, @@ -9943,7 +9941,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -9958,7 +9956,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -10095,14 +10093,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -10270,14 +10267,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10292,7 +10289,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -10421,14 +10418,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -10644,7 +10640,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -10652,7 +10648,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10667,7 +10663,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -11120,14 +11116,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -11295,14 +11291,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11317,7 +11313,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -11448,14 +11444,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -11623,14 +11618,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11645,7 +11640,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -11774,14 +11769,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -11997,7 +11991,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -12005,7 +11999,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12020,7 +12014,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -12494,14 +12488,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -12903,7 +12897,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -12915,7 +12909,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -12930,7 +12924,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -13125,14 +13119,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -13487,7 +13481,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -13498,7 +13492,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -13513,7 +13507,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -13720,14 +13714,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -14476,7 +14469,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, inputs=inputs, outputs=outputs, requirements=requirements, @@ -14495,7 +14488,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14510,7 +14503,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -17079,14 +17072,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -17441,7 +17434,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -17452,7 +17445,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -17467,7 +17460,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -17660,14 +17653,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -18088,7 +18080,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, inputs=inputs, outputs=outputs, requirements=requirements, @@ -18100,7 +18092,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -18115,7 +18107,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -18324,14 +18316,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -18780,7 +18772,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -18793,7 +18785,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -18808,7 +18800,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -19036,14 +19028,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id source = None if "source" in _doc: try: @@ -19257,7 +19249,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, source=source, linkMerge=linkMerge, default=default, @@ -19265,7 +19257,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -19280,7 +19272,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.source is not None: u = save_relative_uri(self.source, self.id, False, 2, relative_uris) @@ -19416,14 +19408,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -19447,11 +19439,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -19466,7 +19458,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u # top refers to the directory level @@ -19652,14 +19644,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("in") is None: raise ValidationException("missing required field `in`", None, []) @@ -20111,7 +20103,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, in_=in_, out=out, requirements=requirements, @@ -20124,7 +20116,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20139,7 +20131,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.in_ is not None: r["in"] = save( @@ -20383,14 +20375,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -20811,7 +20802,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, inputs=inputs, outputs=outputs, requirements=requirements, @@ -20823,7 +20814,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20838,7 +20829,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -22599,14 +22590,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -23027,7 +23017,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, inputs=inputs, outputs=outputs, requirements=requirements, @@ -23039,7 +23029,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -23054,7 +23044,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -24100,14 +24090,16 @@ def __init__( "https://w3id.org/cwl/cwl#v1.0": "v1.0", }) -strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(i32) -floattype: Final = _PrimitiveLoader(float) -booltype: Final = _PrimitiveLoader(bool) -None_type: Final = _PrimitiveLoader(type(None)) -Any_type: Final = _AnyLoader() -longtype: Final = _PrimitiveLoader(i64) -PrimitiveTypeLoader: Final = _EnumLoader( +strtype: Final[_Loader[str]] = _PrimitiveLoader(str) +inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +floattype: Final[_Loader[float]] = _PrimitiveLoader(float) +booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) +None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) +Any_type: Final[_Loader[Any]] = _AnyLoader() +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) +PrimitiveTypeLoader: Final[ + _Loader[Literal["null", "boolean", "int", "long", "float", "double", "string"]] +] = _EnumLoader( ( "null", "boolean", @@ -24133,17 +24125,33 @@ def __init__( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader: Final = _EnumLoader(("Any",), "Any") +AnyLoader: Final[_Loader[Literal["Any"]]] = _EnumLoader(("Any",), "Any") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader: Final = _RecordLoader(RecordField, None, None) -RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader: Final = _EnumLoader( +RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( + RecordSchema, None, None +) +EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + ] +] = _EnumLoader( ( "null", "boolean", @@ -24162,72 +24170,116 @@ def __init__( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) -FileLoader: Final = _RecordLoader(File, None, None) -DirectoryLoader: Final = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( - ( - None_type, - CWLObjectTypeLoader, - ) +CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( + CWLArraySchema, None, None ) -array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( - union_of_None_type_or_CWLObjectTypeLoader +CWLRecordFieldLoader: Final[_Loader[CWLRecordField]] = _RecordLoader( + CWLRecordField, None, None ) -map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( - union_of_None_type_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True +CWLRecordSchemaLoader: Final[_Loader[CWLRecordSchema]] = _RecordLoader( + CWLRecordSchema, None, None ) -CWLInputFileLoader: Final = map_of_union_of_None_type_or_CWLObjectTypeLoader -CWLVersionLoader: Final = _EnumLoader(("v1.0",), "CWLVersion") +FileLoader: Final[_Loader[File]] = _RecordLoader(File, None, None) +DirectoryLoader: Final[_Loader[Directory]] = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final[_UnionLoader[Any]] = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final[_Loader[CWLObjectType | None]] = ( + _UnionLoader( + ( + None_type, + CWLObjectTypeLoader, + ) + ) +) +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Sequence[CWLObjectType | None]] +] = _ArrayLoader(union_of_None_type_or_CWLObjectTypeLoader) +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Mapping[str, CWLObjectType | None]] +] = _MapLoader(union_of_None_type_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True) +CWLInputFileLoader: Final[_Loader[Mapping[str, CWLObjectType | None]]] = ( + map_of_union_of_None_type_or_CWLObjectTypeLoader +) +CWLVersionLoader: Final[_Loader[Literal["v1.0"]]] = _EnumLoader(("v1.0",), "CWLVersion") """ Current version symbol for CWL documents. """ -ExpressionLoader: Final = _ExpressionLoader(str) -InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) -InputParameterLoader: Final = _RecordLoader(InputParameter, None, None) -OutputParameterLoader: Final = _RecordLoader(OutputParameter, None, None) -InlineJavascriptRequirementLoader: Final = _RecordLoader( - InlineJavascriptRequirement, None, None +ExpressionLoader = _ExpressionLoader(str) +InputRecordFieldLoader: Final[_Loader[InputRecordField]] = _RecordLoader( + InputRecordField, None, None +) +InputRecordSchemaLoader: Final[_Loader[InputRecordSchema]] = _RecordLoader( + InputRecordSchema, None, None +) +InputEnumSchemaLoader: Final[_Loader[InputEnumSchema]] = _RecordLoader( + InputEnumSchema, None, None +) +InputArraySchemaLoader: Final[_Loader[InputArraySchema]] = _RecordLoader( + InputArraySchema, None, None +) +OutputRecordFieldLoader: Final[_Loader[OutputRecordField]] = _RecordLoader( + OutputRecordField, None, None +) +OutputRecordSchemaLoader: Final[_Loader[OutputRecordSchema]] = _RecordLoader( + OutputRecordSchema, None, None +) +OutputEnumSchemaLoader: Final[_Loader[OutputEnumSchema]] = _RecordLoader( + OutputEnumSchema, None, None +) +OutputArraySchemaLoader: Final[_Loader[OutputArraySchema]] = _RecordLoader( + OutputArraySchema, None, None +) +InputParameterLoader: Final[_Loader[InputParameter]] = _RecordLoader( + InputParameter, None, None +) +OutputParameterLoader: Final[_Loader[OutputParameter]] = _RecordLoader( + OutputParameter, None, None +) +InlineJavascriptRequirementLoader: Final[_Loader[InlineJavascriptRequirement]] = ( + _RecordLoader(InlineJavascriptRequirement, None, None) +) +SchemaDefRequirementLoader: Final[_Loader[SchemaDefRequirement]] = _RecordLoader( + SchemaDefRequirement, None, None +) +EnvironmentDefLoader: Final[_Loader[EnvironmentDef]] = _RecordLoader( + EnvironmentDef, None, None ) -SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) -EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader: Final = _RecordLoader( +CommandLineBindingLoader: Final[_Loader[CommandLineBinding]] = _RecordLoader( + CommandLineBinding, None, None +) +CommandOutputBindingLoader: Final[_Loader[CommandOutputBinding]] = _RecordLoader( + CommandOutputBinding, None, None +) +CommandInputRecordFieldLoader: Final[_Loader[CommandInputRecordField]] = _RecordLoader( CommandInputRecordField, None, None ) -CommandInputRecordSchemaLoader: Final = _RecordLoader( - CommandInputRecordSchema, None, None +CommandInputRecordSchemaLoader: Final[_Loader[CommandInputRecordSchema]] = ( + _RecordLoader(CommandInputRecordSchema, None, None) +) +CommandInputEnumSchemaLoader: Final[_Loader[CommandInputEnumSchema]] = _RecordLoader( + CommandInputEnumSchema, None, None ) -CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader: Final = _RecordLoader( +CommandInputArraySchemaLoader: Final[_Loader[CommandInputArraySchema]] = _RecordLoader( CommandInputArraySchema, None, None ) -CommandOutputRecordFieldLoader: Final = _RecordLoader( - CommandOutputRecordField, None, None +CommandOutputRecordFieldLoader: Final[_Loader[CommandOutputRecordField]] = ( + _RecordLoader(CommandOutputRecordField, None, None) ) -CommandOutputRecordSchemaLoader: Final = _RecordLoader( - CommandOutputRecordSchema, None, None +CommandOutputRecordSchemaLoader: Final[_Loader[CommandOutputRecordSchema]] = ( + _RecordLoader(CommandOutputRecordSchema, None, None) ) -CommandOutputEnumSchemaLoader: Final = _RecordLoader( +CommandOutputEnumSchemaLoader: Final[_Loader[CommandOutputEnumSchema]] = _RecordLoader( CommandOutputEnumSchema, None, None ) -CommandOutputArraySchemaLoader: Final = _RecordLoader( - CommandOutputArraySchema, None, None +CommandOutputArraySchemaLoader: Final[_Loader[CommandOutputArraySchema]] = ( + _RecordLoader(CommandOutputArraySchema, None, None) +) +CommandInputParameterLoader: Final[_Loader[CommandInputParameter]] = _RecordLoader( + CommandInputParameter, None, None +) +CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( + CommandOutputParameter, None, None ) -CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) -stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") +stdoutLoader: Final[_Loader[Literal["stdout"]]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24271,7 +24323,7 @@ def __init__( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader: Final = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final[_Loader[Literal["stderr"]]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24315,39 +24367,61 @@ def __init__( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) -DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) -SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) -DirentLoader: Final = _RecordLoader(Dirent, None, None) -InitialWorkDirRequirementLoader: Final = _RecordLoader( - InitialWorkDirRequirement, None, None +CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( + CommandLineTool, None, None +) +DockerRequirementLoader: Final[_Loader[DockerRequirement]] = _RecordLoader( + DockerRequirement, None, None +) +SoftwareRequirementLoader: Final[_Loader[SoftwareRequirement]] = _RecordLoader( + SoftwareRequirement, None, None +) +SoftwarePackageLoader: Final[_Loader[SoftwarePackage]] = _RecordLoader( + SoftwarePackage, None, None +) +DirentLoader: Final[_Loader[Dirent]] = _RecordLoader(Dirent, None, None) +InitialWorkDirRequirementLoader: Final[_Loader[InitialWorkDirRequirement]] = ( + _RecordLoader(InitialWorkDirRequirement, None, None) +) +EnvVarRequirementLoader: Final[_Loader[EnvVarRequirement]] = _RecordLoader( + EnvVarRequirement, None, None ) -EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader: Final = _RecordLoader( +ShellCommandRequirementLoader: Final[_Loader[ShellCommandRequirement]] = _RecordLoader( ShellCommandRequirement, None, None ) -ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) -ExpressionToolOutputParameterLoader: Final = _RecordLoader( - ExpressionToolOutputParameter, None, None +ResourceRequirementLoader: Final[_Loader[ResourceRequirement]] = _RecordLoader( + ResourceRequirement, None, None ) -ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader: Final = _EnumLoader( - ( - "merge_nested", - "merge_flattened", - ), - "LinkMergeMethod", +ExpressionToolOutputParameterLoader: Final[_Loader[ExpressionToolOutputParameter]] = ( + _RecordLoader(ExpressionToolOutputParameter, None, None) +) +ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( + ExpressionTool, None, None +) +LinkMergeMethodLoader: Final[_Loader[Literal["merge_nested", "merge_flattened"]]] = ( + _EnumLoader( + ( + "merge_nested", + "merge_flattened", + ), + "LinkMergeMethod", + ) ) """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader: Final = _RecordLoader( +WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( WorkflowOutputParameter, None, None ) -WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader: Final = _EnumLoader( +WorkflowStepInputLoader: Final[_Loader[WorkflowStepInput]] = _RecordLoader( + WorkflowStepInput, None, None +) +WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( + WorkflowStepOutput, None, None +) +ScatterMethodLoader: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"]] +] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -24358,44 +24432,68 @@ def __init__( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader: Final = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader: Final = _RecordLoader(Workflow, None, None) -SubworkflowFeatureRequirementLoader: Final = _RecordLoader( - SubworkflowFeatureRequirement, None, None +WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( + WorkflowStep, None, None +) +WorkflowLoader: Final[_Loader[Workflow]] = _RecordLoader(Workflow, None, None) +SubworkflowFeatureRequirementLoader: Final[_Loader[SubworkflowFeatureRequirement]] = ( + _RecordLoader(SubworkflowFeatureRequirement, None, None) +) +ScatterFeatureRequirementLoader: Final[_Loader[ScatterFeatureRequirement]] = ( + _RecordLoader(ScatterFeatureRequirement, None, None) ) -ScatterFeatureRequirementLoader: Final = _RecordLoader( - ScatterFeatureRequirement, None, None +MultipleInputFeatureRequirementLoader: Final[ + _Loader[MultipleInputFeatureRequirement] +] = _RecordLoader(MultipleInputFeatureRequirement, None, None) +StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( + _RecordLoader(StepInputExpressionRequirement, None, None) ) -MultipleInputFeatureRequirementLoader: Final = _RecordLoader( - MultipleInputFeatureRequirement, None, None +LoadListingRequirementLoader: Final[_Loader[LoadListingRequirement]] = _RecordLoader( + LoadListingRequirement, None, None ) -StepInputExpressionRequirementLoader: Final = _RecordLoader( - StepInputExpressionRequirement, None, None +InplaceUpdateRequirementLoader: Final[_Loader[InplaceUpdateRequirement]] = ( + _RecordLoader(InplaceUpdateRequirement, None, None) ) -LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) -InplaceUpdateRequirementLoader: Final = _RecordLoader( - InplaceUpdateRequirement, None, None +SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) +TimeLimitLoader: Final[_Loader[TimeLimit]] = _RecordLoader(TimeLimit, None, None) +WorkReuseLoader: Final[_Loader[WorkReuse]] = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final[_Loader[NetworkAccess]] = _RecordLoader( + NetworkAccess, None, None ) -SecretsLoader: Final = _RecordLoader(Secrets, None, None) -TimeLimitLoader: Final = _RecordLoader(TimeLimit, None, None) -WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) -ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) -MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) -ShmSizeLoader: Final = _RecordLoader(ShmSize, None, None) -array_of_strtype: Final = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype: Final = _UnionLoader( +ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( + ProcessGenerator, None, None +) +MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( + MPIRequirement, None, None +) +CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( + CUDARequirement, None, None +) +ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) +array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None: Final = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +uri_strtype_True_False_None_None: Final[_Loader[str]] = _URILoader( + strtype, True, False, None, None +) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -24406,14 +24504,41 @@ def __init__( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -24425,57 +24550,117 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader: Final = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( +array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( + RecordFieldLoader +) +union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( - union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") +Record_nameLoader: Final[_Loader[Literal["record"]]] = _EnumLoader( + ("record",), "Record_name" +) +typedsl_Record_nameLoader_2: Final[_Loader[Literal["record"]]] = _TypeDSLLoader( + Record_nameLoader, 2, "v1.1" ) -Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype: Final = _UnionLoader( +union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None: Final = _URILoader( - union_of_None_type_or_strtype, True, False, None, None +uri_union_of_None_type_or_strtype_True_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, None) ) -uri_array_of_strtype_True_False_None_None: Final = _URILoader( +uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2: Final = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +Enum_nameLoader: Final[_Loader[Literal["enum"]]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Literal["enum"]]] = _TypeDSLLoader( + Enum_nameLoader, 2, "v1.1" +) +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader: Final = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +Array_nameLoader: Final[_Loader[Literal["array"]]] = _EnumLoader( + ("array",), "Array_name" +) +typedsl_Array_nameLoader_2: Final[_Loader[Literal["array"]]] = _TypeDSLLoader( + Array_nameLoader, 2, "v1.1" +) +Map_nameLoader: Final[_Loader[Literal["map"]]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Literal["map"]]] = _TypeDSLLoader( + Map_nameLoader, 2, "v1.1" +) +Union_nameLoader: Final[_Loader[Literal["union"]]] = _EnumLoader( + ("union",), "Union_name" +) +typedsl_Union_nameLoader_2: Final[_Loader[Literal["union"]]] = _TypeDSLLoader( + Union_nameLoader, 2, "v1.1" +) +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -24484,14 +24669,35 @@ def __init__( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -24501,82 +24707,114 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader: Final = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( +array_of_CWLRecordFieldLoader: Final[_Loader[Sequence[CWLRecordField]]] = _ArrayLoader( + CWLRecordFieldLoader +) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _IdMapLoader( - union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" -) -File_classLoader: Final = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None: Final = _URILoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") +File_classLoader: Final[_Loader[Literal["File"]]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[Literal["File"]]] = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None: Final = _URILoader( - union_of_None_type_or_strtype, False, False, None, None +uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype_or_inttype: Final = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( ( None_type, inttype, inttype, ) ) -union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( - union_of_FileLoader_or_DirectoryLoader -) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( - _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, - ) +array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[Sequence[Directory | File]] +] = _ArrayLoader(union_of_FileLoader_or_DirectoryLoader) +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( + ( + None_type, + array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -uri_union_of_None_type_or_strtype_True_False_None_True: Final = _URILoader( - union_of_None_type_or_strtype, True, False, None, True +uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, True) +) +Directory_classLoader: Final[_Loader[Literal["Directory"]]] = _EnumLoader( + ("Directory",), "Directory_class" ) -Directory_classLoader: Final = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None: Final = _URILoader( - Directory_classLoader, False, True, None, None +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Literal["Directory"]]] = ( + _URILoader(Directory_classLoader, False, True, None, None) ) -union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final[_Loader[str]] = _UnionLoader( ( strtype, ExpressionLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader: Final = _ArrayLoader( - union_of_strtype_or_ExpressionLoader +array_of_union_of_strtype_or_ExpressionLoader: Final[_Loader[Sequence[str]]] = ( + _ArrayLoader(union_of_strtype_or_ExpressionLoader) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader: ( - Final -) = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, @@ -24584,15 +24822,31 @@ def __init__( array_of_union_of_strtype_or_ExpressionLoader, ) ) -union_of_None_type_or_booltype: Final = _UnionLoader( +union_of_None_type_or_booltype: Final[_Loader[None | bool]] = _UnionLoader( ( None_type, booltype, ) ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -24601,14 +24855,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -24618,41 +24923,129 @@ def __init__( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandLineBindingLoader: Final = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | None] +] = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -array_of_InputRecordFieldLoader: Final = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _UnionLoader( +array_of_InputRecordFieldLoader: Final[_Loader[Sequence[InputRecordField]]] = ( + _ArrayLoader(InputRecordFieldLoader) +) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( - _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") -) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -24661,14 +25054,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -24678,60 +25122,166 @@ def __init__( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader: Final = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final[ + _Loader[CommandOutputBinding | None] +] = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_OutputRecordFieldLoader: Final = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _UnionLoader( +array_of_OutputRecordFieldLoader: Final[_Loader[Sequence[OutputRecordField]]] = ( + _ArrayLoader(OutputRecordFieldLoader) +) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( - _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") -) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( - _UnionLoader( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, - ) +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: ( - Final -) = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( None_type, CWLTypeLoader, @@ -24742,36 +25292,98 @@ def __init__( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_ExpressionLoader: Final[_Loader[None | str]] = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( - _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True - ) +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | str] +] = _URILoader( + union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True ) -array_of_InputParameterLoader: Final = _ArrayLoader(InputParameterLoader) -idmap_inputs_array_of_InputParameterLoader: Final = _IdMapLoader( - array_of_InputParameterLoader, "id", "type" +array_of_InputParameterLoader: Final[_Loader[Sequence[InputParameter]]] = _ArrayLoader( + InputParameterLoader ) -array_of_OutputParameterLoader: Final = _ArrayLoader(OutputParameterLoader) -idmap_outputs_array_of_OutputParameterLoader: Final = _IdMapLoader( - array_of_OutputParameterLoader, "id", "type" +idmap_inputs_array_of_InputParameterLoader: Final[_Loader[Sequence[InputParameter]]] = ( + _IdMapLoader(array_of_InputParameterLoader, "id", "type") ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( - Final -) = _UnionLoader( +array_of_OutputParameterLoader: Final[_Loader[Sequence[OutputParameter]]] = ( + _ArrayLoader(OutputParameterLoader) +) +idmap_outputs_array_of_OutputParameterLoader: Final[ + _Loader[Sequence[OutputParameter]] +] = _IdMapLoader(array_of_OutputParameterLoader, "id", "type") +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -24796,29 +25408,126 @@ def __init__( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( - Final -) = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( - Final -) = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -24844,55 +25553,136 @@ def __init__( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | TimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( - ( - None_type, - CWLVersionLoader, +union_of_None_type_or_CWLVersionLoader: Final[_Loader[Literal["v1.0"] | None]] = ( + _UnionLoader( + ( + None_type, + CWLVersionLoader, + ) ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( - union_of_None_type_or_CWLVersionLoader, False, True, None, None -) -InlineJavascriptRequirement_classLoader: Final = _EnumLoader( - ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" -) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( - InlineJavascriptRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_array_of_strtype: Final = _UnionLoader( - ( - None_type, - array_of_strtype, +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ + _Loader[Literal["v1.0"] | None] +] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) +InlineJavascriptRequirement_classLoader: Final[ + _Loader[Literal["InlineJavascriptRequirement"]] +] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["InlineJavascriptRequirement"]] +] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) +union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( + _UnionLoader( + ( + None_type, + array_of_strtype, + ) ) ) -SchemaDefRequirement_classLoader: Final = _EnumLoader( - ("SchemaDefRequirement",), "SchemaDefRequirement_class" -) -uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( - SchemaDefRequirement_classLoader, False, True, None, None +SchemaDefRequirement_classLoader: Final[_Loader[Literal["SchemaDefRequirement"]]] = ( + _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SchemaDefRequirement"]] +] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: ( - Final + Final[_Loader[InputArraySchema | InputEnumSchema | InputRecordSchema]] ) = _UnionLoader( ( InputRecordSchemaLoader, @@ -24900,30 +25690,46 @@ def __init__( InputArraySchemaLoader, ) ) -array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: Final[ + _Loader[Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema]] +] = _ArrayLoader( union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader ) -union_of_None_type_or_inttype: Final = _UnionLoader( +union_of_None_type_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( ( None_type, inttype, ) ) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( - _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, - array_of_strtype, - ) +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + array_of_strtype, ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -24932,14 +25738,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -24949,39 +25806,123 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader: Final = _ArrayLoader( - CommandInputRecordFieldLoader -) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final[ + _Loader[Sequence[CommandInputRecordField]] +] = _ArrayLoader(CommandInputRecordFieldLoader) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -24990,14 +25931,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -25007,39 +25999,141 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandOutputRecordFieldLoader: Final = _ArrayLoader( - CommandOutputRecordFieldLoader -) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[Sequence[CommandOutputRecordField]] +] = _ArrayLoader(CommandOutputRecordFieldLoader) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( None_type, CWLTypeLoader, @@ -25050,16 +26144,86 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stderr"] + | Literal["stdout"] + | None + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( None_type, CWLTypeLoader, @@ -25072,81 +26236,125 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stderr"] + | Literal["stdout"] + | None + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader: Final = _EnumLoader( +CommandLineTool_classLoader: Final[_Loader[Literal["CommandLineTool"]]] = _EnumLoader( ("CommandLineTool",), "CommandLineTool_class" ) -uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( - CommandLineTool_classLoader, False, True, None, None -) -array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( - array_of_CommandInputParameterLoader, "id", "type" -) -array_of_CommandOutputParameterLoader: Final = _ArrayLoader( - CommandOutputParameterLoader -) -idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( - array_of_CommandOutputParameterLoader, "id", "type" -) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( +uri_CommandLineTool_classLoader_False_True_None_None: Final[ + _Loader[Literal["CommandLineTool"]] +] = _URILoader(CommandLineTool_classLoader, False, True, None, None) +array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _IdMapLoader(array_of_CommandInputParameterLoader, "id", "type") +array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _ArrayLoader(CommandOutputParameterLoader) +idmap_outputs_array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _IdMapLoader(array_of_CommandOutputParameterLoader, "id", "type") +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | str] +] = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( - _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) -) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( - Final -) = _UnionLoader( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[Sequence[CommandLineBinding | str]] +] = _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[None | Sequence[CommandLineBinding | str]] +] = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype: Final = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype: Final = _UnionLoader( - ( - None_type, - array_of_inttype, +array_of_inttype: Final[_Loader[Sequence[i32]]] = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final[_Loader[None | Sequence[i32]]] = ( + _UnionLoader( + ( + None_type, + array_of_inttype, + ) ) ) -DockerRequirement_classLoader: Final = _EnumLoader( - ("DockerRequirement",), "DockerRequirement_class" +DockerRequirement_classLoader: Final[_Loader[Literal["DockerRequirement"]]] = ( + _EnumLoader(("DockerRequirement",), "DockerRequirement_class") ) -uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( - DockerRequirement_classLoader, False, True, None, None +uri_DockerRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["DockerRequirement"]] +] = _URILoader(DockerRequirement_classLoader, False, True, None, None) +SoftwareRequirement_classLoader: Final[_Loader[Literal["SoftwareRequirement"]]] = ( + _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) -SoftwareRequirement_classLoader: Final = _EnumLoader( - ("SoftwareRequirement",), "SoftwareRequirement_class" -) -uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( - SoftwareRequirement_classLoader, False, True, None, None -) -array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( - array_of_SoftwarePackageLoader, "package", "specs" -) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( - union_of_None_type_or_array_of_strtype, False, False, None, True -) -InitialWorkDirRequirement_classLoader: Final = _EnumLoader( - ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" -) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _URILoader( - InitialWorkDirRequirement_classLoader, False, True, None, None +uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SoftwareRequirement"]] +] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) +array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( + _ArrayLoader(SoftwarePackageLoader) ) +idmap_packages_array_of_SoftwarePackageLoader: Final[ + _Loader[Sequence[SoftwarePackage]] +] = _IdMapLoader(array_of_SoftwarePackageLoader, "package", "specs") +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ + _Loader[None | Sequence[str]] +] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_classLoader: Final[ + _Loader[Literal["InitialWorkDirRequirement"]] +] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["InitialWorkDirRequirement"]] +] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: ( - Final + Final[_Loader[Directory | Dirent | File | str]] ) = _UnionLoader( ( FileLoader, @@ -25156,54 +26364,58 @@ def __init__( ExpressionLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: Final[ + _Loader[Sequence[Directory | Dirent | File | str]] +] = _ArrayLoader( union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader ) -union_of_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader_or_strtype_or_ExpressionLoader: ( - Final -) = _UnionLoader( +union_of_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader_or_strtype_or_ExpressionLoader: Final[ + _Loader[Sequence[Directory | Dirent | File | str] | str] +] = _UnionLoader( ( array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader, strtype, ExpressionLoader, ) ) -EnvVarRequirement_classLoader: Final = _EnumLoader( - ("EnvVarRequirement",), "EnvVarRequirement_class" -) -uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( - EnvVarRequirement_classLoader, False, True, None, None -) -array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( - array_of_EnvironmentDefLoader, "envName", "envValue" +EnvVarRequirement_classLoader: Final[_Loader[Literal["EnvVarRequirement"]]] = ( + _EnumLoader(("EnvVarRequirement",), "EnvVarRequirement_class") ) -ShellCommandRequirement_classLoader: Final = _EnumLoader( - ("ShellCommandRequirement",), "ShellCommandRequirement_class" +uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["EnvVarRequirement"]] +] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) +array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( + EnvironmentDefLoader ) -uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( - ShellCommandRequirement_classLoader, False, True, None, None +idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( + _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -ResourceRequirement_classLoader: Final = _EnumLoader( - ("ResourceRequirement",), "ResourceRequirement_class" +ShellCommandRequirement_classLoader: Final[ + _Loader[Literal["ShellCommandRequirement"]] +] = _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ShellCommandRequirement"]] +] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) +ResourceRequirement_classLoader: Final[_Loader[Literal["ResourceRequirement"]]] = ( + _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) -uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( - ResourceRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader: Final = ( - _UnionLoader( - ( - None_type, - inttype, - inttype, - strtype, - ExpressionLoader, - ) +uri_ResourceRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ResourceRequirement"]] +] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader: Final[ + _Loader[None | i32 | str] +] = _UnionLoader( + ( + None_type, + inttype, + inttype, + strtype, + ExpressionLoader, ) ) -union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader: Final = _UnionLoader( +union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader: Final[ + _Loader[None | i32 | str] +] = _UnionLoader( ( None_type, inttype, @@ -25211,9 +26423,43 @@ def __init__( ExpressionLoader, ) ) -union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( None_type, CWLTypeLoader, @@ -25224,75 +26470,117 @@ def __init__( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | None + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -ExpressionTool_classLoader: Final = _EnumLoader( +ExpressionTool_classLoader: Final[_Loader[Literal["ExpressionTool"]]] = _EnumLoader( ("ExpressionTool",), "ExpressionTool_class" ) -uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( - ExpressionTool_classLoader, False, True, None, None -) -array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( - ExpressionToolOutputParameterLoader -) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _IdMapLoader( - array_of_ExpressionToolOutputParameterLoader, "id", "type" -) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) -) -union_of_None_type_or_LinkMergeMethodLoader: Final = _UnionLoader( +uri_ExpressionTool_classLoader_False_True_None_None: Final[ + _Loader[Literal["ExpressionTool"]] +] = _URILoader(ExpressionTool_classLoader, False, True, None, None) +array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _ArrayLoader(ExpressionToolOutputParameterLoader) +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _IdMapLoader(array_of_ExpressionToolOutputParameterLoader, "id", "type") +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) +union_of_None_type_or_LinkMergeMethodLoader: Final[ + _Loader[Literal["merge_nested", "merge_flattened"] | None] +] = _UnionLoader( ( None_type, LinkMergeMethodLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) -) -array_of_WorkflowStepInputLoader: Final = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( - array_of_WorkflowStepInputLoader, "id", "source" +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) +array_of_WorkflowStepInputLoader: Final[_Loader[Sequence[WorkflowStepInput]]] = ( + _ArrayLoader(WorkflowStepInputLoader) ) -union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( +idmap_in__array_of_WorkflowStepInputLoader: Final[ + _Loader[Sequence[WorkflowStepInput]] +] = _IdMapLoader(array_of_WorkflowStepInputLoader, "id", "source") +union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[WorkflowStepOutput | str] +] = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( - union_of_strtype_or_WorkflowStepOutputLoader -) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( - (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) -) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( - Final -) = _URILoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _ArrayLoader(union_of_strtype_or_WorkflowStepOutputLoader) +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _UnionLoader((array_of_union_of_strtype_or_WorkflowStepOutputLoader,)) +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type: Final = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( - ( - None_type, - array_of_Any_type, +array_of_Any_type: Final[_Loader[Sequence[Any]]] = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final[_Loader[None | Sequence[Any]]] = ( + _UnionLoader( + ( + None_type, + array_of_Any_type, + ) ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _IdMapLoader( - union_of_None_type_or_array_of_Any_type, "class", "None" -) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ + _Loader[None | Sequence[Any]] +] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +] = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -25301,70 +26589,86 @@ def __init__( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: ( - Final -) = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +] = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) -) -union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) +union_of_None_type_or_ScatterMethodLoader: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] +] = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( - union_of_None_type_or_ScatterMethodLoader, False, True, None, None -) -Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( - Workflow_classLoader, False, True, None, None +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] +] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) +Workflow_classLoader: Final[_Loader[Literal["Workflow"]]] = _EnumLoader( + ("Workflow",), "Workflow_class" ) -array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( - WorkflowOutputParameterLoader +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Literal["Workflow"]]] = ( + _URILoader(Workflow_classLoader, False, True, None, None) ) -idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( - array_of_WorkflowOutputParameterLoader, "id", "type" +array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _ArrayLoader(WorkflowOutputParameterLoader) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _IdMapLoader(array_of_WorkflowOutputParameterLoader, "id", "type") +array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = _ArrayLoader( + WorkflowStepLoader ) -array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( - (array_of_WorkflowStepLoader,) +union_of_array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = ( + _UnionLoader((array_of_WorkflowStepLoader,)) ) -idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( - union_of_array_of_WorkflowStepLoader, "id", "None" -) -SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( +idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ + _Loader[Sequence[WorkflowStep]] +] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_classLoader: Final[ + _Loader[Literal["SubworkflowFeatureRequirement"]] +] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( - SubworkflowFeatureRequirement_classLoader, False, True, None, None -) -ScatterFeatureRequirement_classLoader: Final = _EnumLoader( - ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" -) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( - ScatterFeatureRequirement_classLoader, False, True, None, None -) -MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SubworkflowFeatureRequirement"]] +] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_classLoader: Final[ + _Loader[Literal["ScatterFeatureRequirement"]] +] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ScatterFeatureRequirement"]] +] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_classLoader: Final[ + _Loader[Literal["MultipleInputFeatureRequirement"]] +] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( - _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) -) -StepInputExpressionRequirement_classLoader: Final = _EnumLoader( +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["MultipleInputFeatureRequirement"]] +] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_classLoader: Final[ + _Loader[Literal["StepInputExpressionRequirement"]] +] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( - StepInputExpressionRequirement_classLoader, False, True, None, None +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["StepInputExpressionRequirement"]] +] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) +uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( + strtype, False, True, None, None ) -uri_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) -LoadListingEnumLoader: Final = _EnumLoader( +LoadListingEnumLoader: Final[ + _Loader[Literal["no_listing", "shallow_listing", "deep_listing"]] +] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -25372,44 +26676,50 @@ def __init__( ), "LoadListingEnum", ) -union_of_LoadListingEnumLoader: Final = _UnionLoader((LoadListingEnumLoader,)) -uri_array_of_strtype_False_False_0_None: Final = _URILoader( +union_of_LoadListingEnumLoader: Final[ + _Loader[Literal["no_listing", "shallow_listing", "deep_listing"]] +] = _UnionLoader((LoadListingEnumLoader,)) +uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_inttype_or_strtype: Final = _UnionLoader( +union_of_inttype_or_strtype: Final[_Loader[i32 | str]] = _UnionLoader( ( inttype, strtype, ) ) -union_of_booltype_or_strtype: Final = _UnionLoader( +union_of_booltype_or_strtype: Final[_Loader[bool | str]] = _UnionLoader( ( booltype, strtype, ) ) -union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( ( inttype, ExpressionLoader, ) ) -union_of_strtype_or_array_of_strtype: Final = _UnionLoader( - ( - strtype, - array_of_strtype, +union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( + _UnionLoader( + ( + strtype, + array_of_strtype, + ) ) ) -union_of_None_type_or_inttype_or_ExpressionLoader: Final = _UnionLoader( - ( - None_type, - inttype, - ExpressionLoader, +union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( + _UnionLoader( + ( + None_type, + inttype, + ExpressionLoader, + ) ) ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -25417,14 +26727,20 @@ def __init__( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow]] +] = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + CommandLineTool + | ExpressionTool + | ProcessGenerator + | Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] + | Workflow + ] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index e571c050..b458d593 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -45,7 +45,9 @@ IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +E = TypeVar("E", bound=str) S = TypeVar("S", bound="Saveable") +T = TypeVar("T", covariant=True) class LoadingOptions: @@ -236,11 +238,11 @@ def save( def load_field( val: Any | None, - fieldtype: "_Loader", + fieldtype: _Loader[T], baseuri: str, loadingOptions: LoadingOptions, lc: Any | None = None, -) -> Any: +) -> T: """Load field.""" if isinstance(val, MutableMapping): if "$import" in val: @@ -442,7 +444,8 @@ def expand_url( return url -class _Loader: +class _Loader(Generic[T], metaclass=ABCMeta): + @abstractmethod def load( self, doc: Any, @@ -450,11 +453,10 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any | None: - pass + ) -> T: ... -class _AnyLoader(_Loader): +class _AnyLoader(_Loader[Any]): def load( self, doc: Any, @@ -468,8 +470,8 @@ def load( raise ValidationException("Expected non-null") -class _PrimitiveLoader(_Loader): - def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: +class _PrimitiveLoader(_Loader[T]): + def __init__(self, tp: type[T]) -> None: self.tp: Final = tp def load( @@ -479,7 +481,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -488,8 +490,8 @@ def __repr__(self) -> str: return str(self.tp) -class _ArrayLoader(_Loader): - def __init__(self, items: _Loader) -> None: +class _ArrayLoader(_Loader[Sequence[T]]): + def __init__(self, items: _Loader[T]) -> None: self.items: Final = items def load( @@ -499,7 +501,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> list[Any]: + ) -> list[T]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -545,10 +547,10 @@ def __repr__(self) -> str: return f"array<{self.items}>" -class _MapLoader(_Loader): +class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, - values: _Loader, + values: _Loader[T], name: str | None = None, container: str | None = None, no_link_check: bool | None = None, @@ -565,7 +567,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> dict[str, Any]: + ) -> dict[str, T]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -588,7 +590,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" -class _EnumLoader(_Loader): +class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -600,17 +602,17 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> str: + ) -> E: if doc in self.symbols: - return cast(str, doc) + return cast(E, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: return self.name -class _SecondaryDSLLoader(_Loader): - def __init__(self, inner: _Loader) -> None: +class _SecondaryDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner def load( @@ -620,7 +622,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: r: Final[list[dict[str, Any]]] = [] match doc: case MutableSequence() as dlist: @@ -682,7 +684,7 @@ def load( return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader, Generic[S]): +class _RecordLoader(_Loader[S]): def __init__( self, classtype: type[S], @@ -716,7 +718,7 @@ def __repr__(self) -> str: return str(self.classtype.__name__) -class _ExpressionLoader(_Loader): +class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -737,12 +739,12 @@ def load( return doc -class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: +class _UnionLoader(_Loader[T]): + def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -752,7 +754,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: errors: Final = [] if lc is None: @@ -827,10 +829,10 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) -class _URILoader(_Loader): +class _URILoader(_Loader[T]): def __init__( self, - inner: _Loader, + inner: _Loader[T], scoped_id: bool, vocab_term: bool, scoped_ref: int | None, @@ -849,7 +851,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check @@ -896,8 +898,8 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: +class _TypeDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -944,7 +946,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -966,8 +968,8 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: +class _IdMapLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -979,7 +981,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -1006,12 +1008,12 @@ def load( def _document_load( - loader: _Loader, + loader: _Loader[T], doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, LoadingOptions]: +) -> tuple[T, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1076,11 +1078,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader, + loader: _Loader[T], url: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, LoadingOptions]: +) -> tuple[T, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1266,14 +1268,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -1394,13 +1396,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1415,7 +1417,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -1738,14 +1740,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -1867,13 +1868,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1888,7 +1889,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -2802,14 +2803,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -2930,13 +2931,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -2951,7 +2952,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -4642,14 +4643,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -5052,7 +5053,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, label=label, @@ -5064,7 +5065,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5079,7 +5080,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -5259,14 +5260,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -5481,7 +5481,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, @@ -5489,7 +5489,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5504,7 +5504,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -5639,14 +5639,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -5862,7 +5861,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -5870,7 +5869,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5885,7 +5884,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -6019,14 +6018,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -6242,7 +6240,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, items=items, type_=type_, label=label, @@ -6250,7 +6248,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6265,7 +6263,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -6411,14 +6409,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -6727,7 +6725,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, label=label, @@ -6737,7 +6735,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6752,7 +6750,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -6904,14 +6902,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -7126,7 +7123,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, @@ -7134,7 +7131,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7149,7 +7146,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -7284,14 +7281,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -7507,7 +7503,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -7515,7 +7511,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7530,7 +7526,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -7664,14 +7660,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -7887,7 +7882,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, items=items, type_=type_, label=label, @@ -7895,7 +7890,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7910,7 +7905,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -9898,14 +9893,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -10355,7 +10350,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, label=label, @@ -10368,7 +10363,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10383,7 +10378,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -10583,14 +10578,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -10852,7 +10846,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, @@ -10861,7 +10855,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10876,7 +10870,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -11030,14 +11024,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -11300,7 +11293,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -11309,7 +11302,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11324,7 +11317,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -11470,14 +11463,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -11740,7 +11732,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, items=items, type_=type_, label=label, @@ -11749,7 +11741,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11764,7 +11756,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -11921,14 +11913,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -12284,7 +12276,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, label=label, @@ -12295,7 +12287,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12310,7 +12302,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -12480,14 +12472,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -12702,7 +12693,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, @@ -12710,7 +12701,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12725,7 +12716,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -12860,14 +12851,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -13083,7 +13073,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -13091,7 +13081,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -13106,7 +13096,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -13240,14 +13230,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -13463,7 +13452,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, items=items, type_=type_, label=label, @@ -13471,7 +13460,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -13486,7 +13475,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -13644,14 +13633,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -14148,7 +14137,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -14162,7 +14151,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14177,7 +14166,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -14392,14 +14381,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -14755,7 +14744,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -14766,7 +14755,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14781,7 +14770,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -14988,14 +14977,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -15744,7 +15732,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -15763,7 +15751,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -15778,7 +15766,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -19142,14 +19130,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -19458,7 +19446,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -19468,7 +19456,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -19483,7 +19471,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -19655,14 +19643,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -20159,7 +20147,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -20173,7 +20161,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20188,7 +20176,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -20414,14 +20402,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -20842,7 +20829,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -20854,7 +20841,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20869,7 +20856,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -21077,14 +21064,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -21487,7 +21474,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -21499,7 +21486,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -21514,7 +21501,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -21748,14 +21735,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id source = None if "source" in _doc: try: @@ -22110,7 +22097,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, source=source, linkMerge=linkMerge, loadContents=loadContents, @@ -22121,7 +22108,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22136,7 +22123,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.source is not None: u = save_relative_uri(self.source, self.id, False, 2, relative_uris) @@ -22309,14 +22296,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -22340,11 +22327,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22359,7 +22346,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u # top refers to the directory level @@ -22545,14 +22532,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -23006,7 +22993,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, in_=in_, @@ -23019,7 +23006,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -23034,7 +23021,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -23278,14 +23265,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -23706,7 +23692,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -23718,7 +23704,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -23733,7 +23719,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -24577,14 +24563,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -25007,7 +24992,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -25019,7 +25004,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -25034,7 +25019,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -26104,14 +26089,16 @@ def __init__( "https://w3id.org/cwl/cwl#v1.1": "v1.1", }) -strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(i32) -floattype: Final = _PrimitiveLoader(float) -booltype: Final = _PrimitiveLoader(bool) -None_type: Final = _PrimitiveLoader(type(None)) -Any_type: Final = _AnyLoader() -longtype: Final = _PrimitiveLoader(i64) -PrimitiveTypeLoader: Final = _EnumLoader( +strtype: Final[_Loader[str]] = _PrimitiveLoader(str) +inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +floattype: Final[_Loader[float]] = _PrimitiveLoader(float) +booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) +None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) +Any_type: Final[_Loader[Any]] = _AnyLoader() +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) +PrimitiveTypeLoader: Final[ + _Loader[Literal["null", "boolean", "int", "long", "float", "double", "string"]] +] = _EnumLoader( ( "null", "boolean", @@ -26137,17 +26124,33 @@ def __init__( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader: Final = _EnumLoader(("Any",), "Any") +AnyLoader: Final[_Loader[Literal["Any"]]] = _EnumLoader(("Any",), "Any") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader: Final = _RecordLoader(RecordField, None, None) -RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader: Final = _EnumLoader( +RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( + RecordSchema, None, None +) +EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + ] +] = _EnumLoader( ( "null", "boolean", @@ -26166,64 +26169,114 @@ def __init__( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) -FileLoader: Final = _RecordLoader(File, None, None) -DirectoryLoader: Final = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( - ( - None_type, - CWLObjectTypeLoader, +CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( + CWLArraySchema, None, None +) +CWLRecordFieldLoader: Final[_Loader[CWLRecordField]] = _RecordLoader( + CWLRecordField, None, None +) +CWLRecordSchemaLoader: Final[_Loader[CWLRecordSchema]] = _RecordLoader( + CWLRecordSchema, None, None +) +FileLoader: Final[_Loader[File]] = _RecordLoader(File, None, None) +DirectoryLoader: Final[_Loader[Directory]] = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final[_UnionLoader[Any]] = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final[_Loader[CWLObjectType | None]] = ( + _UnionLoader( + ( + None_type, + CWLObjectTypeLoader, + ) ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( - union_of_None_type_or_CWLObjectTypeLoader +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Sequence[CWLObjectType | None]] +] = _ArrayLoader(union_of_None_type_or_CWLObjectTypeLoader) +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Mapping[str, CWLObjectType | None]] +] = _MapLoader(union_of_None_type_or_CWLObjectTypeLoader, "None", None, None) +InlineJavascriptRequirementLoader: Final[_Loader[InlineJavascriptRequirement]] = ( + _RecordLoader(InlineJavascriptRequirement, None, None) ) -map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( - union_of_None_type_or_CWLObjectTypeLoader, "None", None, None +SchemaDefRequirementLoader: Final[_Loader[SchemaDefRequirement]] = _RecordLoader( + SchemaDefRequirement, None, None ) -InlineJavascriptRequirementLoader: Final = _RecordLoader( - InlineJavascriptRequirement, None, None +LoadListingRequirementLoader: Final[_Loader[LoadListingRequirement]] = _RecordLoader( + LoadListingRequirement, None, None ) -SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) -LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) -DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) -InitialWorkDirRequirementLoader: Final = _RecordLoader( - InitialWorkDirRequirement, None, None +DockerRequirementLoader: Final[_Loader[DockerRequirement]] = _RecordLoader( + DockerRequirement, None, None ) -EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader: Final = _RecordLoader( +SoftwareRequirementLoader: Final[_Loader[SoftwareRequirement]] = _RecordLoader( + SoftwareRequirement, None, None +) +InitialWorkDirRequirementLoader: Final[_Loader[InitialWorkDirRequirement]] = ( + _RecordLoader(InitialWorkDirRequirement, None, None) +) +EnvVarRequirementLoader: Final[_Loader[EnvVarRequirement]] = _RecordLoader( + EnvVarRequirement, None, None +) +ShellCommandRequirementLoader: Final[_Loader[ShellCommandRequirement]] = _RecordLoader( ShellCommandRequirement, None, None ) -ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) -WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) -InplaceUpdateRequirementLoader: Final = _RecordLoader( - InplaceUpdateRequirement, None, None +ResourceRequirementLoader: Final[_Loader[ResourceRequirement]] = _RecordLoader( + ResourceRequirement, None, None ) -ToolTimeLimitLoader: Final = _RecordLoader(ToolTimeLimit, None, None) -SubworkflowFeatureRequirementLoader: Final = _RecordLoader( - SubworkflowFeatureRequirement, None, None +WorkReuseLoader: Final[_Loader[WorkReuse]] = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final[_Loader[NetworkAccess]] = _RecordLoader( + NetworkAccess, None, None ) -ScatterFeatureRequirementLoader: Final = _RecordLoader( - ScatterFeatureRequirement, None, None +InplaceUpdateRequirementLoader: Final[_Loader[InplaceUpdateRequirement]] = ( + _RecordLoader(InplaceUpdateRequirement, None, None) ) -MultipleInputFeatureRequirementLoader: Final = _RecordLoader( - MultipleInputFeatureRequirement, None, None +ToolTimeLimitLoader: Final[_Loader[ToolTimeLimit]] = _RecordLoader( + ToolTimeLimit, None, None ) -StepInputExpressionRequirementLoader: Final = _RecordLoader( - StepInputExpressionRequirement, None, None +SubworkflowFeatureRequirementLoader: Final[_Loader[SubworkflowFeatureRequirement]] = ( + _RecordLoader(SubworkflowFeatureRequirement, None, None) ) -SecretsLoader: Final = _RecordLoader(Secrets, None, None) -MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) -ShmSizeLoader: Final = _RecordLoader(ShmSize, None, None) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( - Final -) = _UnionLoader( +ScatterFeatureRequirementLoader: Final[_Loader[ScatterFeatureRequirement]] = ( + _RecordLoader(ScatterFeatureRequirement, None, None) +) +MultipleInputFeatureRequirementLoader: Final[ + _Loader[MultipleInputFeatureRequirement] +] = _RecordLoader(MultipleInputFeatureRequirement, None, None) +StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( + _RecordLoader(StepInputExpressionRequirement, None, None) +) +SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) +MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( + MPIRequirement, None, None +) +CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( + CUDARequirement, None, None +) +ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -26248,36 +26301,146 @@ def __init__( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: ( - Final -) = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ + _Loader[ + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, CWLObjectTypeLoader, ) ) -map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: ( - Final -) = _MapLoader( +map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ + _Loader[ + Mapping[ + str, + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ], + ] + ] +] = _MapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True, ) -CWLInputFileLoader: Final = ( - map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader -) -CWLVersionLoader: Final = _EnumLoader(("v1.1",), "CWLVersion") +CWLInputFileLoader: Final[ + _Loader[ + Mapping[ + str, + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ], + ] + ] +] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader +CWLVersionLoader: Final[_Loader[Literal["v1.1"]]] = _EnumLoader(("v1.1",), "CWLVersion") """ Current version symbol for CWL documents. """ -LoadListingEnumLoader: Final = _EnumLoader( +LoadListingEnumLoader: Final[ + _Loader[Literal["no_listing", "shallow_listing", "deep_listing"]] +] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -26293,45 +26456,77 @@ def __init__( shallow_listing: Only load the top level listing, do not recurse into subdirectories. deep_listing: Load the directory listing and recursively load all subdirectories as well. """ -ExpressionLoader: Final = _ExpressionLoader(str) -InputBindingLoader: Final = _RecordLoader(InputBinding, None, None) -InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) -SecondaryFileSchemaLoader: Final = _RecordLoader(SecondaryFileSchema, None, None) -EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader: Final = _RecordLoader( +ExpressionLoader = _ExpressionLoader(str) +InputBindingLoader: Final[_Loader[InputBinding]] = _RecordLoader( + InputBinding, None, None +) +InputRecordFieldLoader: Final[_Loader[InputRecordField]] = _RecordLoader( + InputRecordField, None, None +) +InputRecordSchemaLoader: Final[_Loader[InputRecordSchema]] = _RecordLoader( + InputRecordSchema, None, None +) +InputEnumSchemaLoader: Final[_Loader[InputEnumSchema]] = _RecordLoader( + InputEnumSchema, None, None +) +InputArraySchemaLoader: Final[_Loader[InputArraySchema]] = _RecordLoader( + InputArraySchema, None, None +) +OutputRecordFieldLoader: Final[_Loader[OutputRecordField]] = _RecordLoader( + OutputRecordField, None, None +) +OutputRecordSchemaLoader: Final[_Loader[OutputRecordSchema]] = _RecordLoader( + OutputRecordSchema, None, None +) +OutputEnumSchemaLoader: Final[_Loader[OutputEnumSchema]] = _RecordLoader( + OutputEnumSchema, None, None +) +OutputArraySchemaLoader: Final[_Loader[OutputArraySchema]] = _RecordLoader( + OutputArraySchema, None, None +) +SecondaryFileSchemaLoader: Final[_Loader[SecondaryFileSchema]] = _RecordLoader( + SecondaryFileSchema, None, None +) +EnvironmentDefLoader: Final[_Loader[EnvironmentDef]] = _RecordLoader( + EnvironmentDef, None, None +) +CommandLineBindingLoader: Final[_Loader[CommandLineBinding]] = _RecordLoader( + CommandLineBinding, None, None +) +CommandOutputBindingLoader: Final[_Loader[CommandOutputBinding]] = _RecordLoader( + CommandOutputBinding, None, None +) +CommandInputRecordFieldLoader: Final[_Loader[CommandInputRecordField]] = _RecordLoader( CommandInputRecordField, None, None ) -CommandInputRecordSchemaLoader: Final = _RecordLoader( - CommandInputRecordSchema, None, None +CommandInputRecordSchemaLoader: Final[_Loader[CommandInputRecordSchema]] = ( + _RecordLoader(CommandInputRecordSchema, None, None) ) -CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader: Final = _RecordLoader( +CommandInputEnumSchemaLoader: Final[_Loader[CommandInputEnumSchema]] = _RecordLoader( + CommandInputEnumSchema, None, None +) +CommandInputArraySchemaLoader: Final[_Loader[CommandInputArraySchema]] = _RecordLoader( CommandInputArraySchema, None, None ) -CommandOutputRecordFieldLoader: Final = _RecordLoader( - CommandOutputRecordField, None, None +CommandOutputRecordFieldLoader: Final[_Loader[CommandOutputRecordField]] = ( + _RecordLoader(CommandOutputRecordField, None, None) ) -CommandOutputRecordSchemaLoader: Final = _RecordLoader( - CommandOutputRecordSchema, None, None +CommandOutputRecordSchemaLoader: Final[_Loader[CommandOutputRecordSchema]] = ( + _RecordLoader(CommandOutputRecordSchema, None, None) ) -CommandOutputEnumSchemaLoader: Final = _RecordLoader( +CommandOutputEnumSchemaLoader: Final[_Loader[CommandOutputEnumSchema]] = _RecordLoader( CommandOutputEnumSchema, None, None ) -CommandOutputArraySchemaLoader: Final = _RecordLoader( - CommandOutputArraySchema, None, None +CommandOutputArraySchemaLoader: Final[_Loader[CommandOutputArraySchema]] = ( + _RecordLoader(CommandOutputArraySchema, None, None) +) +CommandInputParameterLoader: Final[_Loader[CommandInputParameter]] = _RecordLoader( + CommandInputParameter, None, None +) +CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( + CommandOutputParameter, None, None ) -CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) -stdinLoader: Final = _EnumLoader(("stdin",), "stdin") +stdinLoader: Final[_Loader[Literal["stdin"]]] = _EnumLoader(("stdin",), "stdin") """ Only valid as a `type` for a `CommandLineTool` input with no `inputBinding` set. `stdin` must not be specified at the `CommandLineTool` @@ -26353,7 +26548,7 @@ def __init__( stdin: ${inputs.an_input_name.path} ``` """ -stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") +stdoutLoader: Final[_Loader[Literal["stdout"]]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26397,7 +26592,7 @@ def __init__( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader: Final = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final[_Loader[Literal["stderr"]]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26441,30 +26636,46 @@ def __init__( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) -SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) -DirentLoader: Final = _RecordLoader(Dirent, None, None) -ExpressionToolOutputParameterLoader: Final = _RecordLoader( - ExpressionToolOutputParameter, None, None +CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( + CommandLineTool, None, None ) -WorkflowInputParameterLoader: Final = _RecordLoader(WorkflowInputParameter, None, None) -ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader: Final = _EnumLoader( - ( - "merge_nested", - "merge_flattened", - ), - "LinkMergeMethod", +SoftwarePackageLoader: Final[_Loader[SoftwarePackage]] = _RecordLoader( + SoftwarePackage, None, None +) +DirentLoader: Final[_Loader[Dirent]] = _RecordLoader(Dirent, None, None) +ExpressionToolOutputParameterLoader: Final[_Loader[ExpressionToolOutputParameter]] = ( + _RecordLoader(ExpressionToolOutputParameter, None, None) +) +WorkflowInputParameterLoader: Final[_Loader[WorkflowInputParameter]] = _RecordLoader( + WorkflowInputParameter, None, None +) +ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( + ExpressionTool, None, None +) +LinkMergeMethodLoader: Final[_Loader[Literal["merge_nested", "merge_flattened"]]] = ( + _EnumLoader( + ( + "merge_nested", + "merge_flattened", + ), + "LinkMergeMethod", + ) ) """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader: Final = _RecordLoader( +WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( WorkflowOutputParameter, None, None ) -WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader: Final = _EnumLoader( +WorkflowStepInputLoader: Final[_Loader[WorkflowStepInput]] = _RecordLoader( + WorkflowStepInput, None, None +) +WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( + WorkflowStepOutput, None, None +) +ScatterMethodLoader: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"]] +] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -26475,21 +26686,37 @@ def __init__( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader: Final = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader: Final = _RecordLoader(Workflow, None, None) -ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) -array_of_strtype: Final = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype: Final = _UnionLoader( +WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( + WorkflowStep, None, None +) +WorkflowLoader: Final[_Loader[Workflow]] = _RecordLoader(Workflow, None, None) +ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( + ProcessGenerator, None, None +) +array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None: Final = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +uri_strtype_True_False_None_None: Final[_Loader[str]] = _URILoader( + strtype, True, False, None, None +) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -26500,14 +26727,41 @@ def __init__( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -26519,57 +26773,117 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader: Final = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( +array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( + RecordFieldLoader +) +union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( - union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") +Record_nameLoader: Final[_Loader[Literal["record"]]] = _EnumLoader( + ("record",), "Record_name" +) +typedsl_Record_nameLoader_2: Final[_Loader[Literal["record"]]] = _TypeDSLLoader( + Record_nameLoader, 2, "v1.1" ) -Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype: Final = _UnionLoader( +union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None: Final = _URILoader( - union_of_None_type_or_strtype, True, False, None, None +uri_union_of_None_type_or_strtype_True_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, None) ) -uri_array_of_strtype_True_False_None_None: Final = _URILoader( +uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2: Final = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +Enum_nameLoader: Final[_Loader[Literal["enum"]]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Literal["enum"]]] = _TypeDSLLoader( + Enum_nameLoader, 2, "v1.1" +) +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader: Final = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +Array_nameLoader: Final[_Loader[Literal["array"]]] = _EnumLoader( + ("array",), "Array_name" +) +typedsl_Array_nameLoader_2: Final[_Loader[Literal["array"]]] = _TypeDSLLoader( + Array_nameLoader, 2, "v1.1" +) +Map_nameLoader: Final[_Loader[Literal["map"]]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Literal["map"]]] = _TypeDSLLoader( + Map_nameLoader, 2, "v1.1" +) +Union_nameLoader: Final[_Loader[Literal["union"]]] = _EnumLoader( + ("union",), "Union_name" +) +typedsl_Union_nameLoader_2: Final[_Loader[Literal["union"]]] = _TypeDSLLoader( + Union_nameLoader, 2, "v1.1" +) +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -26578,14 +26892,35 @@ def __init__( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -26595,66 +26930,96 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader: Final = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( +array_of_CWLRecordFieldLoader: Final[_Loader[Sequence[CWLRecordField]]] = _ArrayLoader( + CWLRecordFieldLoader +) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _IdMapLoader( - union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" -) -File_classLoader: Final = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None: Final = _URILoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") +File_classLoader: Final[_Loader[Literal["File"]]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[Literal["File"]]] = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None: Final = _URILoader( - union_of_None_type_or_strtype, False, False, None, None +uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype_or_inttype: Final = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( ( None_type, inttype, inttype, ) ) -union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( - union_of_FileLoader_or_DirectoryLoader -) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( - _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, - ) +array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[Sequence[Directory | File]] +] = _ArrayLoader(union_of_FileLoader_or_DirectoryLoader) +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( + ( + None_type, + array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( - Final -) = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader @@ -26662,28 +27027,34 @@ def __init__( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -uri_union_of_None_type_or_strtype_True_False_None_True: Final = _URILoader( - union_of_None_type_or_strtype, True, False, None, True +uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, True) ) -Directory_classLoader: Final = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None: Final = _URILoader( - Directory_classLoader, False, True, None, None +Directory_classLoader: Final[_Loader[Literal["Directory"]]] = _EnumLoader( + ("Directory",), "Directory_class" ) -union_of_None_type_or_booltype: Final = _UnionLoader( +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Literal["Directory"]]] = ( + _URILoader(Directory_classLoader, False, True, None, None) +) +union_of_None_type_or_booltype: Final[_Loader[None | bool]] = _UnionLoader( ( None_type, booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader: Final = _UnionLoader( +union_of_None_type_or_LoadListingEnumLoader: Final[ + _Loader[Literal["no_listing", "shallow_listing", "deep_listing"] | None] +] = _UnionLoader( ( None_type, LoadListingEnumLoader, ) ) -array_of_SecondaryFileSchemaLoader: Final = _ArrayLoader(SecondaryFileSchemaLoader) +array_of_SecondaryFileSchemaLoader: Final[_Loader[Sequence[SecondaryFileSchema]]] = ( + _ArrayLoader(SecondaryFileSchemaLoader) +) union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( - Final + Final[_Loader[None | SecondaryFileSchema | Sequence[SecondaryFileSchema]]] ) = _UnionLoader( ( None_type, @@ -26691,9 +27062,9 @@ def __init__( array_of_SecondaryFileSchemaLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( - Final -) = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: Final[ + _Loader[None | SecondaryFileSchema | Sequence[SecondaryFileSchema]] +] = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader @@ -26701,40 +27072,58 @@ def __init__( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, ) ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( - _UnionLoader( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, - ) +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: ( - Final -) = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_ExpressionLoader: Final[_Loader[None | str]] = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( - _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True - ) +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | str] +] = _URILoader( + union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -26743,14 +27132,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -26760,35 +27200,121 @@ def __init__( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_InputRecordFieldLoader: Final = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _UnionLoader( +array_of_InputRecordFieldLoader: Final[_Loader[Sequence[InputRecordField]]] = ( + _ArrayLoader(InputRecordFieldLoader) +) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( - _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") -) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -26797,14 +27323,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -26814,89 +27391,246 @@ def __init__( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_OutputRecordFieldLoader: Final = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _UnionLoader( +array_of_OutputRecordFieldLoader: Final[_Loader[Sequence[OutputRecordField]]] = ( + _ArrayLoader(OutputRecordFieldLoader) +) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( - _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") -) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final = ( - _UnionLoader( - ( - CommandInputParameterLoader, - WorkflowInputParameterLoader, - ) +union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final[ + _Loader[CommandInputParameter | WorkflowInputParameter] +] = _UnionLoader( + ( + CommandInputParameterLoader, + WorkflowInputParameterLoader, ) ) -array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final = ( - _ArrayLoader(union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader) -) -idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: ( - Final -) = _IdMapLoader( +array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter | WorkflowInputParameter]] +] = _ArrayLoader(union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader) +idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter | WorkflowInputParameter]] +] = _IdMapLoader( array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader, "id", "type", ) -union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: ( - Final -) = _UnionLoader( +union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: Final[ + _Loader[ + CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter + ] +] = _UnionLoader( ( CommandOutputParameterLoader, ExpressionToolOutputParameterLoader, WorkflowOutputParameterLoader, ) ) -array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandOutputParameter + | ExpressionToolOutputParameter + | WorkflowOutputParameter + ] + ] +] = _ArrayLoader( union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader ) -idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: ( - Final -) = _IdMapLoader( +idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandOutputParameter + | ExpressionToolOutputParameter + | WorkflowOutputParameter + ] + ] +] = _IdMapLoader( array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader, "id", "type", ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( - Final -) = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: ( - Final -) = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -26922,118 +27656,225 @@ def __init__( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( - ( - None_type, - CWLVersionLoader, +union_of_None_type_or_CWLVersionLoader: Final[_Loader[Literal["v1.1"] | None]] = ( + _UnionLoader( + ( + None_type, + CWLVersionLoader, + ) ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( - union_of_None_type_or_CWLVersionLoader, False, True, None, None -) -InlineJavascriptRequirement_classLoader: Final = _EnumLoader( - ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" -) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( - InlineJavascriptRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_array_of_strtype: Final = _UnionLoader( - ( - None_type, - array_of_strtype, +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ + _Loader[Literal["v1.1"] | None] +] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) +InlineJavascriptRequirement_classLoader: Final[ + _Loader[Literal["InlineJavascriptRequirement"]] +] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["InlineJavascriptRequirement"]] +] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) +union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( + _UnionLoader( + ( + None_type, + array_of_strtype, + ) ) ) -SchemaDefRequirement_classLoader: Final = _EnumLoader( - ("SchemaDefRequirement",), "SchemaDefRequirement_class" +SchemaDefRequirement_classLoader: Final[_Loader[Literal["SchemaDefRequirement"]]] = ( + _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) -uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( - SchemaDefRequirement_classLoader, False, True, None, None -) -union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( - Final -) = _UnionLoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SchemaDefRequirement"]] +] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) +union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ + _Loader[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] +] = _UnionLoader( ( CommandInputRecordSchemaLoader, CommandInputEnumSchemaLoader, CommandInputArraySchemaLoader, ) ) -array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ + _Loader[ + Sequence[ + CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema + ] + ] +] = _ArrayLoader( union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader ) -union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final[_Loader[str]] = _UnionLoader( ( strtype, ExpressionLoader, ) ) -union_of_None_type_or_booltype_or_ExpressionLoader: Final = _UnionLoader( +union_of_None_type_or_booltype_or_ExpressionLoader: Final[ + _Loader[None | bool | str] +] = _UnionLoader( ( None_type, booltype, ExpressionLoader, ) ) -LoadListingRequirement_classLoader: Final = _EnumLoader( - ("LoadListingRequirement",), "LoadListingRequirement_class" -) -uri_LoadListingRequirement_classLoader_False_True_None_None: Final = _URILoader( - LoadListingRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_inttype_or_ExpressionLoader: Final = _UnionLoader( - ( - None_type, - inttype, - ExpressionLoader, - ) -) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( +LoadListingRequirement_classLoader: Final[ + _Loader[Literal["LoadListingRequirement"]] +] = _EnumLoader(("LoadListingRequirement",), "LoadListingRequirement_class") +uri_LoadListingRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["LoadListingRequirement"]] +] = _URILoader(LoadListingRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( _UnionLoader( ( None_type, - strtype, + inttype, ExpressionLoader, - array_of_strtype, ) ) ) -union_of_None_type_or_ExpressionLoader: Final = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + array_of_strtype, + ) +) +union_of_None_type_or_ExpressionLoader: Final[_Loader[None | str]] = _UnionLoader( ( None_type, ExpressionLoader, ) ) -union_of_None_type_or_CommandLineBindingLoader: Final = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | None] +] = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -27042,14 +27883,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -27059,39 +27951,123 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader: Final = _ArrayLoader( - CommandInputRecordFieldLoader -) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final[ + _Loader[Sequence[CommandInputRecordField]] +] = _ArrayLoader(CommandInputRecordFieldLoader) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -27100,14 +28076,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -27117,45 +28144,149 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader: Final = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final[ + _Loader[CommandOutputBinding | None] +] = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_CommandOutputRecordFieldLoader: Final = _ArrayLoader( - CommandOutputRecordFieldLoader -) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[Sequence[CommandOutputRecordField]] +] = _ArrayLoader(CommandOutputRecordFieldLoader) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stdin"] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, stdinLoader, @@ -27166,16 +28297,85 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stdin"] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stderr"] + | Literal["stdout"] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, stdoutLoader, @@ -27187,82 +28387,125 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stderr"] + | Literal["stdout"] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader: Final = _EnumLoader( +CommandLineTool_classLoader: Final[_Loader[Literal["CommandLineTool"]]] = _EnumLoader( ("CommandLineTool",), "CommandLineTool_class" ) -uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( - CommandLineTool_classLoader, False, True, None, None -) -array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( - array_of_CommandInputParameterLoader, "id", "type" -) -array_of_CommandOutputParameterLoader: Final = _ArrayLoader( - CommandOutputParameterLoader -) -idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( - array_of_CommandOutputParameterLoader, "id", "type" -) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( +uri_CommandLineTool_classLoader_False_True_None_None: Final[ + _Loader[Literal["CommandLineTool"]] +] = _URILoader(CommandLineTool_classLoader, False, True, None, None) +array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _IdMapLoader(array_of_CommandInputParameterLoader, "id", "type") +array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _ArrayLoader(CommandOutputParameterLoader) +idmap_outputs_array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _IdMapLoader(array_of_CommandOutputParameterLoader, "id", "type") +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | str] +] = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( - _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) -) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( - Final -) = _UnionLoader( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[Sequence[CommandLineBinding | str]] +] = _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[None | Sequence[CommandLineBinding | str]] +] = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype: Final = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype: Final = _UnionLoader( - ( - None_type, - array_of_inttype, +array_of_inttype: Final[_Loader[Sequence[i32]]] = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final[_Loader[None | Sequence[i32]]] = ( + _UnionLoader( + ( + None_type, + array_of_inttype, + ) ) ) -DockerRequirement_classLoader: Final = _EnumLoader( - ("DockerRequirement",), "DockerRequirement_class" +DockerRequirement_classLoader: Final[_Loader[Literal["DockerRequirement"]]] = ( + _EnumLoader(("DockerRequirement",), "DockerRequirement_class") ) -uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( - DockerRequirement_classLoader, False, True, None, None +uri_DockerRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["DockerRequirement"]] +] = _URILoader(DockerRequirement_classLoader, False, True, None, None) +SoftwareRequirement_classLoader: Final[_Loader[Literal["SoftwareRequirement"]]] = ( + _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) -SoftwareRequirement_classLoader: Final = _EnumLoader( - ("SoftwareRequirement",), "SoftwareRequirement_class" +uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SoftwareRequirement"]] +] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) +array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( + _ArrayLoader(SoftwarePackageLoader) ) -uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( - SoftwareRequirement_classLoader, False, True, None, None -) -array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( - array_of_SoftwarePackageLoader, "package", "specs" -) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( - union_of_None_type_or_array_of_strtype, False, False, None, True -) -InitialWorkDirRequirement_classLoader: Final = _EnumLoader( - ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" -) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _URILoader( - InitialWorkDirRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: ( - Final -) = _UnionLoader( +idmap_packages_array_of_SoftwarePackageLoader: Final[ + _Loader[Sequence[SoftwarePackage]] +] = _IdMapLoader(array_of_SoftwarePackageLoader, "package", "specs") +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ + _Loader[None | Sequence[str]] +] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_classLoader: Final[ + _Loader[Literal["InitialWorkDirRequirement"]] +] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["InitialWorkDirRequirement"]] +] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) +union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: Final[ + _Loader[Directory | Dirent | File | None | Sequence[Directory | File] | str] +] = _UnionLoader( ( None_type, FileLoader, @@ -27272,42 +28515,51 @@ def __init__( ExpressionLoader, ) ) -array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: Final[ + _Loader[ + Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] + ] +] = _ArrayLoader( union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader ) -union_of_array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader_or_ExpressionLoader: ( - Final -) = _UnionLoader( +union_of_array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader_or_ExpressionLoader: Final[ + _Loader[ + Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] + | str + ] +] = _UnionLoader( ( array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader, ExpressionLoader, ) ) -EnvVarRequirement_classLoader: Final = _EnumLoader( - ("EnvVarRequirement",), "EnvVarRequirement_class" -) -uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( - EnvVarRequirement_classLoader, False, True, None, None -) -array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( - array_of_EnvironmentDefLoader, "envName", "envValue" +EnvVarRequirement_classLoader: Final[_Loader[Literal["EnvVarRequirement"]]] = ( + _EnumLoader(("EnvVarRequirement",), "EnvVarRequirement_class") ) -ShellCommandRequirement_classLoader: Final = _EnumLoader( - ("ShellCommandRequirement",), "ShellCommandRequirement_class" +uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["EnvVarRequirement"]] +] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) +array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( + EnvironmentDefLoader ) -uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( - ShellCommandRequirement_classLoader, False, True, None, None +idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( + _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -ResourceRequirement_classLoader: Final = _EnumLoader( - ("ResourceRequirement",), "ResourceRequirement_class" +ShellCommandRequirement_classLoader: Final[ + _Loader[Literal["ShellCommandRequirement"]] +] = _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ShellCommandRequirement"]] +] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) +ResourceRequirement_classLoader: Final[_Loader[Literal["ResourceRequirement"]]] = ( + _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) -uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( - ResourceRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( +uri_ResourceRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ResourceRequirement"]] +] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader: Final[ + _Loader[None | i32 | str] +] = _UnionLoader( ( None_type, inttype, @@ -27315,115 +28567,129 @@ def __init__( ExpressionLoader, ) ) -WorkReuse_classLoader: Final = _EnumLoader(("WorkReuse",), "WorkReuse_class") -uri_WorkReuse_classLoader_False_True_None_None: Final = _URILoader( - WorkReuse_classLoader, False, True, None, None +WorkReuse_classLoader: Final[_Loader[Literal["WorkReuse"]]] = _EnumLoader( + ("WorkReuse",), "WorkReuse_class" +) +uri_WorkReuse_classLoader_False_True_None_None: Final[_Loader[Literal["WorkReuse"]]] = ( + _URILoader(WorkReuse_classLoader, False, True, None, None) ) -union_of_booltype_or_ExpressionLoader: Final = _UnionLoader( +union_of_booltype_or_ExpressionLoader: Final[_Loader[bool | str]] = _UnionLoader( ( booltype, ExpressionLoader, ) ) -NetworkAccess_classLoader: Final = _EnumLoader( +NetworkAccess_classLoader: Final[_Loader[Literal["NetworkAccess"]]] = _EnumLoader( ("NetworkAccess",), "NetworkAccess_class" ) -uri_NetworkAccess_classLoader_False_True_None_None: Final = _URILoader( - NetworkAccess_classLoader, False, True, None, None -) -InplaceUpdateRequirement_classLoader: Final = _EnumLoader( - ("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class" -) -uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final = _URILoader( - InplaceUpdateRequirement_classLoader, False, True, None, None -) -ToolTimeLimit_classLoader: Final = _EnumLoader( +uri_NetworkAccess_classLoader_False_True_None_None: Final[ + _Loader[Literal["NetworkAccess"]] +] = _URILoader(NetworkAccess_classLoader, False, True, None, None) +InplaceUpdateRequirement_classLoader: Final[ + _Loader[Literal["InplaceUpdateRequirement"]] +] = _EnumLoader(("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class") +uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["InplaceUpdateRequirement"]] +] = _URILoader(InplaceUpdateRequirement_classLoader, False, True, None, None) +ToolTimeLimit_classLoader: Final[_Loader[Literal["ToolTimeLimit"]]] = _EnumLoader( ("ToolTimeLimit",), "ToolTimeLimit_class" ) -uri_ToolTimeLimit_classLoader_False_True_None_None: Final = _URILoader( - ToolTimeLimit_classLoader, False, True, None, None -) -union_of_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( - ( - inttype, - inttype, - ExpressionLoader, +uri_ToolTimeLimit_classLoader_False_True_None_None: Final[ + _Loader[Literal["ToolTimeLimit"]] +] = _URILoader(ToolTimeLimit_classLoader, False, True, None, None) +union_of_inttype_or_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = ( + _UnionLoader( + ( + inttype, + inttype, + ExpressionLoader, + ) ) ) -union_of_None_type_or_InputBindingLoader: Final = _UnionLoader( - ( - None_type, - InputBindingLoader, +union_of_None_type_or_InputBindingLoader: Final[_Loader[InputBinding | None]] = ( + _UnionLoader( + ( + None_type, + InputBindingLoader, + ) ) ) -ExpressionTool_classLoader: Final = _EnumLoader( +ExpressionTool_classLoader: Final[_Loader[Literal["ExpressionTool"]]] = _EnumLoader( ("ExpressionTool",), "ExpressionTool_class" ) -uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( - ExpressionTool_classLoader, False, True, None, None -) -array_of_WorkflowInputParameterLoader: Final = _ArrayLoader( - WorkflowInputParameterLoader -) -idmap_inputs_array_of_WorkflowInputParameterLoader: Final = _IdMapLoader( - array_of_WorkflowInputParameterLoader, "id", "type" -) -array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( - ExpressionToolOutputParameterLoader -) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _IdMapLoader( - array_of_ExpressionToolOutputParameterLoader, "id", "type" -) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) -) -union_of_None_type_or_LinkMergeMethodLoader: Final = _UnionLoader( +uri_ExpressionTool_classLoader_False_True_None_None: Final[ + _Loader[Literal["ExpressionTool"]] +] = _URILoader(ExpressionTool_classLoader, False, True, None, None) +array_of_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[WorkflowInputParameter]] +] = _ArrayLoader(WorkflowInputParameterLoader) +idmap_inputs_array_of_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[WorkflowInputParameter]] +] = _IdMapLoader(array_of_WorkflowInputParameterLoader, "id", "type") +array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _ArrayLoader(ExpressionToolOutputParameterLoader) +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _IdMapLoader(array_of_ExpressionToolOutputParameterLoader, "id", "type") +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) +union_of_None_type_or_LinkMergeMethodLoader: Final[ + _Loader[Literal["merge_nested", "merge_flattened"] | None] +] = _UnionLoader( ( None_type, LinkMergeMethodLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) +array_of_WorkflowStepInputLoader: Final[_Loader[Sequence[WorkflowStepInput]]] = ( + _ArrayLoader(WorkflowStepInputLoader) ) -array_of_WorkflowStepInputLoader: Final = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( - array_of_WorkflowStepInputLoader, "id", "source" -) -union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( +idmap_in__array_of_WorkflowStepInputLoader: Final[ + _Loader[Sequence[WorkflowStepInput]] +] = _IdMapLoader(array_of_WorkflowStepInputLoader, "id", "source") +union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[WorkflowStepOutput | str] +] = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( - union_of_strtype_or_WorkflowStepOutputLoader -) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( - (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) -) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( - Final -) = _URILoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _ArrayLoader(union_of_strtype_or_WorkflowStepOutputLoader) +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _UnionLoader((array_of_union_of_strtype_or_WorkflowStepOutputLoader,)) +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type: Final = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( - ( - None_type, - array_of_Any_type, +array_of_Any_type: Final[_Loader[Sequence[Any]]] = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final[_Loader[None | Sequence[Any]]] = ( + _UnionLoader( + ( + None_type, + array_of_Any_type, + ) ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _IdMapLoader( - union_of_None_type_or_array_of_Any_type, "class", "None" -) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ + _Loader[None | Sequence[Any]] +] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +] = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -27432,87 +28698,103 @@ def __init__( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: ( - Final -) = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +] = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) -) -union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) +union_of_None_type_or_ScatterMethodLoader: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] +] = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( - union_of_None_type_or_ScatterMethodLoader, False, True, None, None -) -Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( - Workflow_classLoader, False, True, None, None +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] +] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) +Workflow_classLoader: Final[_Loader[Literal["Workflow"]]] = _EnumLoader( + ("Workflow",), "Workflow_class" ) -array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( - WorkflowOutputParameterLoader +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Literal["Workflow"]]] = ( + _URILoader(Workflow_classLoader, False, True, None, None) ) -idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( - array_of_WorkflowOutputParameterLoader, "id", "type" +array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _ArrayLoader(WorkflowOutputParameterLoader) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _IdMapLoader(array_of_WorkflowOutputParameterLoader, "id", "type") +array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = _ArrayLoader( + WorkflowStepLoader ) -array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( - (array_of_WorkflowStepLoader,) +union_of_array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = ( + _UnionLoader((array_of_WorkflowStepLoader,)) ) -idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( - union_of_array_of_WorkflowStepLoader, "id", "None" -) -SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( +idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ + _Loader[Sequence[WorkflowStep]] +] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_classLoader: Final[ + _Loader[Literal["SubworkflowFeatureRequirement"]] +] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( - SubworkflowFeatureRequirement_classLoader, False, True, None, None -) -ScatterFeatureRequirement_classLoader: Final = _EnumLoader( - ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" -) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( - ScatterFeatureRequirement_classLoader, False, True, None, None -) -MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SubworkflowFeatureRequirement"]] +] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_classLoader: Final[ + _Loader[Literal["ScatterFeatureRequirement"]] +] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ScatterFeatureRequirement"]] +] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_classLoader: Final[ + _Loader[Literal["MultipleInputFeatureRequirement"]] +] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( - _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) -) -StepInputExpressionRequirement_classLoader: Final = _EnumLoader( +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["MultipleInputFeatureRequirement"]] +] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_classLoader: Final[ + _Loader[Literal["StepInputExpressionRequirement"]] +] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( - StepInputExpressionRequirement_classLoader, False, True, None, None +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["StepInputExpressionRequirement"]] +] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) +uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( + strtype, False, True, None, None ) -uri_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) -uri_array_of_strtype_False_False_0_None: Final = _URILoader( +uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( ( inttype, ExpressionLoader, ) ) -union_of_strtype_or_array_of_strtype: Final = _UnionLoader( - ( - strtype, - array_of_strtype, +union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( + _UnionLoader( + ( + strtype, + array_of_strtype, + ) ) ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -27520,14 +28802,20 @@ def __init__( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow]] +] = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + CommandLineTool + | ExpressionTool + | ProcessGenerator + | Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] + | Workflow + ] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index 4b7fa99d..b7387083 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -45,7 +45,9 @@ IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] +E = TypeVar("E", bound=str) S = TypeVar("S", bound="Saveable") +T = TypeVar("T", covariant=True) class LoadingOptions: @@ -236,11 +238,11 @@ def save( def load_field( val: Any | None, - fieldtype: "_Loader", + fieldtype: _Loader[T], baseuri: str, loadingOptions: LoadingOptions, lc: Any | None = None, -) -> Any: +) -> T: """Load field.""" if isinstance(val, MutableMapping): if "$import" in val: @@ -442,7 +444,8 @@ def expand_url( return url -class _Loader: +class _Loader(Generic[T], metaclass=ABCMeta): + @abstractmethod def load( self, doc: Any, @@ -450,11 +453,10 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any | None: - pass + ) -> T: ... -class _AnyLoader(_Loader): +class _AnyLoader(_Loader[Any]): def load( self, doc: Any, @@ -468,8 +470,8 @@ def load( raise ValidationException("Expected non-null") -class _PrimitiveLoader(_Loader): - def __init__(self, tp: type | tuple[type[str], type[str]]) -> None: +class _PrimitiveLoader(_Loader[T]): + def __init__(self, tp: type[T]) -> None: self.tp: Final = tp def load( @@ -479,7 +481,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -488,8 +490,8 @@ def __repr__(self) -> str: return str(self.tp) -class _ArrayLoader(_Loader): - def __init__(self, items: _Loader) -> None: +class _ArrayLoader(_Loader[Sequence[T]]): + def __init__(self, items: _Loader[T]) -> None: self.items: Final = items def load( @@ -499,7 +501,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> list[Any]: + ) -> list[T]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -545,10 +547,10 @@ def __repr__(self) -> str: return f"array<{self.items}>" -class _MapLoader(_Loader): +class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, - values: _Loader, + values: _Loader[T], name: str | None = None, container: str | None = None, no_link_check: bool | None = None, @@ -565,7 +567,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> dict[str, Any]: + ) -> dict[str, T]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -588,7 +590,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" -class _EnumLoader(_Loader): +class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -600,17 +602,17 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> str: + ) -> E: if doc in self.symbols: - return cast(str, doc) + return cast(E, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: return self.name -class _SecondaryDSLLoader(_Loader): - def __init__(self, inner: _Loader) -> None: +class _SecondaryDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner def load( @@ -620,7 +622,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: r: Final[list[dict[str, Any]]] = [] match doc: case MutableSequence() as dlist: @@ -682,7 +684,7 @@ def load( return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) -class _RecordLoader(_Loader, Generic[S]): +class _RecordLoader(_Loader[S]): def __init__( self, classtype: type[S], @@ -716,7 +718,7 @@ def __repr__(self) -> str: return str(self.classtype.__name__) -class _ExpressionLoader(_Loader): +class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -737,12 +739,12 @@ def load( return doc -class _UnionLoader(_Loader): - def __init__(self, alternates: Sequence[_Loader], name: str | None = None) -> None: +class _UnionLoader(_Loader[T]): + def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -752,7 +754,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: errors: Final = [] if lc is None: @@ -827,10 +829,10 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) -class _URILoader(_Loader): +class _URILoader(_Loader[T]): def __init__( self, - inner: _Loader, + inner: _Loader[T], scoped_id: bool, vocab_term: bool, scoped_ref: int | None, @@ -849,7 +851,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check @@ -896,8 +898,8 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _TypeDSLLoader(_Loader): - def __init__(self, inner: _Loader, refScope: int | None, salad_version: str) -> None: +class _TypeDSLLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -944,7 +946,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -966,8 +968,8 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -class _IdMapLoader(_Loader): - def __init__(self, inner: _Loader, mapSubject: str, mapPredicate: str | None) -> None: +class _IdMapLoader(_Loader[T]): + def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -979,7 +981,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> Any: + ) -> T: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -1006,12 +1008,12 @@ def load( def _document_load( - loader: _Loader, + loader: _Loader[T], doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, LoadingOptions]: +) -> tuple[T, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1076,11 +1078,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader, + loader: _Loader[T], url: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, LoadingOptions]: +) -> tuple[T, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1266,14 +1268,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -1394,13 +1396,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1415,7 +1417,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -1738,14 +1740,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -1867,13 +1868,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -1888,7 +1889,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -2802,14 +2803,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -2930,13 +2931,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -2951,7 +2952,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -4642,14 +4643,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -5052,7 +5053,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, label=label, @@ -5064,7 +5065,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5079,7 +5080,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -5259,14 +5260,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -5481,7 +5481,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, @@ -5489,7 +5489,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5504,7 +5504,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -5639,14 +5639,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -5862,7 +5861,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -5870,7 +5869,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -5885,7 +5884,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -6019,14 +6018,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -6242,7 +6240,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, items=items, type_=type_, label=label, @@ -6250,7 +6248,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6265,7 +6263,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -6411,14 +6409,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -6727,7 +6725,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, label=label, @@ -6737,7 +6735,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6752,7 +6750,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -6904,14 +6902,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -7126,7 +7123,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, @@ -7134,7 +7131,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7149,7 +7146,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -7284,14 +7281,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -7507,7 +7503,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -7515,7 +7511,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7530,7 +7526,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -7664,14 +7660,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -7887,7 +7882,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, items=items, type_=type_, label=label, @@ -7895,7 +7890,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7910,7 +7905,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -9920,14 +9915,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -10377,7 +10372,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, label=label, @@ -10390,7 +10385,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10405,7 +10400,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -10605,14 +10600,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -10874,7 +10868,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, @@ -10883,7 +10877,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -10898,7 +10892,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -11052,14 +11046,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -11322,7 +11315,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -11331,7 +11324,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11346,7 +11339,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -11492,14 +11485,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -11762,7 +11754,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, items=items, type_=type_, label=label, @@ -11771,7 +11763,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11786,7 +11778,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -11943,14 +11935,14 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: + name = "" _errors__.append(ValidationException("missing name")) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name doc = None if "doc" in _doc: try: @@ -12306,7 +12298,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, doc=doc, type_=type_, label=label, @@ -12317,7 +12309,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12332,7 +12324,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.doc is not None: r["doc"] = save( @@ -12502,14 +12494,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name fields = None if "fields" in _doc: try: @@ -12724,7 +12715,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, fields=fields, type_=type_, label=label, @@ -12732,7 +12723,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12747,7 +12738,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.fields is not None: r["fields"] = save( @@ -12882,14 +12873,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) @@ -13105,7 +13095,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, symbols=symbols, type_=type_, label=label, @@ -13113,7 +13103,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -13128,7 +13118,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.symbols is not None: u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) @@ -13262,14 +13252,13 @@ def fromDoc( ) ) - __original_name_is_none = name is None if name is None: if docRoot is not None: name = docRoot else: name = "_:" + str(_uuid__.uuid4()) - if not __original_name_is_none: - baseuri = cast(str, name) + else: + baseuri = name try: if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) @@ -13485,7 +13474,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=cast(str, name), + name=name, items=items, type_=type_, label=label, @@ -13493,7 +13482,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, name)] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -13508,7 +13497,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.name is not None: - u = save_relative_uri(self.name, base_url, True, None, relative_uris) + u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u if self.items is not None: u = save_relative_uri(self.items, self.name, False, 2, relative_uris) @@ -13666,14 +13655,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -14170,7 +14159,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -14184,7 +14173,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14199,7 +14188,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -14414,14 +14403,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -14777,7 +14766,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -14788,7 +14777,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14803,7 +14792,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -15012,14 +15001,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -15815,7 +15803,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -15835,7 +15823,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -15850,7 +15838,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -19230,14 +19218,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -19546,7 +19534,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -19556,7 +19544,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -19571,7 +19559,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -19743,14 +19731,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -20247,7 +20235,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -20261,7 +20249,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -20276,7 +20264,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -20504,14 +20492,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -20979,7 +20966,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -20992,7 +20979,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -21007,7 +20994,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -21226,14 +21213,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -21683,7 +21670,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -21696,7 +21683,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -21711,7 +21698,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -22019,14 +22006,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id source = None if "source" in _doc: try: @@ -22428,7 +22415,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, source=source, linkMerge=linkMerge, pickValue=pickValue, @@ -22440,7 +22427,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22455,7 +22442,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.source is not None: u = save_relative_uri(self.source, self.id, False, 2, relative_uris) @@ -22635,14 +22622,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -22666,11 +22653,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22685,7 +22672,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u # top refers to the directory level @@ -22897,14 +22884,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -23405,7 +23392,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, in_=in_, @@ -23419,7 +23406,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -23434,7 +23421,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -23693,14 +23680,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -24168,7 +24154,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -24181,7 +24167,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -24196,7 +24182,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -24882,14 +24868,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -25339,7 +25325,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -25352,7 +25338,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -25367,7 +25353,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -25571,14 +25557,14 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: + id = "" _errors__.append(ValidationException("missing id")) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id label = None if "label" in _doc: try: @@ -25887,7 +25873,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, secondaryFiles=secondaryFiles, streamable=streamable, @@ -25897,7 +25883,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -25912,7 +25898,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.label is not None: r["label"] = save( @@ -26093,14 +26079,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -26520,7 +26505,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -26532,7 +26517,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -26547,7 +26532,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -26916,14 +26901,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) @@ -27393,7 +27377,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, label=label, doc=doc, inputs=inputs, @@ -27406,7 +27390,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -27421,7 +27405,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: uri = self.loadingOptions.vocab[self.class_] @@ -28169,14 +28153,13 @@ def fromDoc( ) ) - __original_id_is_none = id is None if id is None: if docRoot is not None: id = docRoot else: id = "_:" + str(_uuid__.uuid4()) - if not __original_id_is_none: - baseuri = cast(str, id) + else: + baseuri = id default = None if "default" in _doc: try: @@ -28437,7 +28420,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=cast(str, id), + id=id, default=default, linkMerge=linkMerge, loopSource=loopSource, @@ -28446,7 +28429,7 @@ def fromDoc( extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[cast(str, id)] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -28461,7 +28444,7 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.id is not None: - u = save_relative_uri(self.id, base_url, True, None, relative_uris) + u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.default is not None: r["default"] = save( @@ -29267,14 +29250,16 @@ def __init__( "https://w3id.org/cwl/cwl#v1.2": "v1.2", }) -strtype: Final = _PrimitiveLoader(str) -inttype: Final = _PrimitiveLoader(i32) -floattype: Final = _PrimitiveLoader(float) -booltype: Final = _PrimitiveLoader(bool) -None_type: Final = _PrimitiveLoader(type(None)) -Any_type: Final = _AnyLoader() -longtype: Final = _PrimitiveLoader(i64) -PrimitiveTypeLoader: Final = _EnumLoader( +strtype: Final[_Loader[str]] = _PrimitiveLoader(str) +inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +floattype: Final[_Loader[float]] = _PrimitiveLoader(float) +booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) +None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) +Any_type: Final[_Loader[Any]] = _AnyLoader() +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) +PrimitiveTypeLoader: Final[ + _Loader[Literal["null", "boolean", "int", "long", "float", "double", "string"]] +] = _EnumLoader( ( "null", "boolean", @@ -29300,17 +29285,33 @@ def __init__( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader: Final = _EnumLoader(("Any",), "Any") +AnyLoader: Final[_Loader[Literal["Any"]]] = _EnumLoader(("Any",), "Any") """ The **Any** type validates for any non-null value. """ -RecordFieldLoader: Final = _RecordLoader(RecordField, None, None) -RecordSchemaLoader: Final = _RecordLoader(RecordSchema, None, None) -EnumSchemaLoader: Final = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader: Final = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader: Final = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader: Final = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader: Final = _EnumLoader( +RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) +RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( + RecordSchema, None, None +) +EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) +ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) +MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) +UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) +CWLTypeLoader: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + ] +] = _EnumLoader( ( "null", "boolean", @@ -29329,65 +29330,116 @@ def __init__( File: A File object Directory: A Directory object """ -CWLArraySchemaLoader: Final = _RecordLoader(CWLArraySchema, None, None) -CWLRecordFieldLoader: Final = _RecordLoader(CWLRecordField, None, None) -CWLRecordSchemaLoader: Final = _RecordLoader(CWLRecordSchema, None, None) -FileLoader: Final = _RecordLoader(File, None, None) -DirectoryLoader: Final = _RecordLoader(Directory, None, None) -CWLObjectTypeLoader: Final = _UnionLoader((), "CWLObjectTypeLoader") -union_of_None_type_or_CWLObjectTypeLoader: Final = _UnionLoader( - ( - None_type, - CWLObjectTypeLoader, +CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( + CWLArraySchema, None, None +) +CWLRecordFieldLoader: Final[_Loader[CWLRecordField]] = _RecordLoader( + CWLRecordField, None, None +) +CWLRecordSchemaLoader: Final[_Loader[CWLRecordSchema]] = _RecordLoader( + CWLRecordSchema, None, None +) +FileLoader: Final[_Loader[File]] = _RecordLoader(File, None, None) +DirectoryLoader: Final[_Loader[Directory]] = _RecordLoader(Directory, None, None) +CWLObjectTypeLoader: Final[_UnionLoader[Any]] = _UnionLoader((), "CWLObjectTypeLoader") +union_of_None_type_or_CWLObjectTypeLoader: Final[_Loader[CWLObjectType | None]] = ( + _UnionLoader( + ( + None_type, + CWLObjectTypeLoader, + ) ) ) -array_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _ArrayLoader( - union_of_None_type_or_CWLObjectTypeLoader +array_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Sequence[CWLObjectType | None]] +] = _ArrayLoader(union_of_None_type_or_CWLObjectTypeLoader) +map_of_union_of_None_type_or_CWLObjectTypeLoader: Final[ + _Loader[Mapping[str, CWLObjectType | None]] +] = _MapLoader(union_of_None_type_or_CWLObjectTypeLoader, "None", None, None) +InlineJavascriptRequirementLoader: Final[_Loader[InlineJavascriptRequirement]] = ( + _RecordLoader(InlineJavascriptRequirement, None, None) ) -map_of_union_of_None_type_or_CWLObjectTypeLoader: Final = _MapLoader( - union_of_None_type_or_CWLObjectTypeLoader, "None", None, None +SchemaDefRequirementLoader: Final[_Loader[SchemaDefRequirement]] = _RecordLoader( + SchemaDefRequirement, None, None ) -InlineJavascriptRequirementLoader: Final = _RecordLoader( - InlineJavascriptRequirement, None, None +LoadListingRequirementLoader: Final[_Loader[LoadListingRequirement]] = _RecordLoader( + LoadListingRequirement, None, None ) -SchemaDefRequirementLoader: Final = _RecordLoader(SchemaDefRequirement, None, None) -LoadListingRequirementLoader: Final = _RecordLoader(LoadListingRequirement, None, None) -DockerRequirementLoader: Final = _RecordLoader(DockerRequirement, None, None) -SoftwareRequirementLoader: Final = _RecordLoader(SoftwareRequirement, None, None) -InitialWorkDirRequirementLoader: Final = _RecordLoader( - InitialWorkDirRequirement, None, None +DockerRequirementLoader: Final[_Loader[DockerRequirement]] = _RecordLoader( + DockerRequirement, None, None ) -EnvVarRequirementLoader: Final = _RecordLoader(EnvVarRequirement, None, None) -ShellCommandRequirementLoader: Final = _RecordLoader( +SoftwareRequirementLoader: Final[_Loader[SoftwareRequirement]] = _RecordLoader( + SoftwareRequirement, None, None +) +InitialWorkDirRequirementLoader: Final[_Loader[InitialWorkDirRequirement]] = ( + _RecordLoader(InitialWorkDirRequirement, None, None) +) +EnvVarRequirementLoader: Final[_Loader[EnvVarRequirement]] = _RecordLoader( + EnvVarRequirement, None, None +) +ShellCommandRequirementLoader: Final[_Loader[ShellCommandRequirement]] = _RecordLoader( ShellCommandRequirement, None, None ) -ResourceRequirementLoader: Final = _RecordLoader(ResourceRequirement, None, None) -WorkReuseLoader: Final = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader: Final = _RecordLoader(NetworkAccess, None, None) -InplaceUpdateRequirementLoader: Final = _RecordLoader( - InplaceUpdateRequirement, None, None +ResourceRequirementLoader: Final[_Loader[ResourceRequirement]] = _RecordLoader( + ResourceRequirement, None, None ) -ToolTimeLimitLoader: Final = _RecordLoader(ToolTimeLimit, None, None) -SubworkflowFeatureRequirementLoader: Final = _RecordLoader( - SubworkflowFeatureRequirement, None, None +WorkReuseLoader: Final[_Loader[WorkReuse]] = _RecordLoader(WorkReuse, None, None) +NetworkAccessLoader: Final[_Loader[NetworkAccess]] = _RecordLoader( + NetworkAccess, None, None ) -ScatterFeatureRequirementLoader: Final = _RecordLoader( - ScatterFeatureRequirement, None, None +InplaceUpdateRequirementLoader: Final[_Loader[InplaceUpdateRequirement]] = ( + _RecordLoader(InplaceUpdateRequirement, None, None) ) -MultipleInputFeatureRequirementLoader: Final = _RecordLoader( - MultipleInputFeatureRequirement, None, None +ToolTimeLimitLoader: Final[_Loader[ToolTimeLimit]] = _RecordLoader( + ToolTimeLimit, None, None ) -StepInputExpressionRequirementLoader: Final = _RecordLoader( - StepInputExpressionRequirement, None, None +SubworkflowFeatureRequirementLoader: Final[_Loader[SubworkflowFeatureRequirement]] = ( + _RecordLoader(SubworkflowFeatureRequirement, None, None) ) -SecretsLoader: Final = _RecordLoader(Secrets, None, None) -MPIRequirementLoader: Final = _RecordLoader(MPIRequirement, None, None) -CUDARequirementLoader: Final = _RecordLoader(CUDARequirement, None, None) -LoopLoader: Final = _RecordLoader(Loop, None, None) -ShmSizeLoader: Final = _RecordLoader(ShmSize, None, None) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: ( - Final -) = _UnionLoader( +ScatterFeatureRequirementLoader: Final[_Loader[ScatterFeatureRequirement]] = ( + _RecordLoader(ScatterFeatureRequirement, None, None) +) +MultipleInputFeatureRequirementLoader: Final[ + _Loader[MultipleInputFeatureRequirement] +] = _RecordLoader(MultipleInputFeatureRequirement, None, None) +StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( + _RecordLoader(StepInputExpressionRequirement, None, None) +) +SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) +MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( + MPIRequirement, None, None +) +CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( + CUDARequirement, None, None +) +LoopLoader: Final[_Loader[Loop]] = _RecordLoader(Loop, None, None) +ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ + _Loader[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -29413,36 +29465,150 @@ def __init__( ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ + _Loader[ + Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: ( - Final -) = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ + _Loader[ + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, CWLObjectTypeLoader, ) ) -map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: ( - Final -) = _MapLoader( +map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ + _Loader[ + Mapping[ + str, + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ], + ] + ] +] = _MapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True, ) -CWLInputFileLoader: Final = ( - map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader -) -CWLVersionLoader: Final = _EnumLoader(("v1.2",), "CWLVersion") +CWLInputFileLoader: Final[ + _Loader[ + Mapping[ + str, + CWLObjectType + | None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ], + ] + ] +] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader +CWLVersionLoader: Final[_Loader[Literal["v1.2"]]] = _EnumLoader(("v1.2",), "CWLVersion") """ Current version symbol for CWL documents. """ -LoadListingEnumLoader: Final = _EnumLoader( +LoadListingEnumLoader: Final[ + _Loader[Literal["no_listing", "shallow_listing", "deep_listing"]] +] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -29458,45 +29624,77 @@ def __init__( shallow_listing: Only load the top level listing, do not recurse into subdirectories. deep_listing: Load the directory listing and recursively load all subdirectories as well. """ -ExpressionLoader: Final = _ExpressionLoader(str) -InputBindingLoader: Final = _RecordLoader(InputBinding, None, None) -InputRecordFieldLoader: Final = _RecordLoader(InputRecordField, None, None) -InputRecordSchemaLoader: Final = _RecordLoader(InputRecordSchema, None, None) -InputEnumSchemaLoader: Final = _RecordLoader(InputEnumSchema, None, None) -InputArraySchemaLoader: Final = _RecordLoader(InputArraySchema, None, None) -OutputRecordFieldLoader: Final = _RecordLoader(OutputRecordField, None, None) -OutputRecordSchemaLoader: Final = _RecordLoader(OutputRecordSchema, None, None) -OutputEnumSchemaLoader: Final = _RecordLoader(OutputEnumSchema, None, None) -OutputArraySchemaLoader: Final = _RecordLoader(OutputArraySchema, None, None) -SecondaryFileSchemaLoader: Final = _RecordLoader(SecondaryFileSchema, None, None) -EnvironmentDefLoader: Final = _RecordLoader(EnvironmentDef, None, None) -CommandLineBindingLoader: Final = _RecordLoader(CommandLineBinding, None, None) -CommandOutputBindingLoader: Final = _RecordLoader(CommandOutputBinding, None, None) -CommandInputRecordFieldLoader: Final = _RecordLoader( +ExpressionLoader = _ExpressionLoader(str) +InputBindingLoader: Final[_Loader[InputBinding]] = _RecordLoader( + InputBinding, None, None +) +InputRecordFieldLoader: Final[_Loader[InputRecordField]] = _RecordLoader( + InputRecordField, None, None +) +InputRecordSchemaLoader: Final[_Loader[InputRecordSchema]] = _RecordLoader( + InputRecordSchema, None, None +) +InputEnumSchemaLoader: Final[_Loader[InputEnumSchema]] = _RecordLoader( + InputEnumSchema, None, None +) +InputArraySchemaLoader: Final[_Loader[InputArraySchema]] = _RecordLoader( + InputArraySchema, None, None +) +OutputRecordFieldLoader: Final[_Loader[OutputRecordField]] = _RecordLoader( + OutputRecordField, None, None +) +OutputRecordSchemaLoader: Final[_Loader[OutputRecordSchema]] = _RecordLoader( + OutputRecordSchema, None, None +) +OutputEnumSchemaLoader: Final[_Loader[OutputEnumSchema]] = _RecordLoader( + OutputEnumSchema, None, None +) +OutputArraySchemaLoader: Final[_Loader[OutputArraySchema]] = _RecordLoader( + OutputArraySchema, None, None +) +SecondaryFileSchemaLoader: Final[_Loader[SecondaryFileSchema]] = _RecordLoader( + SecondaryFileSchema, None, None +) +EnvironmentDefLoader: Final[_Loader[EnvironmentDef]] = _RecordLoader( + EnvironmentDef, None, None +) +CommandLineBindingLoader: Final[_Loader[CommandLineBinding]] = _RecordLoader( + CommandLineBinding, None, None +) +CommandOutputBindingLoader: Final[_Loader[CommandOutputBinding]] = _RecordLoader( + CommandOutputBinding, None, None +) +CommandInputRecordFieldLoader: Final[_Loader[CommandInputRecordField]] = _RecordLoader( CommandInputRecordField, None, None ) -CommandInputRecordSchemaLoader: Final = _RecordLoader( - CommandInputRecordSchema, None, None +CommandInputRecordSchemaLoader: Final[_Loader[CommandInputRecordSchema]] = ( + _RecordLoader(CommandInputRecordSchema, None, None) +) +CommandInputEnumSchemaLoader: Final[_Loader[CommandInputEnumSchema]] = _RecordLoader( + CommandInputEnumSchema, None, None ) -CommandInputEnumSchemaLoader: Final = _RecordLoader(CommandInputEnumSchema, None, None) -CommandInputArraySchemaLoader: Final = _RecordLoader( +CommandInputArraySchemaLoader: Final[_Loader[CommandInputArraySchema]] = _RecordLoader( CommandInputArraySchema, None, None ) -CommandOutputRecordFieldLoader: Final = _RecordLoader( - CommandOutputRecordField, None, None +CommandOutputRecordFieldLoader: Final[_Loader[CommandOutputRecordField]] = ( + _RecordLoader(CommandOutputRecordField, None, None) ) -CommandOutputRecordSchemaLoader: Final = _RecordLoader( - CommandOutputRecordSchema, None, None +CommandOutputRecordSchemaLoader: Final[_Loader[CommandOutputRecordSchema]] = ( + _RecordLoader(CommandOutputRecordSchema, None, None) ) -CommandOutputEnumSchemaLoader: Final = _RecordLoader( +CommandOutputEnumSchemaLoader: Final[_Loader[CommandOutputEnumSchema]] = _RecordLoader( CommandOutputEnumSchema, None, None ) -CommandOutputArraySchemaLoader: Final = _RecordLoader( - CommandOutputArraySchema, None, None +CommandOutputArraySchemaLoader: Final[_Loader[CommandOutputArraySchema]] = ( + _RecordLoader(CommandOutputArraySchema, None, None) +) +CommandInputParameterLoader: Final[_Loader[CommandInputParameter]] = _RecordLoader( + CommandInputParameter, None, None ) -CommandInputParameterLoader: Final = _RecordLoader(CommandInputParameter, None, None) -CommandOutputParameterLoader: Final = _RecordLoader(CommandOutputParameter, None, None) -stdinLoader: Final = _EnumLoader(("stdin",), "stdin") +CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( + CommandOutputParameter, None, None +) +stdinLoader: Final[_Loader[Literal["stdin"]]] = _EnumLoader(("stdin",), "stdin") """ Only valid as a `type` for a `CommandLineTool` input with no `inputBinding` set. `stdin` must not be specified at the `CommandLineTool` @@ -29518,7 +29716,7 @@ def __init__( stdin: $(inputs.an_input_name.path) ``` """ -stdoutLoader: Final = _EnumLoader(("stdout",), "stdout") +stdoutLoader: Final[_Loader[Literal["stdout"]]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29566,7 +29764,7 @@ def __init__( (e.g. `echo a && echo b`) `stdout` must include the output of every command. """ -stderrLoader: Final = _EnumLoader(("stderr",), "stderr") +stderrLoader: Final[_Loader[Literal["stderr"]]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29610,25 +29808,37 @@ def __init__( stderr: random_stderr_filenameABCDEFG ``` """ -CommandLineToolLoader: Final = _RecordLoader(CommandLineTool, None, None) -SoftwarePackageLoader: Final = _RecordLoader(SoftwarePackage, None, None) -DirentLoader: Final = _RecordLoader(Dirent, None, None) -ExpressionToolOutputParameterLoader: Final = _RecordLoader( - ExpressionToolOutputParameter, None, None +CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( + CommandLineTool, None, None ) -WorkflowInputParameterLoader: Final = _RecordLoader(WorkflowInputParameter, None, None) -ExpressionToolLoader: Final = _RecordLoader(ExpressionTool, None, None) -LinkMergeMethodLoader: Final = _EnumLoader( - ( - "merge_nested", - "merge_flattened", - ), - "LinkMergeMethod", +SoftwarePackageLoader: Final[_Loader[SoftwarePackage]] = _RecordLoader( + SoftwarePackage, None, None +) +DirentLoader: Final[_Loader[Dirent]] = _RecordLoader(Dirent, None, None) +ExpressionToolOutputParameterLoader: Final[_Loader[ExpressionToolOutputParameter]] = ( + _RecordLoader(ExpressionToolOutputParameter, None, None) +) +WorkflowInputParameterLoader: Final[_Loader[WorkflowInputParameter]] = _RecordLoader( + WorkflowInputParameter, None, None +) +ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( + ExpressionTool, None, None +) +LinkMergeMethodLoader: Final[_Loader[Literal["merge_nested", "merge_flattened"]]] = ( + _EnumLoader( + ( + "merge_nested", + "merge_flattened", + ), + "LinkMergeMethod", + ) ) """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -PickValueMethodLoader: Final = _EnumLoader( +PickValueMethodLoader: Final[ + _Loader[Literal["first_non_null", "the_only_non_null", "all_non_null"]] +] = _EnumLoader( ( "first_non_null", "the_only_non_null", @@ -29639,12 +29849,18 @@ def __init__( """ Picking non-null values among inbound data links, described in [WorkflowStepInput](#WorkflowStepInput). """ -WorkflowOutputParameterLoader: Final = _RecordLoader( +WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( WorkflowOutputParameter, None, None ) -WorkflowStepInputLoader: Final = _RecordLoader(WorkflowStepInput, None, None) -WorkflowStepOutputLoader: Final = _RecordLoader(WorkflowStepOutput, None, None) -ScatterMethodLoader: Final = _EnumLoader( +WorkflowStepInputLoader: Final[_Loader[WorkflowStepInput]] = _RecordLoader( + WorkflowStepInput, None, None +) +WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( + WorkflowStepOutput, None, None +) +ScatterMethodLoader: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"]] +] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -29655,29 +29871,45 @@ def __init__( """ The scatter method, as described in [workflow step scatter](#WorkflowStep). """ -WorkflowStepLoader: Final = _RecordLoader(WorkflowStep, None, None) -WorkflowLoader: Final = _RecordLoader(Workflow, None, None) -OperationInputParameterLoader: Final = _RecordLoader( +WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( + WorkflowStep, None, None +) +WorkflowLoader: Final[_Loader[Workflow]] = _RecordLoader(Workflow, None, None) +OperationInputParameterLoader: Final[_Loader[OperationInputParameter]] = _RecordLoader( OperationInputParameter, None, None ) -OperationOutputParameterLoader: Final = _RecordLoader( - OperationOutputParameter, None, None +OperationOutputParameterLoader: Final[_Loader[OperationOutputParameter]] = ( + _RecordLoader(OperationOutputParameter, None, None) +) +OperationLoader: Final[_Loader[Operation]] = _RecordLoader(Operation, None, None) +ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( + ProcessGenerator, None, None ) -OperationLoader: Final = _RecordLoader(Operation, None, None) -ProcessGeneratorLoader: Final = _RecordLoader(ProcessGenerator, None, None) -LoopInputLoader: Final = _RecordLoader(LoopInput, None, None) -array_of_strtype: Final = _ArrayLoader(strtype) -union_of_None_type_or_strtype_or_array_of_strtype: Final = _UnionLoader( +LoopInputLoader: Final[_Loader[LoopInput]] = _RecordLoader(LoopInput, None, None) +array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) +union_of_None_type_or_strtype_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( ( None_type, strtype, array_of_strtype, ) ) -uri_strtype_True_False_None_None: Final = _URILoader(strtype, True, False, None, None) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +uri_strtype_True_False_None_None: Final[_Loader[str]] = _URILoader( + strtype, True, False, None, None +) +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -29688,14 +29920,41 @@ def __init__( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, RecordSchemaLoader, @@ -29707,57 +29966,117 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, ) ) -typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, 2, "v1.1", ) -array_of_RecordFieldLoader: Final = _ArrayLoader(RecordFieldLoader) -union_of_None_type_or_array_of_RecordFieldLoader: Final = _UnionLoader( +array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( + RecordFieldLoader +) +union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _UnionLoader( ( None_type, array_of_RecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final = _IdMapLoader( - union_of_None_type_or_array_of_RecordFieldLoader, "name", "type" +idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ + _Loader[None | Sequence[RecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") +Record_nameLoader: Final[_Loader[Literal["record"]]] = _EnumLoader( + ("record",), "Record_name" +) +typedsl_Record_nameLoader_2: Final[_Loader[Literal["record"]]] = _TypeDSLLoader( + Record_nameLoader, 2, "v1.1" ) -Record_nameLoader: Final = _EnumLoader(("record",), "Record_name") -typedsl_Record_nameLoader_2: Final = _TypeDSLLoader(Record_nameLoader, 2, "v1.1") -union_of_None_type_or_strtype: Final = _UnionLoader( +union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( ( None_type, strtype, ) ) -uri_union_of_None_type_or_strtype_True_False_None_None: Final = _URILoader( - union_of_None_type_or_strtype, True, False, None, None +uri_union_of_None_type_or_strtype_True_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, None) ) -uri_array_of_strtype_True_False_None_None: Final = _URILoader( +uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader: Final = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2: Final = _TypeDSLLoader(Enum_nameLoader, 2, "v1.1") -uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +Enum_nameLoader: Final[_Loader[Literal["enum"]]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Literal["enum"]]] = _TypeDSLLoader( + Enum_nameLoader, 2, "v1.1" +) +uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | Sequence[ + ArraySchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | MapSchema + | RecordSchema + | UnionSchema + | str + ] + | UnionSchema + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype, False, True, 2, None, ) -Array_nameLoader: Final = _EnumLoader(("array",), "Array_name") -typedsl_Array_nameLoader_2: Final = _TypeDSLLoader(Array_nameLoader, 2, "v1.1") -Map_nameLoader: Final = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2: Final = _TypeDSLLoader(Map_nameLoader, 2, "v1.1") -Union_nameLoader: Final = _EnumLoader(("union",), "Union_name") -typedsl_Union_nameLoader_2: Final = _TypeDSLLoader(Union_nameLoader, 2, "v1.1") -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +Array_nameLoader: Final[_Loader[Literal["array"]]] = _EnumLoader( + ("array",), "Array_name" +) +typedsl_Array_nameLoader_2: Final[_Loader[Literal["array"]]] = _TypeDSLLoader( + Array_nameLoader, 2, "v1.1" +) +Map_nameLoader: Final[_Loader[Literal["map"]]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Literal["map"]]] = _TypeDSLLoader( + Map_nameLoader, 2, "v1.1" +) +Union_nameLoader: Final[_Loader[Literal["union"]]] = _EnumLoader( + ("union",), "Union_name" +) +typedsl_Union_nameLoader_2: Final[_Loader[Literal["union"]]] = _TypeDSLLoader( + Union_nameLoader, 2, "v1.1" +) +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -29766,14 +30085,35 @@ def __init__( strtype, ) ) -array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + ] +] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype ) -union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _UnionLoader( ( PrimitiveTypeLoader, CWLRecordSchemaLoader, @@ -29783,66 +30123,96 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, ) ) -uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _URILoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, False, True, 2, None, ) -typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | EnumSchema + | Literal["null", "boolean", "int", "long", "float", "double", "string"] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CWLRecordFieldLoader: Final = _ArrayLoader(CWLRecordFieldLoader) -union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _UnionLoader( +array_of_CWLRecordFieldLoader: Final[_Loader[Sequence[CWLRecordField]]] = _ArrayLoader( + CWLRecordFieldLoader +) +union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _UnionLoader( ( None_type, array_of_CWLRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final = _IdMapLoader( - union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type" -) -File_classLoader: Final = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None: Final = _URILoader( +idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ + _Loader[None | Sequence[CWLRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") +File_classLoader: Final[_Loader[Literal["File"]]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[Literal["File"]]] = _URILoader( File_classLoader, False, True, None, None ) -uri_union_of_None_type_or_strtype_False_False_None_None: Final = _URILoader( - union_of_None_type_or_strtype, False, False, None, None +uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype_or_inttype: Final = _UnionLoader( +union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( ( None_type, inttype, inttype, ) ) -union_of_FileLoader_or_DirectoryLoader: Final = _UnionLoader( +union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( ( FileLoader, DirectoryLoader, ) ) -array_of_union_of_FileLoader_or_DirectoryLoader: Final = _ArrayLoader( - union_of_FileLoader_or_DirectoryLoader -) -union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final = ( - _UnionLoader( - ( - None_type, - array_of_union_of_FileLoader_or_DirectoryLoader, - ) +array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[Sequence[Directory | File]] +] = _ArrayLoader(union_of_FileLoader_or_DirectoryLoader) +union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( + ( + None_type, + array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( - Final -) = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[None | Sequence[Directory | File]] +] = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader @@ -29850,28 +30220,34 @@ def __init__( union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -uri_union_of_None_type_or_strtype_True_False_None_True: Final = _URILoader( - union_of_None_type_or_strtype, True, False, None, True +uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( + _URILoader(union_of_None_type_or_strtype, True, False, None, True) ) -Directory_classLoader: Final = _EnumLoader(("Directory",), "Directory_class") -uri_Directory_classLoader_False_True_None_None: Final = _URILoader( - Directory_classLoader, False, True, None, None +Directory_classLoader: Final[_Loader[Literal["Directory"]]] = _EnumLoader( + ("Directory",), "Directory_class" ) -union_of_None_type_or_booltype: Final = _UnionLoader( +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Literal["Directory"]]] = ( + _URILoader(Directory_classLoader, False, True, None, None) +) +union_of_None_type_or_booltype: Final[_Loader[None | bool]] = _UnionLoader( ( None_type, booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader: Final = _UnionLoader( +union_of_None_type_or_LoadListingEnumLoader: Final[ + _Loader[Literal["no_listing", "shallow_listing", "deep_listing"] | None] +] = _UnionLoader( ( None_type, LoadListingEnumLoader, ) ) -array_of_SecondaryFileSchemaLoader: Final = _ArrayLoader(SecondaryFileSchemaLoader) +array_of_SecondaryFileSchemaLoader: Final[_Loader[Sequence[SecondaryFileSchema]]] = ( + _ArrayLoader(SecondaryFileSchemaLoader) +) union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( - Final + Final[_Loader[None | SecondaryFileSchema | Sequence[SecondaryFileSchema]]] ) = _UnionLoader( ( None_type, @@ -29879,9 +30255,9 @@ def __init__( array_of_SecondaryFileSchemaLoader, ) ) -secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: ( - Final -) = _UnionLoader( +secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader: Final[ + _Loader[None | SecondaryFileSchema | Sequence[SecondaryFileSchema]] +] = _UnionLoader( ( _SecondaryDSLLoader( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader @@ -29889,40 +30265,58 @@ def __init__( union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, ) ) -union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final = ( - _UnionLoader( - ( - None_type, - strtype, - array_of_strtype, - ExpressionLoader, - ) +union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( + ( + None_type, + strtype, + array_of_strtype, + ExpressionLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: ( - Final -) = _URILoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader( union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader, True, False, None, True, ) -union_of_None_type_or_strtype_or_ExpressionLoader: Final = _UnionLoader( - ( - None_type, - strtype, - ExpressionLoader, +union_of_None_type_or_strtype_or_ExpressionLoader: Final[_Loader[None | str]] = ( + _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + ) ) ) -uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final = ( - _URILoader( - union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True - ) +uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True: Final[ + _Loader[None | str] +] = _URILoader( + union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -29931,14 +30325,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, InputRecordSchemaLoader, @@ -29948,35 +30393,121 @@ def __init__( array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_InputRecordFieldLoader: Final = _ArrayLoader(InputRecordFieldLoader) -union_of_None_type_or_array_of_InputRecordFieldLoader: Final = _UnionLoader( +array_of_InputRecordFieldLoader: Final[_Loader[Sequence[InputRecordField]]] = ( + _ArrayLoader(InputRecordFieldLoader) +) +union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _UnionLoader( ( None_type, array_of_InputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final = ( - _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") -) -uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader: Final[ + _Loader[None | Sequence[InputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + InputArraySchema + | InputEnumSchema + | InputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -29985,14 +30516,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, OutputRecordSchemaLoader, @@ -30002,56 +30584,139 @@ def __init__( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_OutputRecordFieldLoader: Final = _ArrayLoader(OutputRecordFieldLoader) -union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = _UnionLoader( +array_of_OutputRecordFieldLoader: Final[_Loader[Sequence[OutputRecordField]]] = ( + _ArrayLoader(OutputRecordFieldLoader) +) +union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _UnionLoader( ( None_type, array_of_OutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final = ( - _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") -) -uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader: Final[ + _Loader[None | Sequence[OutputRecordField]] +] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") +uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | Sequence[ + Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | OutputArraySchema + | OutputEnumSchema + | OutputRecordSchema + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: ( - Final -) = _UnionLoader( +union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: Final[ + _Loader[CommandInputParameter | OperationInputParameter | WorkflowInputParameter] +] = _UnionLoader( ( CommandInputParameterLoader, WorkflowInputParameterLoader, OperationInputParameterLoader, ) ) -array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandInputParameter | OperationInputParameter | WorkflowInputParameter + ] + ] +] = _ArrayLoader( union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader ) -idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: ( - Final -) = _IdMapLoader( +idmap_inputs_array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandInputParameter | OperationInputParameter | WorkflowInputParameter + ] + ] +] = _IdMapLoader( array_of_union_of_CommandInputParameterLoader_or_WorkflowInputParameterLoader_or_OperationInputParameterLoader, "id", "type", ) -union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: ( - Final -) = _UnionLoader( +union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: Final[ + _Loader[ + CommandOutputParameter + | ExpressionToolOutputParameter + | OperationOutputParameter + | WorkflowOutputParameter + ] +] = _UnionLoader( ( CommandOutputParameterLoader, ExpressionToolOutputParameterLoader, @@ -30059,36 +30724,126 @@ def __init__( OperationOutputParameterLoader, ) ) -array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandOutputParameter + | ExpressionToolOutputParameter + | OperationOutputParameter + | WorkflowOutputParameter + ] + ] +] = _ArrayLoader( union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader ) -idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: ( - Final -) = _IdMapLoader( +idmap_outputs_array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader: Final[ + _Loader[ + Sequence[ + CommandOutputParameter + | ExpressionToolOutputParameter + | OperationOutputParameter + | WorkflowOutputParameter + ] + ] +] = _IdMapLoader( array_of_union_of_CommandOutputParameterLoader_or_ExpressionToolOutputParameterLoader_or_WorkflowOutputParameterLoader_or_OperationOutputParameterLoader, "id", "type", ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: ( - Final -) = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: ( - Final -) = _IdMapLoader( +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ + _Loader[ + None + | Sequence[ + CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _UnionLoader( +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] +] = _UnionLoader( ( InlineJavascriptRequirementLoader, SchemaDefRequirementLoader, @@ -30115,121 +30870,231 @@ def __init__( Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _ArrayLoader( +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _ArrayLoader( union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _UnionLoader( +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _UnionLoader( ( None_type, array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: ( - Final -) = _IdMapLoader( +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ + _Loader[ + None + | Sequence[ + Any + | CUDARequirement + | DockerRequirement + | EnvVarRequirement + | InitialWorkDirRequirement + | InlineJavascriptRequirement + | InplaceUpdateRequirement + | LoadListingRequirement + | Loop + | MPIRequirement + | MultipleInputFeatureRequirement + | NetworkAccess + | ResourceRequirement + | ScatterFeatureRequirement + | SchemaDefRequirement + | Secrets + | ShellCommandRequirement + | ShmSize + | SoftwareRequirement + | StepInputExpressionRequirement + | SubworkflowFeatureRequirement + | ToolTimeLimit + | WorkReuse + ] + ] +] = _IdMapLoader( union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, "class", "None", ) -union_of_None_type_or_CWLVersionLoader: Final = _UnionLoader( - ( - None_type, - CWLVersionLoader, +union_of_None_type_or_CWLVersionLoader: Final[_Loader[Literal["v1.2"] | None]] = ( + _UnionLoader( + ( + None_type, + CWLVersionLoader, + ) ) ) -uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final = _URILoader( - union_of_None_type_or_CWLVersionLoader, False, True, None, None -) -union_of_None_type_or_array_of_strtype: Final = _UnionLoader( - ( - None_type, - array_of_strtype, +uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ + _Loader[Literal["v1.2"] | None] +] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) +union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( + _UnionLoader( + ( + None_type, + array_of_strtype, + ) ) ) -uri_union_of_None_type_or_array_of_strtype_True_False_None_None: Final = _URILoader( - union_of_None_type_or_array_of_strtype, True, False, None, None +uri_union_of_None_type_or_array_of_strtype_True_False_None_None: Final[ + _Loader[None | Sequence[str]] +] = _URILoader(union_of_None_type_or_array_of_strtype, True, False, None, None) +InlineJavascriptRequirement_classLoader: Final[ + _Loader[Literal["InlineJavascriptRequirement"]] +] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") +uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["InlineJavascriptRequirement"]] +] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) +SchemaDefRequirement_classLoader: Final[_Loader[Literal["SchemaDefRequirement"]]] = ( + _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) -InlineJavascriptRequirement_classLoader: Final = _EnumLoader( - ("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class" -) -uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final = _URILoader( - InlineJavascriptRequirement_classLoader, False, True, None, None -) -SchemaDefRequirement_classLoader: Final = _EnumLoader( - ("SchemaDefRequirement",), "SchemaDefRequirement_class" -) -uri_SchemaDefRequirement_classLoader_False_True_None_None: Final = _URILoader( - SchemaDefRequirement_classLoader, False, True, None, None -) -union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( - Final -) = _UnionLoader( +uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SchemaDefRequirement"]] +] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) +union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ + _Loader[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] +] = _UnionLoader( ( CommandInputRecordSchemaLoader, CommandInputEnumSchemaLoader, CommandInputArraySchemaLoader, ) ) -array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ + _Loader[ + Sequence[ + CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema + ] + ] +] = _ArrayLoader( union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader ) -union_of_strtype_or_ExpressionLoader: Final = _UnionLoader( +union_of_strtype_or_ExpressionLoader: Final[_Loader[str]] = _UnionLoader( ( strtype, ExpressionLoader, ) ) -union_of_None_type_or_booltype_or_ExpressionLoader: Final = _UnionLoader( +union_of_None_type_or_booltype_or_ExpressionLoader: Final[ + _Loader[None | bool | str] +] = _UnionLoader( ( None_type, booltype, ExpressionLoader, ) ) -LoadListingRequirement_classLoader: Final = _EnumLoader( - ("LoadListingRequirement",), "LoadListingRequirement_class" -) -uri_LoadListingRequirement_classLoader_False_True_None_None: Final = _URILoader( - LoadListingRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_inttype_or_ExpressionLoader: Final = _UnionLoader( - ( - None_type, - inttype, - ExpressionLoader, - ) -) -union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final = ( +LoadListingRequirement_classLoader: Final[ + _Loader[Literal["LoadListingRequirement"]] +] = _EnumLoader(("LoadListingRequirement",), "LoadListingRequirement_class") +uri_LoadListingRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["LoadListingRequirement"]] +] = _URILoader(LoadListingRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( _UnionLoader( ( None_type, - strtype, + inttype, ExpressionLoader, - array_of_strtype, ) ) ) -union_of_None_type_or_ExpressionLoader: Final = _UnionLoader( +union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype: Final[ + _Loader[None | Sequence[str] | str] +] = _UnionLoader( + ( + None_type, + strtype, + ExpressionLoader, + array_of_strtype, + ) +) +union_of_None_type_or_ExpressionLoader: Final[_Loader[None | str]] = _UnionLoader( ( None_type, ExpressionLoader, ) ) -union_of_None_type_or_CommandLineBindingLoader: Final = _UnionLoader( +union_of_None_type_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | None] +] = _UnionLoader( ( None_type, CommandLineBindingLoader, ) ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -30238,14 +31103,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandInputRecordSchemaLoader, @@ -30255,39 +31171,123 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -array_of_CommandInputRecordFieldLoader: Final = _ArrayLoader( - CommandInputRecordFieldLoader -) -union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = _UnionLoader( +array_of_CommandInputRecordFieldLoader: Final[ + _Loader[Sequence[CommandInputRecordField]] +] = _ArrayLoader(CommandInputRecordFieldLoader) +union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandInputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandInputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandInputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -30296,14 +31296,65 @@ def __init__( strtype, ) ) -array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _ArrayLoader( +array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + ] +] = _ArrayLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype ) -union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, CommandOutputRecordSchemaLoader, @@ -30313,45 +31364,149 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_None_type_or_CommandOutputBindingLoader: Final = _UnionLoader( +union_of_None_type_or_CommandOutputBindingLoader: Final[ + _Loader[CommandOutputBinding | None] +] = _UnionLoader( ( None_type, CommandOutputBindingLoader, ) ) -array_of_CommandOutputRecordFieldLoader: Final = _ArrayLoader( - CommandOutputRecordFieldLoader -) -union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = _UnionLoader( +array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[Sequence[CommandOutputRecordField]] +] = _ArrayLoader(CommandOutputRecordFieldLoader) +union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _UnionLoader( ( None_type, array_of_CommandOutputRecordFieldLoader, ) ) -idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final = ( - _IdMapLoader( - union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" - ) +idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader: Final[ + _Loader[None | Sequence[CommandOutputRecordField]] +] = _IdMapLoader( + union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, "name", "type" ) -uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: ( - Final -) = _URILoader( +uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _URILoader( union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, False, True, 2, None, ) -union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stdin"] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, stdinLoader, @@ -30362,16 +31517,85 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stdin"] + | Sequence[ + CommandInputArraySchema + | CommandInputEnumSchema + | CommandInputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype, 2, "v1.1", ) -union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: ( - Final -) = _UnionLoader( +union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stderr"] + | Literal["stdout"] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _UnionLoader( ( CWLTypeLoader, stdoutLoader, @@ -30383,82 +31607,125 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, ) ) -typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: ( - Final -) = _TypeDSLLoader( +typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ + _Loader[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | Literal["stderr"] + | Literal["stdout"] + | Sequence[ + CommandOutputArraySchema + | CommandOutputEnumSchema + | CommandOutputRecordSchema + | Literal[ + "null", + "boolean", + "int", + "long", + "float", + "double", + "string", + "File", + "Directory", + ] + | str + ] + | str + ] +] = _TypeDSLLoader( union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype, 2, "v1.1", ) -CommandLineTool_classLoader: Final = _EnumLoader( +CommandLineTool_classLoader: Final[_Loader[Literal["CommandLineTool"]]] = _EnumLoader( ("CommandLineTool",), "CommandLineTool_class" ) -uri_CommandLineTool_classLoader_False_True_None_None: Final = _URILoader( - CommandLineTool_classLoader, False, True, None, None -) -array_of_CommandInputParameterLoader: Final = _ArrayLoader(CommandInputParameterLoader) -idmap_inputs_array_of_CommandInputParameterLoader: Final = _IdMapLoader( - array_of_CommandInputParameterLoader, "id", "type" -) -array_of_CommandOutputParameterLoader: Final = _ArrayLoader( - CommandOutputParameterLoader -) -idmap_outputs_array_of_CommandOutputParameterLoader: Final = _IdMapLoader( - array_of_CommandOutputParameterLoader, "id", "type" -) -union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = _UnionLoader( +uri_CommandLineTool_classLoader_False_True_None_None: Final[ + _Loader[Literal["CommandLineTool"]] +] = _URILoader(CommandLineTool_classLoader, False, True, None, None) +array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _ArrayLoader(CommandInputParameterLoader) +idmap_inputs_array_of_CommandInputParameterLoader: Final[ + _Loader[Sequence[CommandInputParameter]] +] = _IdMapLoader(array_of_CommandInputParameterLoader, "id", "type") +array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _ArrayLoader(CommandOutputParameterLoader) +idmap_outputs_array_of_CommandOutputParameterLoader: Final[ + _Loader[Sequence[CommandOutputParameter]] +] = _IdMapLoader(array_of_CommandOutputParameterLoader, "id", "type") +union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[CommandLineBinding | str] +] = _UnionLoader( ( strtype, ExpressionLoader, CommandLineBindingLoader, ) ) -array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final = ( - _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) -) -union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: ( - Final -) = _UnionLoader( +array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[Sequence[CommandLineBinding | str]] +] = _ArrayLoader(union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader) +union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader: Final[ + _Loader[None | Sequence[CommandLineBinding | str]] +] = _UnionLoader( ( None_type, array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, ) ) -array_of_inttype: Final = _ArrayLoader(inttype) -union_of_None_type_or_array_of_inttype: Final = _UnionLoader( - ( - None_type, - array_of_inttype, +array_of_inttype: Final[_Loader[Sequence[i32]]] = _ArrayLoader(inttype) +union_of_None_type_or_array_of_inttype: Final[_Loader[None | Sequence[i32]]] = ( + _UnionLoader( + ( + None_type, + array_of_inttype, + ) ) ) -DockerRequirement_classLoader: Final = _EnumLoader( - ("DockerRequirement",), "DockerRequirement_class" -) -uri_DockerRequirement_classLoader_False_True_None_None: Final = _URILoader( - DockerRequirement_classLoader, False, True, None, None -) -SoftwareRequirement_classLoader: Final = _EnumLoader( - ("SoftwareRequirement",), "SoftwareRequirement_class" -) -uri_SoftwareRequirement_classLoader_False_True_None_None: Final = _URILoader( - SoftwareRequirement_classLoader, False, True, None, None -) -array_of_SoftwarePackageLoader: Final = _ArrayLoader(SoftwarePackageLoader) -idmap_packages_array_of_SoftwarePackageLoader: Final = _IdMapLoader( - array_of_SoftwarePackageLoader, "package", "specs" -) -uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final = _URILoader( - union_of_None_type_or_array_of_strtype, False, False, None, True +DockerRequirement_classLoader: Final[_Loader[Literal["DockerRequirement"]]] = ( + _EnumLoader(("DockerRequirement",), "DockerRequirement_class") ) -InitialWorkDirRequirement_classLoader: Final = _EnumLoader( - ("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class" +uri_DockerRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["DockerRequirement"]] +] = _URILoader(DockerRequirement_classLoader, False, True, None, None) +SoftwareRequirement_classLoader: Final[_Loader[Literal["SoftwareRequirement"]]] = ( + _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) -uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final = _URILoader( - InitialWorkDirRequirement_classLoader, False, True, None, None +uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SoftwareRequirement"]] +] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) +array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( + _ArrayLoader(SoftwarePackageLoader) ) -union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( - Final -) = _UnionLoader( +idmap_packages_array_of_SoftwarePackageLoader: Final[ + _Loader[Sequence[SoftwarePackage]] +] = _IdMapLoader(array_of_SoftwarePackageLoader, "package", "specs") +uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ + _Loader[None | Sequence[str]] +] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_classLoader: Final[ + _Loader[Literal["InitialWorkDirRequirement"]] +] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") +uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["InitialWorkDirRequirement"]] +] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) +union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[Directory | Dirent | File | None | Sequence[Directory | File] | str] +] = _UnionLoader( ( None_type, DirentLoader, @@ -30468,167 +31735,192 @@ def __init__( array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[ + Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] + ] +] = _ArrayLoader( union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader ) -union_of_ExpressionLoader_or_array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: ( - Final -) = _UnionLoader( +union_of_ExpressionLoader_or_array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ + _Loader[ + Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] + | str + ] +] = _UnionLoader( ( ExpressionLoader, array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -EnvVarRequirement_classLoader: Final = _EnumLoader( - ("EnvVarRequirement",), "EnvVarRequirement_class" -) -uri_EnvVarRequirement_classLoader_False_True_None_None: Final = _URILoader( - EnvVarRequirement_classLoader, False, True, None, None +EnvVarRequirement_classLoader: Final[_Loader[Literal["EnvVarRequirement"]]] = ( + _EnumLoader(("EnvVarRequirement",), "EnvVarRequirement_class") ) -array_of_EnvironmentDefLoader: Final = _ArrayLoader(EnvironmentDefLoader) -idmap_envDef_array_of_EnvironmentDefLoader: Final = _IdMapLoader( - array_of_EnvironmentDefLoader, "envName", "envValue" +uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["EnvVarRequirement"]] +] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) +array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( + EnvironmentDefLoader ) -ShellCommandRequirement_classLoader: Final = _EnumLoader( - ("ShellCommandRequirement",), "ShellCommandRequirement_class" +idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( + _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -uri_ShellCommandRequirement_classLoader_False_True_None_None: Final = _URILoader( - ShellCommandRequirement_classLoader, False, True, None, None +ShellCommandRequirement_classLoader: Final[ + _Loader[Literal["ShellCommandRequirement"]] +] = _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ShellCommandRequirement"]] +] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) +ResourceRequirement_classLoader: Final[_Loader[Literal["ResourceRequirement"]]] = ( + _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) -ResourceRequirement_classLoader: Final = _EnumLoader( - ("ResourceRequirement",), "ResourceRequirement_class" -) -uri_ResourceRequirement_classLoader_False_True_None_None: Final = _URILoader( - ResourceRequirement_classLoader, False, True, None, None -) -union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader: Final = ( - _UnionLoader( - ( - None_type, - inttype, - inttype, - floattype, - ExpressionLoader, - ) +uri_ResourceRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ResourceRequirement"]] +] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) +union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader: Final[ + _Loader[None | float | i32 | str] +] = _UnionLoader( + ( + None_type, + inttype, + inttype, + floattype, + ExpressionLoader, ) ) -WorkReuse_classLoader: Final = _EnumLoader(("WorkReuse",), "WorkReuse_class") -uri_WorkReuse_classLoader_False_True_None_None: Final = _URILoader( - WorkReuse_classLoader, False, True, None, None +WorkReuse_classLoader: Final[_Loader[Literal["WorkReuse"]]] = _EnumLoader( + ("WorkReuse",), "WorkReuse_class" +) +uri_WorkReuse_classLoader_False_True_None_None: Final[_Loader[Literal["WorkReuse"]]] = ( + _URILoader(WorkReuse_classLoader, False, True, None, None) ) -union_of_booltype_or_ExpressionLoader: Final = _UnionLoader( +union_of_booltype_or_ExpressionLoader: Final[_Loader[bool | str]] = _UnionLoader( ( booltype, ExpressionLoader, ) ) -NetworkAccess_classLoader: Final = _EnumLoader( +NetworkAccess_classLoader: Final[_Loader[Literal["NetworkAccess"]]] = _EnumLoader( ("NetworkAccess",), "NetworkAccess_class" ) -uri_NetworkAccess_classLoader_False_True_None_None: Final = _URILoader( - NetworkAccess_classLoader, False, True, None, None -) -InplaceUpdateRequirement_classLoader: Final = _EnumLoader( - ("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class" -) -uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final = _URILoader( - InplaceUpdateRequirement_classLoader, False, True, None, None -) -ToolTimeLimit_classLoader: Final = _EnumLoader( +uri_NetworkAccess_classLoader_False_True_None_None: Final[ + _Loader[Literal["NetworkAccess"]] +] = _URILoader(NetworkAccess_classLoader, False, True, None, None) +InplaceUpdateRequirement_classLoader: Final[ + _Loader[Literal["InplaceUpdateRequirement"]] +] = _EnumLoader(("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class") +uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["InplaceUpdateRequirement"]] +] = _URILoader(InplaceUpdateRequirement_classLoader, False, True, None, None) +ToolTimeLimit_classLoader: Final[_Loader[Literal["ToolTimeLimit"]]] = _EnumLoader( ("ToolTimeLimit",), "ToolTimeLimit_class" ) -uri_ToolTimeLimit_classLoader_False_True_None_None: Final = _URILoader( - ToolTimeLimit_classLoader, False, True, None, None -) -union_of_inttype_or_inttype_or_ExpressionLoader: Final = _UnionLoader( - ( - inttype, - inttype, - ExpressionLoader, +uri_ToolTimeLimit_classLoader_False_True_None_None: Final[ + _Loader[Literal["ToolTimeLimit"]] +] = _URILoader(ToolTimeLimit_classLoader, False, True, None, None) +union_of_inttype_or_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = ( + _UnionLoader( + ( + inttype, + inttype, + ExpressionLoader, + ) ) ) -union_of_None_type_or_InputBindingLoader: Final = _UnionLoader( - ( - None_type, - InputBindingLoader, +union_of_None_type_or_InputBindingLoader: Final[_Loader[InputBinding | None]] = ( + _UnionLoader( + ( + None_type, + InputBindingLoader, + ) ) ) -ExpressionTool_classLoader: Final = _EnumLoader( +ExpressionTool_classLoader: Final[_Loader[Literal["ExpressionTool"]]] = _EnumLoader( ("ExpressionTool",), "ExpressionTool_class" ) -uri_ExpressionTool_classLoader_False_True_None_None: Final = _URILoader( - ExpressionTool_classLoader, False, True, None, None -) -array_of_WorkflowInputParameterLoader: Final = _ArrayLoader( - WorkflowInputParameterLoader -) -idmap_inputs_array_of_WorkflowInputParameterLoader: Final = _IdMapLoader( - array_of_WorkflowInputParameterLoader, "id", "type" -) -array_of_ExpressionToolOutputParameterLoader: Final = _ArrayLoader( - ExpressionToolOutputParameterLoader -) -idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final = _IdMapLoader( - array_of_ExpressionToolOutputParameterLoader, "id", "type" -) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) -) -union_of_None_type_or_LinkMergeMethodLoader: Final = _UnionLoader( +uri_ExpressionTool_classLoader_False_True_None_None: Final[ + _Loader[Literal["ExpressionTool"]] +] = _URILoader(ExpressionTool_classLoader, False, True, None, None) +array_of_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[WorkflowInputParameter]] +] = _ArrayLoader(WorkflowInputParameterLoader) +idmap_inputs_array_of_WorkflowInputParameterLoader: Final[ + _Loader[Sequence[WorkflowInputParameter]] +] = _IdMapLoader(array_of_WorkflowInputParameterLoader, "id", "type") +array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _ArrayLoader(ExpressionToolOutputParameterLoader) +idmap_outputs_array_of_ExpressionToolOutputParameterLoader: Final[ + _Loader[Sequence[ExpressionToolOutputParameter]] +] = _IdMapLoader(array_of_ExpressionToolOutputParameterLoader, "id", "type") +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) +union_of_None_type_or_LinkMergeMethodLoader: Final[ + _Loader[Literal["merge_nested", "merge_flattened"] | None] +] = _UnionLoader( ( None_type, LinkMergeMethodLoader, ) ) -union_of_None_type_or_PickValueMethodLoader: Final = _UnionLoader( +union_of_None_type_or_PickValueMethodLoader: Final[ + _Loader[Literal["first_non_null", "the_only_non_null", "all_non_null"] | None] +] = _UnionLoader( ( None_type, PickValueMethodLoader, ) ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) -) -array_of_WorkflowStepInputLoader: Final = _ArrayLoader(WorkflowStepInputLoader) -idmap_in__array_of_WorkflowStepInputLoader: Final = _IdMapLoader( - array_of_WorkflowStepInputLoader, "id", "source" +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 2, None) +array_of_WorkflowStepInputLoader: Final[_Loader[Sequence[WorkflowStepInput]]] = ( + _ArrayLoader(WorkflowStepInputLoader) ) -union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( +idmap_in__array_of_WorkflowStepInputLoader: Final[ + _Loader[Sequence[WorkflowStepInput]] +] = _IdMapLoader(array_of_WorkflowStepInputLoader, "id", "source") +union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[WorkflowStepOutput | str] +] = _UnionLoader( ( strtype, WorkflowStepOutputLoader, ) ) -array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _ArrayLoader( - union_of_strtype_or_WorkflowStepOutputLoader -) -union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final = _UnionLoader( - (array_of_union_of_strtype_or_WorkflowStepOutputLoader,) -) -uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: ( - Final -) = _URILoader( +array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _ArrayLoader(union_of_strtype_or_WorkflowStepOutputLoader) +union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _UnionLoader((array_of_union_of_strtype_or_WorkflowStepOutputLoader,)) +uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None: Final[ + _Loader[Sequence[WorkflowStepOutput | str]] +] = _URILoader( union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader, True, False, None, None, ) -array_of_Any_type: Final = _ArrayLoader(Any_type) -union_of_None_type_or_array_of_Any_type: Final = _UnionLoader( - ( - None_type, - array_of_Any_type, +array_of_Any_type: Final[_Loader[Sequence[Any]]] = _ArrayLoader(Any_type) +union_of_None_type_or_array_of_Any_type: Final[_Loader[None | Sequence[Any]]] = ( + _UnionLoader( + ( + None_type, + array_of_Any_type, + ) ) ) -idmap_hints_union_of_None_type_or_array_of_Any_type: Final = _IdMapLoader( - union_of_None_type_or_array_of_Any_type, "class", "None" -) -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ + _Loader[None | Sequence[Any]] +] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str + ] +] = _UnionLoader( ( strtype, CommandLineToolLoader, @@ -30638,120 +31930,142 @@ def __init__( ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None: ( - Final -) = _URILoader( +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ + _Loader[ + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str + ] +] = _URILoader( union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, False, False, None, None, ) -uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final = ( - _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) -) -union_of_None_type_or_ScatterMethodLoader: Final = _UnionLoader( +uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ + _Loader[None | Sequence[str] | str] +] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) +union_of_None_type_or_ScatterMethodLoader: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] +] = _UnionLoader( ( None_type, ScatterMethodLoader, ) ) -uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final = _URILoader( - union_of_None_type_or_ScatterMethodLoader, False, True, None, None +uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ + _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] +] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) +Workflow_classLoader: Final[_Loader[Literal["Workflow"]]] = _EnumLoader( + ("Workflow",), "Workflow_class" ) -Workflow_classLoader: Final = _EnumLoader(("Workflow",), "Workflow_class") -uri_Workflow_classLoader_False_True_None_None: Final = _URILoader( - Workflow_classLoader, False, True, None, None +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Literal["Workflow"]]] = ( + _URILoader(Workflow_classLoader, False, True, None, None) ) -array_of_WorkflowOutputParameterLoader: Final = _ArrayLoader( - WorkflowOutputParameterLoader +array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _ArrayLoader(WorkflowOutputParameterLoader) +idmap_outputs_array_of_WorkflowOutputParameterLoader: Final[ + _Loader[Sequence[WorkflowOutputParameter]] +] = _IdMapLoader(array_of_WorkflowOutputParameterLoader, "id", "type") +array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = _ArrayLoader( + WorkflowStepLoader ) -idmap_outputs_array_of_WorkflowOutputParameterLoader: Final = _IdMapLoader( - array_of_WorkflowOutputParameterLoader, "id", "type" +union_of_array_of_WorkflowStepLoader: Final[_Loader[Sequence[WorkflowStep]]] = ( + _UnionLoader((array_of_WorkflowStepLoader,)) ) -array_of_WorkflowStepLoader: Final = _ArrayLoader(WorkflowStepLoader) -union_of_array_of_WorkflowStepLoader: Final = _UnionLoader( - (array_of_WorkflowStepLoader,) -) -idmap_steps_union_of_array_of_WorkflowStepLoader: Final = _IdMapLoader( - union_of_array_of_WorkflowStepLoader, "id", "None" -) -SubworkflowFeatureRequirement_classLoader: Final = _EnumLoader( +idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ + _Loader[Sequence[WorkflowStep]] +] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_classLoader: Final[ + _Loader[Literal["SubworkflowFeatureRequirement"]] +] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) -uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( - SubworkflowFeatureRequirement_classLoader, False, True, None, None -) -ScatterFeatureRequirement_classLoader: Final = _EnumLoader( - ("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class" -) -uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final = _URILoader( - ScatterFeatureRequirement_classLoader, False, True, None, None -) -MultipleInputFeatureRequirement_classLoader: Final = _EnumLoader( +uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["SubworkflowFeatureRequirement"]] +] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_classLoader: Final[ + _Loader[Literal["ScatterFeatureRequirement"]] +] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") +uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["ScatterFeatureRequirement"]] +] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_classLoader: Final[ + _Loader[Literal["MultipleInputFeatureRequirement"]] +] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) -uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final = ( - _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) -) -StepInputExpressionRequirement_classLoader: Final = _EnumLoader( +uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["MultipleInputFeatureRequirement"]] +] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_classLoader: Final[ + _Loader[Literal["StepInputExpressionRequirement"]] +] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) -uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final = _URILoader( - StepInputExpressionRequirement_classLoader, False, True, None, None +uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ + _Loader[Literal["StepInputExpressionRequirement"]] +] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) +Operation_classLoader: Final[_Loader[Literal["Operation"]]] = _EnumLoader( + ("Operation",), "Operation_class" ) -Operation_classLoader: Final = _EnumLoader(("Operation",), "Operation_class") -uri_Operation_classLoader_False_True_None_None: Final = _URILoader( - Operation_classLoader, False, True, None, None +uri_Operation_classLoader_False_True_None_None: Final[_Loader[Literal["Operation"]]] = ( + _URILoader(Operation_classLoader, False, True, None, None) ) -array_of_OperationInputParameterLoader: Final = _ArrayLoader( - OperationInputParameterLoader +array_of_OperationInputParameterLoader: Final[ + _Loader[Sequence[OperationInputParameter]] +] = _ArrayLoader(OperationInputParameterLoader) +idmap_inputs_array_of_OperationInputParameterLoader: Final[ + _Loader[Sequence[OperationInputParameter]] +] = _IdMapLoader(array_of_OperationInputParameterLoader, "id", "type") +array_of_OperationOutputParameterLoader: Final[ + _Loader[Sequence[OperationOutputParameter]] +] = _ArrayLoader(OperationOutputParameterLoader) +idmap_outputs_array_of_OperationOutputParameterLoader: Final[ + _Loader[Sequence[OperationOutputParameter]] +] = _IdMapLoader(array_of_OperationOutputParameterLoader, "id", "type") +uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( + strtype, False, True, None, None ) -idmap_inputs_array_of_OperationInputParameterLoader: Final = _IdMapLoader( - array_of_OperationInputParameterLoader, "id", "type" -) -array_of_OperationOutputParameterLoader: Final = _ArrayLoader( - OperationOutputParameterLoader -) -idmap_outputs_array_of_OperationOutputParameterLoader: Final = _IdMapLoader( - array_of_OperationOutputParameterLoader, "id", "type" -) -uri_strtype_False_True_None_None: Final = _URILoader(strtype, False, True, None, None) -uri_array_of_strtype_False_False_0_None: Final = _URILoader( +uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, False, False, 0, None ) -union_of_inttype_or_ExpressionLoader: Final = _UnionLoader( +union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( ( inttype, ExpressionLoader, ) ) -union_of_strtype_or_array_of_strtype: Final = _UnionLoader( - ( - strtype, - array_of_strtype, +union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( + _UnionLoader( + ( + strtype, + array_of_strtype, + ) ) ) -union_of_None_type_or_Any_type: Final = _UnionLoader( +union_of_None_type_or_Any_type: Final[_Loader[Any | None]] = _UnionLoader( ( None_type, Any_type, ) ) -array_of_LoopInputLoader: Final = _ArrayLoader(LoopInputLoader) -idmap_loop_array_of_LoopInputLoader: Final = _IdMapLoader( +array_of_LoopInputLoader: Final[_Loader[Sequence[LoopInput]]] = _ArrayLoader( + LoopInputLoader +) +idmap_loop_array_of_LoopInputLoader: Final[_Loader[Sequence[LoopInput]]] = _IdMapLoader( array_of_LoopInputLoader, "id", "loopSource" ) -LoopOutputModesLoader: Final = _EnumLoader( +LoopOutputModesLoader: Final[_Loader[Literal["last", "all"]]] = _EnumLoader( ( "last", "all", ), "LoopOutputModes", ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, @@ -30760,14 +32074,27 @@ def __init__( ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( - Final -) = _ArrayLoader( +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + Sequence[ + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow + ] + ] +] = _ArrayLoader( union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: ( - Final -) = _UnionLoader( +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ + _Loader[ + CommandLineTool + | ExpressionTool + | Operation + | ProcessGenerator + | Sequence[ + CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow + ] + | Workflow + ] +] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, From deed7916c65e70385ae86eab8662f3c9075a422b Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sun, 5 Apr 2026 20:30:10 +0200 Subject: [PATCH 19/23] Regenerate parsers with mypyc annotations --- src/cwl_utils/parser/cwl_v1_0.py | 83 ++++++++++++++++++++++++++++- src/cwl_utils/parser/cwl_v1_1.py | 84 +++++++++++++++++++++++++++++- src/cwl_utils/parser/cwl_v1_2.py | 89 +++++++++++++++++++++++++++++++- 3 files changed, 253 insertions(+), 3 deletions(-) diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 23db1d74..5d522ff2 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -18,7 +18,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from mypy_extensions import i32, i64 +from mypy_extensions import i32, i64, mypyc_attr from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -50,6 +50,7 @@ T = TypeVar("T", covariant=True) +@mypyc_attr(native_class=True) class LoadingOptions: idx: Final[IdxType] fileuri: Final[str | None] @@ -215,6 +216,7 @@ def graph(self) -> Graph: return graph +@mypyc_attr(native_class=True) class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @@ -444,6 +446,7 @@ def expand_url( return url +@mypyc_attr(native_class=True) class _Loader(Generic[T], metaclass=ABCMeta): @abstractmethod def load( @@ -456,6 +459,7 @@ def load( ) -> T: ... +@mypyc_attr(native_class=True) class _AnyLoader(_Loader[Any]): def load( self, @@ -470,6 +474,7 @@ def load( raise ValidationException("Expected non-null") +@mypyc_attr(native_class=True) class _PrimitiveLoader(_Loader[T]): def __init__(self, tp: type[T]) -> None: self.tp: Final = tp @@ -490,6 +495,7 @@ def __repr__(self) -> str: return str(self.tp) +@mypyc_attr(native_class=True) class _ArrayLoader(_Loader[Sequence[T]]): def __init__(self, items: _Loader[T]) -> None: self.items: Final = items @@ -547,6 +553,7 @@ def __repr__(self) -> str: return f"array<{self.items}>" +@mypyc_attr(native_class=True) class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, @@ -590,6 +597,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" +@mypyc_attr(native_class=True) class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols @@ -611,6 +619,7 @@ def __repr__(self) -> str: return self.name +@mypyc_attr(native_class=True) class _SecondaryDSLLoader(_Loader[T]): def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner @@ -684,6 +693,7 @@ def load( return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) +@mypyc_attr(native_class=True) class _RecordLoader(_Loader[S]): def __init__( self, @@ -718,6 +728,7 @@ def __repr__(self) -> str: return str(self.classtype.__name__) +@mypyc_attr(native_class=True) class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -739,6 +750,7 @@ def load( return doc +@mypyc_attr(native_class=True) class _UnionLoader(_Loader[T]): def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates @@ -829,6 +841,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) +@mypyc_attr(native_class=True) class _URILoader(_Loader[T]): def __init__( self, @@ -898,6 +911,7 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) +@mypyc_attr(native_class=True) class _TypeDSLLoader(_Loader[T]): def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner @@ -968,6 +982,7 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) +@mypyc_attr(native_class=True) class _IdMapLoader(_Loader[T]): def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner @@ -1187,6 +1202,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_0" +@mypyc_attr(native_class=True) class RecordField(Saveable): """ A field of a record. @@ -1459,6 +1475,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) +@mypyc_attr(native_class=True) class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): @@ -1658,6 +1675,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class EnumSchema(Saveable): """ Define an enumerated type. @@ -1930,6 +1948,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) +@mypyc_attr(native_class=True) class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): @@ -2129,6 +2148,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) +@mypyc_attr(native_class=True) class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): @@ -2328,6 +2348,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) +@mypyc_attr(native_class=True) class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): @@ -2527,6 +2548,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) +@mypyc_attr(native_class=True) class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): @@ -2726,6 +2748,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) +@mypyc_attr(native_class=True) class CWLRecordField(RecordField): name: str @@ -2994,6 +3017,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) +@mypyc_attr(native_class=True) class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): @@ -3193,6 +3217,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class File(Saveable): """ Represents a file (or group of files when `secondaryFiles` is provided) that @@ -4015,6 +4040,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Directory(Saveable): """ Represents a directory to present to a command line tool. @@ -4401,6 +4427,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputRecordField(CWLRecordField): name: str @@ -4784,6 +4811,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputRecordSchema(CWLRecordSchema): name: str @@ -5106,6 +5134,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) +@mypyc_attr(native_class=True) class InputEnumSchema(EnumSchema): name: str @@ -5490,6 +5519,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputArraySchema(CWLArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, InputArraySchema): @@ -5807,6 +5837,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputRecordField(CWLRecordField): name: str @@ -6135,6 +6166,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputRecordSchema(CWLRecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputRecordSchema): @@ -6392,6 +6424,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label"]) +@mypyc_attr(native_class=True) class OutputEnumSchema(EnumSchema): name: str @@ -6776,6 +6809,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputArraySchema(CWLArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, OutputArraySchema): @@ -7093,6 +7127,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputParameter(Saveable): id: str @@ -7722,6 +7757,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputParameter(Saveable): id: str @@ -8237,6 +8273,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InlineJavascriptRequirement(Saveable): """ Indicates that the workflow platform must support inline Javascript expressions. @@ -8419,6 +8456,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) +@mypyc_attr(native_class=True) class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when @@ -8600,6 +8638,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) +@mypyc_attr(native_class=True) class EnvironmentDef(Saveable): """ Define an environment variable that will be set in the runtime environment @@ -8809,6 +8848,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) +@mypyc_attr(native_class=True) class CommandLineBinding(Saveable): """ @@ -9356,6 +9396,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced @@ -9632,6 +9673,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["glob", "loadContents", "outputEval"]) +@mypyc_attr(native_class=True) class CommandInputRecordField(InputRecordField): name: str @@ -10015,6 +10057,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputRecordSchema(InputRecordSchema): name: str @@ -10337,6 +10380,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) +@mypyc_attr(native_class=True) class CommandInputEnumSchema(InputEnumSchema): name: str @@ -10721,6 +10765,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputArraySchema(InputArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CommandInputArraySchema): @@ -11038,6 +11083,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputRecordField(OutputRecordField): name: str @@ -11366,6 +11412,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputRecordSchema(OutputRecordSchema): name: str @@ -11688,6 +11735,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) +@mypyc_attr(native_class=True) class CommandOutputEnumSchema(OutputEnumSchema): name: str @@ -12072,6 +12120,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputArraySchema(OutputArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CommandOutputArraySchema): @@ -12389,6 +12438,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputParameter(InputParameter): """ An input parameter for a CommandLineTool. @@ -13022,6 +13072,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputParameter(OutputParameter): """ An output parameter for a CommandLineTool. @@ -13598,6 +13649,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -14666,6 +14718,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a @@ -15188,6 +15241,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of @@ -15364,6 +15418,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) +@mypyc_attr(native_class=True) class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): @@ -15620,6 +15675,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) +@mypyc_attr(native_class=True) class Dirent(Saveable): """ Define a file or subdirectory that must be placed in the designated output @@ -15888,6 +15944,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) +@mypyc_attr(native_class=True) class InitialWorkDirRequirement(Saveable): """ Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. @@ -16062,6 +16119,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) +@mypyc_attr(native_class=True) class EnvVarRequirement(Saveable): """ Define a list of environment variables which will be set in the @@ -16238,6 +16296,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) +@mypyc_attr(native_class=True) class ShellCommandRequirement(Saveable): """ Modify the behavior of CommandLineTool to generate a single string @@ -16362,6 +16421,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -16979,6 +17039,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class ExpressionToolOutputParameter(OutputParameter): id: str @@ -17551,6 +17612,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class ExpressionTool(Saveable): """ Execute an expression as a Workflow step. @@ -18212,6 +18274,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowOutputParameter(OutputParameter): """ Describe an output parameter of a workflow. The parameter must be @@ -18904,6 +18967,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the @@ -19327,6 +19391,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowStepOutput(Saveable): """ Associate an output parameter of the underlying process with a workflow @@ -19488,6 +19553,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["id"]) +@mypyc_attr(native_class=True) class WorkflowStep(Saveable): """ A workflow step is an executable element of a workflow. It specifies the @@ -20229,6 +20295,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Workflow(Saveable): """ A workflow describes a set of **steps** and the **dependencies** between @@ -20931,6 +20998,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in @@ -21050,6 +21118,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class ScatterFeatureRequirement(Saveable): """ Indicates that the workflow platform must support the `scatter` and @@ -21169,6 +21238,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class MultipleInputFeatureRequirement(Saveable): """ Indicates that the workflow platform must support multiple inbound data links @@ -21288,6 +21358,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class StepInputExpressionRequirement(Saveable): """ Indicate that the workflow platform must support the `valueFrom` field @@ -21407,6 +21478,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class LoadListingRequirement(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, LoadListingRequirement): @@ -21582,6 +21654,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) +@mypyc_attr(native_class=True) class InplaceUpdateRequirement(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, InplaceUpdateRequirement): @@ -21758,6 +21831,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) +@mypyc_attr(native_class=True) class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): @@ -21927,6 +22001,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) +@mypyc_attr(native_class=True) class TimeLimit(Saveable): """ Set an upper limit on the execution time of a CommandLineTool or @@ -22110,6 +22185,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) +@mypyc_attr(native_class=True) class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on @@ -22298,6 +22374,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) +@mypyc_attr(native_class=True) class NetworkAccess(Saveable): """ Indicate whether a process requires outgoing IPv4/IPv6 network @@ -22493,6 +22570,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) +@mypyc_attr(native_class=True) class ProcessGenerator(Saveable): id: str @@ -23145,6 +23223,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. @@ -23325,6 +23404,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) +@mypyc_attr(native_class=True) class CUDARequirement(Saveable): """ Require support for NVIDA CUDA (GPU hardware acceleration). @@ -23697,6 +23777,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index b458d593..4fa86d51 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -18,7 +18,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from mypy_extensions import i32, i64 +from mypy_extensions import i32, i64, mypyc_attr from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -50,6 +50,7 @@ T = TypeVar("T", covariant=True) +@mypyc_attr(native_class=True) class LoadingOptions: idx: Final[IdxType] fileuri: Final[str | None] @@ -215,6 +216,7 @@ def graph(self) -> Graph: return graph +@mypyc_attr(native_class=True) class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @@ -444,6 +446,7 @@ def expand_url( return url +@mypyc_attr(native_class=True) class _Loader(Generic[T], metaclass=ABCMeta): @abstractmethod def load( @@ -456,6 +459,7 @@ def load( ) -> T: ... +@mypyc_attr(native_class=True) class _AnyLoader(_Loader[Any]): def load( self, @@ -470,6 +474,7 @@ def load( raise ValidationException("Expected non-null") +@mypyc_attr(native_class=True) class _PrimitiveLoader(_Loader[T]): def __init__(self, tp: type[T]) -> None: self.tp: Final = tp @@ -490,6 +495,7 @@ def __repr__(self) -> str: return str(self.tp) +@mypyc_attr(native_class=True) class _ArrayLoader(_Loader[Sequence[T]]): def __init__(self, items: _Loader[T]) -> None: self.items: Final = items @@ -547,6 +553,7 @@ def __repr__(self) -> str: return f"array<{self.items}>" +@mypyc_attr(native_class=True) class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, @@ -590,6 +597,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" +@mypyc_attr(native_class=True) class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols @@ -611,6 +619,7 @@ def __repr__(self) -> str: return self.name +@mypyc_attr(native_class=True) class _SecondaryDSLLoader(_Loader[T]): def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner @@ -684,6 +693,7 @@ def load( return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) +@mypyc_attr(native_class=True) class _RecordLoader(_Loader[S]): def __init__( self, @@ -718,6 +728,7 @@ def __repr__(self) -> str: return str(self.classtype.__name__) +@mypyc_attr(native_class=True) class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -739,6 +750,7 @@ def load( return doc +@mypyc_attr(native_class=True) class _UnionLoader(_Loader[T]): def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates @@ -829,6 +841,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) +@mypyc_attr(native_class=True) class _URILoader(_Loader[T]): def __init__( self, @@ -898,6 +911,7 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) +@mypyc_attr(native_class=True) class _TypeDSLLoader(_Loader[T]): def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner @@ -968,6 +982,7 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) +@mypyc_attr(native_class=True) class _IdMapLoader(_Loader[T]): def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner @@ -1187,6 +1202,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_1" +@mypyc_attr(native_class=True) class RecordField(Saveable): """ A field of a record. @@ -1459,6 +1475,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) +@mypyc_attr(native_class=True) class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): @@ -1658,6 +1675,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class EnumSchema(Saveable): """ Define an enumerated type. @@ -1930,6 +1948,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) +@mypyc_attr(native_class=True) class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): @@ -2129,6 +2148,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) +@mypyc_attr(native_class=True) class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): @@ -2328,6 +2348,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) +@mypyc_attr(native_class=True) class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): @@ -2527,6 +2548,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) +@mypyc_attr(native_class=True) class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): @@ -2726,6 +2748,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) +@mypyc_attr(native_class=True) class CWLRecordField(RecordField): name: str @@ -2994,6 +3017,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) +@mypyc_attr(native_class=True) class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): @@ -3193,6 +3217,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class File(Saveable): """ Represents a file (or group of files when `secondaryFiles` is provided) that @@ -4015,6 +4040,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Directory(Saveable): """ Represents a directory to present to a command line tool. @@ -4401,6 +4427,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputBinding(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, InputBinding): @@ -4548,6 +4575,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) +@mypyc_attr(native_class=True) class InputRecordField(CWLRecordField): name: str @@ -5181,6 +5209,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputRecordSchema(CWLRecordSchema): name: str @@ -5560,6 +5589,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputEnumSchema(EnumSchema): name: str @@ -5939,6 +5969,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputArraySchema(CWLArraySchema): name: str @@ -6318,6 +6349,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputRecordField(CWLRecordField): name: str @@ -6823,6 +6855,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputRecordSchema(CWLRecordSchema): name: str @@ -7202,6 +7235,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputEnumSchema(EnumSchema): name: str @@ -7581,6 +7615,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputArraySchema(CWLArraySchema): name: str @@ -7960,6 +7995,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InlineJavascriptRequirement(Saveable): """ Indicates that the workflow platform must support inline Javascript expressions. @@ -8142,6 +8178,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) +@mypyc_attr(native_class=True) class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when @@ -8323,6 +8360,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) +@mypyc_attr(native_class=True) class SecondaryFileSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SecondaryFileSchema): @@ -8524,6 +8562,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) +@mypyc_attr(native_class=True) class LoadListingRequirement(Saveable): """ Specify the desired behavior for loading the `listing` field of @@ -8704,6 +8743,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) +@mypyc_attr(native_class=True) class EnvironmentDef(Saveable): """ Define an environment variable that will be set in the runtime environment @@ -8913,6 +8953,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) +@mypyc_attr(native_class=True) class CommandLineBinding(InputBinding): """ @@ -9460,6 +9501,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced @@ -9796,6 +9838,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputRecordField(InputRecordField): name: str @@ -10489,6 +10532,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputRecordSchema(InputRecordSchema): name: str @@ -10935,6 +10979,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputEnumSchema(InputEnumSchema): name: str @@ -11381,6 +11426,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputArraySchema(InputArraySchema): name: str @@ -11820,6 +11866,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputRecordField(OutputRecordField): name: str @@ -12393,6 +12440,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputRecordSchema(OutputRecordSchema): name: str @@ -12772,6 +12820,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputEnumSchema(OutputEnumSchema): name: str @@ -13151,6 +13200,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputArraySchema(OutputArraySchema): name: str @@ -13530,6 +13580,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputParameter(Saveable): """ An input parameter for a CommandLineTool. @@ -14284,6 +14335,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputParameter(Saveable): """ An output parameter for a CommandLineTool. @@ -14861,6 +14913,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -15929,6 +15982,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a @@ -16469,6 +16523,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of @@ -16645,6 +16700,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) +@mypyc_attr(native_class=True) class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): @@ -16901,6 +16957,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) +@mypyc_attr(native_class=True) class Dirent(Saveable): """ Define a file or subdirectory that must be placed in the designated output @@ -17169,6 +17226,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) +@mypyc_attr(native_class=True) class InitialWorkDirRequirement(Saveable): """ Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. @@ -17343,6 +17401,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) +@mypyc_attr(native_class=True) class EnvVarRequirement(Saveable): """ Define a list of environment variables which will be set in the @@ -17519,6 +17578,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) +@mypyc_attr(native_class=True) class ShellCommandRequirement(Saveable): """ Modify the behavior of CommandLineTool to generate a single string @@ -17643,6 +17703,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -18260,6 +18321,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on @@ -18448,6 +18510,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) +@mypyc_attr(native_class=True) class NetworkAccess(Saveable): """ Indicate whether a process requires outgoing IPv4/IPv6 network @@ -18643,6 +18706,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) +@mypyc_attr(native_class=True) class InplaceUpdateRequirement(Saveable): """ @@ -18853,6 +18917,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) +@mypyc_attr(native_class=True) class ToolTimeLimit(Saveable): """ Set an upper limit on the execution time of a CommandLineTool. @@ -19039,6 +19104,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) +@mypyc_attr(native_class=True) class ExpressionToolOutputParameter(Saveable): id: str @@ -19544,6 +19610,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowInputParameter(Saveable): id: str @@ -20294,6 +20361,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class ExpressionTool(Saveable): """ An ExpressionTool is a type of Process object that can be run by itself @@ -20961,6 +21029,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowOutputParameter(Saveable): """ Describe an output parameter of a workflow. The parameter must be @@ -21595,6 +21664,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the @@ -22211,6 +22281,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowStepOutput(Saveable): """ Associate an output parameter of the underlying process with a workflow @@ -22376,6 +22447,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["id"]) +@mypyc_attr(native_class=True) class WorkflowStep(Saveable): """ A workflow step is an executable element of a workflow. It specifies the @@ -23119,6 +23191,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Workflow(Saveable): """ A workflow describes a set of **steps** and the **dependencies** between @@ -23821,6 +23894,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in @@ -23940,6 +24014,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class ScatterFeatureRequirement(Saveable): """ Indicates that the workflow platform must support the `scatter` and @@ -24059,6 +24134,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class MultipleInputFeatureRequirement(Saveable): """ Indicates that the workflow platform must support multiple inbound data links @@ -24178,6 +24254,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class StepInputExpressionRequirement(Saveable): """ Indicate that the workflow platform must support the `valueFrom` field @@ -24297,6 +24374,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): @@ -24466,6 +24544,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) +@mypyc_attr(native_class=True) class ProcessGenerator(Saveable): id: str @@ -25120,6 +25199,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. @@ -25300,6 +25380,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) +@mypyc_attr(native_class=True) class CUDARequirement(Saveable): """ Require support for NVIDA CUDA (GPU hardware acceleration). @@ -25672,6 +25753,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index b7387083..a138ccfa 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -18,7 +18,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from itertools import chain -from mypy_extensions import i32, i64 +from mypy_extensions import i32, i64, mypyc_attr from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 from typing import Any, Final, Generic, TypeAlias, TypeVar, cast from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit @@ -50,6 +50,7 @@ T = TypeVar("T", covariant=True) +@mypyc_attr(native_class=True) class LoadingOptions: idx: Final[IdxType] fileuri: Final[str | None] @@ -215,6 +216,7 @@ def graph(self) -> Graph: return graph +@mypyc_attr(native_class=True) class Saveable(metaclass=ABCMeta): """Mark classes than have a save() and fromDoc() function.""" @@ -444,6 +446,7 @@ def expand_url( return url +@mypyc_attr(native_class=True) class _Loader(Generic[T], metaclass=ABCMeta): @abstractmethod def load( @@ -456,6 +459,7 @@ def load( ) -> T: ... +@mypyc_attr(native_class=True) class _AnyLoader(_Loader[Any]): def load( self, @@ -470,6 +474,7 @@ def load( raise ValidationException("Expected non-null") +@mypyc_attr(native_class=True) class _PrimitiveLoader(_Loader[T]): def __init__(self, tp: type[T]) -> None: self.tp: Final = tp @@ -490,6 +495,7 @@ def __repr__(self) -> str: return str(self.tp) +@mypyc_attr(native_class=True) class _ArrayLoader(_Loader[Sequence[T]]): def __init__(self, items: _Loader[T]) -> None: self.items: Final = items @@ -547,6 +553,7 @@ def __repr__(self) -> str: return f"array<{self.items}>" +@mypyc_attr(native_class=True) class _MapLoader(_Loader[Mapping[str, T]]): def __init__( self, @@ -590,6 +597,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else f"map" +@mypyc_attr(native_class=True) class _EnumLoader(_Loader[E]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols @@ -611,6 +619,7 @@ def __repr__(self) -> str: return self.name +@mypyc_attr(native_class=True) class _SecondaryDSLLoader(_Loader[T]): def __init__(self, inner: _Loader[T]) -> None: self.inner: Final = inner @@ -684,6 +693,7 @@ def load( return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc) +@mypyc_attr(native_class=True) class _RecordLoader(_Loader[S]): def __init__( self, @@ -718,6 +728,7 @@ def __repr__(self) -> str: return str(self.classtype.__name__) +@mypyc_attr(native_class=True) class _ExpressionLoader(_Loader[str]): def __init__(self, items: type[str]) -> None: self.items: Final = items @@ -739,6 +750,7 @@ def load( return doc +@mypyc_attr(native_class=True) class _UnionLoader(_Loader[T]): def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: self.alternates = alternates @@ -829,6 +841,7 @@ def __repr__(self) -> str: return self.name if self.name is not None else " | ".join(str(a) for a in self.alternates) +@mypyc_attr(native_class=True) class _URILoader(_Loader[T]): def __init__( self, @@ -898,6 +911,7 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) +@mypyc_attr(native_class=True) class _TypeDSLLoader(_Loader[T]): def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: self.inner: Final = inner @@ -968,6 +982,7 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) +@mypyc_attr(native_class=True) class _IdMapLoader(_Loader[T]): def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: self.inner: Final = inner @@ -1187,6 +1202,7 @@ def parser_info() -> str: return "org.w3id.cwl.v1_2" +@mypyc_attr(native_class=True) class RecordField(Saveable): """ A field of a record. @@ -1459,6 +1475,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) +@mypyc_attr(native_class=True) class RecordSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, RecordSchema): @@ -1658,6 +1675,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class EnumSchema(Saveable): """ Define an enumerated type. @@ -1930,6 +1948,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) +@mypyc_attr(native_class=True) class ArraySchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ArraySchema): @@ -2129,6 +2148,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) +@mypyc_attr(native_class=True) class MapSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, MapSchema): @@ -2328,6 +2348,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) +@mypyc_attr(native_class=True) class UnionSchema(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, UnionSchema): @@ -2527,6 +2548,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) +@mypyc_attr(native_class=True) class CWLArraySchema(ArraySchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLArraySchema): @@ -2726,6 +2748,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) +@mypyc_attr(native_class=True) class CWLRecordField(RecordField): name: str @@ -2994,6 +3017,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) +@mypyc_attr(native_class=True) class CWLRecordSchema(RecordSchema): def __eq__(self, other: Any) -> bool: if isinstance(other, CWLRecordSchema): @@ -3193,6 +3217,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) +@mypyc_attr(native_class=True) class File(Saveable): """ Represents a file (or group of files when `secondaryFiles` is provided) that @@ -4015,6 +4040,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Directory(Saveable): """ Represents a directory to present to a command line tool. @@ -4401,6 +4427,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputBinding(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, InputBinding): @@ -4548,6 +4575,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) +@mypyc_attr(native_class=True) class InputRecordField(CWLRecordField): name: str @@ -5181,6 +5209,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputRecordSchema(CWLRecordSchema): name: str @@ -5560,6 +5589,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputEnumSchema(EnumSchema): name: str @@ -5939,6 +5969,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InputArraySchema(CWLArraySchema): name: str @@ -6318,6 +6349,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputRecordField(CWLRecordField): name: str @@ -6823,6 +6855,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputRecordSchema(CWLRecordSchema): name: str @@ -7202,6 +7235,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputEnumSchema(EnumSchema): name: str @@ -7581,6 +7615,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OutputArraySchema(CWLArraySchema): name: str @@ -7960,6 +7995,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class InlineJavascriptRequirement(Saveable): """ Indicates that the workflow platform must support inline Javascript expressions. @@ -8142,6 +8178,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) +@mypyc_attr(native_class=True) class SchemaDefRequirement(Saveable): """ This field consists of an array of type definitions which must be used when @@ -8328,6 +8365,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) +@mypyc_attr(native_class=True) class SecondaryFileSchema(Saveable): """ Secondary files are specified using the following micro-DSL for secondary files: @@ -8546,6 +8584,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) +@mypyc_attr(native_class=True) class LoadListingRequirement(Saveable): """ Specify the desired behavior for loading the `listing` field of @@ -8726,6 +8765,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) +@mypyc_attr(native_class=True) class EnvironmentDef(Saveable): """ Define an environment variable that will be set in the runtime environment @@ -8935,6 +8975,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) +@mypyc_attr(native_class=True) class CommandLineBinding(InputBinding): """ @@ -9482,6 +9523,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputBinding(Saveable): """ Describes how to generate an output parameter based on the files produced @@ -9818,6 +9860,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputRecordField(InputRecordField): name: str @@ -10511,6 +10554,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputRecordSchema(InputRecordSchema): name: str @@ -10957,6 +11001,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputEnumSchema(InputEnumSchema): name: str @@ -11403,6 +11448,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputArraySchema(InputArraySchema): name: str @@ -11842,6 +11888,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputRecordField(OutputRecordField): name: str @@ -12415,6 +12462,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputRecordSchema(OutputRecordSchema): name: str @@ -12794,6 +12842,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputEnumSchema(OutputEnumSchema): name: str @@ -13173,6 +13222,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputArraySchema(OutputArraySchema): name: str @@ -13552,6 +13602,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandInputParameter(Saveable): """ An input parameter for a CommandLineTool. @@ -14306,6 +14357,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandOutputParameter(Saveable): """ An output parameter for a CommandLineTool. @@ -14883,6 +14935,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class CommandLineTool(Saveable): """ This defines the schema of the CWL Command Line Tool Description document. @@ -16007,6 +16060,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class DockerRequirement(Saveable): """ Indicates that a workflow component should be run in a @@ -16547,6 +16601,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class SoftwareRequirement(Saveable): """ A list of software packages that should be configured in the environment of @@ -16723,6 +16778,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) +@mypyc_attr(native_class=True) class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, SoftwarePackage): @@ -16979,6 +17035,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) +@mypyc_attr(native_class=True) class Dirent(Saveable): """ Define a file or subdirectory that must be staged to a particular @@ -17251,6 +17308,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) +@mypyc_attr(native_class=True) class InitialWorkDirRequirement(Saveable): """ Define a list of files and subdirectories that must be staged by the workflow platform prior to executing the command line tool. @@ -17426,6 +17484,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) +@mypyc_attr(native_class=True) class EnvVarRequirement(Saveable): """ Define a list of environment variables which will be set in the @@ -17602,6 +17661,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) +@mypyc_attr(native_class=True) class ShellCommandRequirement(Saveable): """ Modify the behavior of CommandLineTool to generate a single string @@ -17726,6 +17786,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class ResourceRequirement(Saveable): """ Specify basic hardware resource requirements. @@ -18348,6 +18409,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkReuse(Saveable): """ For implementations that support reusing output from past work (on @@ -18536,6 +18598,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) +@mypyc_attr(native_class=True) class NetworkAccess(Saveable): """ Indicate whether a process requires outgoing IPv4/IPv6 network @@ -18731,6 +18794,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) +@mypyc_attr(native_class=True) class InplaceUpdateRequirement(Saveable): """ @@ -18941,6 +19005,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) +@mypyc_attr(native_class=True) class ToolTimeLimit(Saveable): """ Set an upper limit on the execution time of a CommandLineTool. @@ -19127,6 +19192,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) +@mypyc_attr(native_class=True) class ExpressionToolOutputParameter(Saveable): id: str @@ -19632,6 +19698,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowInputParameter(Saveable): id: str @@ -20382,6 +20449,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class ExpressionTool(Saveable): """ An ExpressionTool is a type of Process object that can be run by itself @@ -21105,6 +21173,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowOutputParameter(Saveable): """ Describe an output parameter of a workflow. The parameter must be @@ -21799,6 +21868,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowStepInput(Saveable): """ The input of a workflow step connects an upstream parameter (from the @@ -22537,6 +22607,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class WorkflowStepOutput(Saveable): """ Associate an output parameter of the underlying process with a workflow @@ -22702,6 +22773,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["id"]) +@mypyc_attr(native_class=True) class WorkflowStep(Saveable): """ A workflow step is an executable element of a workflow. It specifies the @@ -23526,6 +23598,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Workflow(Saveable): """ A workflow describes a set of **steps** and the **dependencies** between @@ -24290,6 +24363,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class SubworkflowFeatureRequirement(Saveable): """ Indicates that the workflow platform must support nested workflows in @@ -24409,6 +24483,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class ScatterFeatureRequirement(Saveable): """ Indicates that the workflow platform must support the `scatter` and @@ -24528,6 +24603,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class MultipleInputFeatureRequirement(Saveable): """ Indicates that the workflow platform must support multiple inbound data links @@ -24647,6 +24723,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class StepInputExpressionRequirement(Saveable): """ Indicate that the workflow platform must support the `valueFrom` field @@ -24766,6 +24843,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class"]) +@mypyc_attr(native_class=True) class OperationInputParameter(Saveable): """ Describe an input parameter of an operation. @@ -25461,6 +25539,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class OperationOutputParameter(Saveable): """ Describe an output parameter of an operation. @@ -25971,6 +26050,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Operation(Saveable): """ This record describes an abstract operation. It is a potential @@ -26633,6 +26713,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Secrets(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, Secrets): @@ -26802,6 +26883,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) +@mypyc_attr(native_class=True) class ProcessGenerator(Saveable): id: str @@ -27512,6 +27594,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class MPIRequirement(Saveable): """ Indicates that a process requires an MPI runtime. @@ -27692,6 +27775,7 @@ def __init__( attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) +@mypyc_attr(native_class=True) class CUDARequirement(Saveable): """ Require support for NVIDA CUDA (GPU hardware acceleration). @@ -28064,6 +28148,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class LoopInput(Saveable): id: str @@ -28505,6 +28590,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class Loop(Saveable): """ Prototype to enable workflow-level looping of a step. @@ -28811,6 +28897,7 @@ def __init__( ) +@mypyc_attr(native_class=True) class ShmSize(Saveable): def __eq__(self, other: Any) -> bool: if isinstance(other, ShmSize): From 04423bd27c6962b49c73df0c6ad2e99561205bfb Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sun, 5 Apr 2026 22:40:25 +0200 Subject: [PATCH 20/23] Regenerate parsers with explicit Enum types --- src/cwl_utils/parser/__init__.py | 4 +- src/cwl_utils/parser/cwl_v1_0.py | 1092 ++++++------------------ src/cwl_utils/parser/cwl_v1_0_utils.py | 62 +- src/cwl_utils/parser/cwl_v1_1.py | 1034 +++++++--------------- src/cwl_utils/parser/cwl_v1_1_utils.py | 75 +- src/cwl_utils/parser/cwl_v1_2.py | 1079 +++++++---------------- src/cwl_utils/parser/cwl_v1_2_utils.py | 75 +- src/cwl_utils/parser/utils.py | 11 +- src/cwl_utils/utils.py | 11 +- 9 files changed, 906 insertions(+), 2537 deletions(-) diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index c77a6be9..a26797a7 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -256,7 +256,9 @@ class NoType(ABC): ) """Type Union for a CWL v1.x SchemaDefRequirement object.""" __T = TypeVar("__T", covariant=True) -_Loader: TypeAlias = cwl_v1_0._Loader[__T] | cwl_v1_1._Loader[__T] | cwl_v1_2._Loader[__T] +_Loader: TypeAlias = ( + cwl_v1_0._Loader[__T] | cwl_v1_1._Loader[__T] | cwl_v1_2._Loader[__T] +) """Type union for a CWL v1.x _Loader.""" diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 5d522ff2..02fe801e 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -1455,7 +1455,7 @@ def save( def __init__( self, name: str, - type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1656,7 +1656,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[RecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1928,7 +1928,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -2129,8 +2129,8 @@ def save( def __init__( self, - items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Literal["array"], + items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Array_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2329,8 +2329,8 @@ def save( def __init__( self, - type_: Literal["map"], - values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Map_name, + values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2529,8 +2529,8 @@ def save( def __init__( self, - names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Literal["union"], + names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Union_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2729,8 +2729,8 @@ def save( def __init__( self, - items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, - type_: Literal["array"], + items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + type_: Array_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2997,7 +2997,7 @@ def save( def __init__( self, name: str, - type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -3198,7 +3198,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CWLRecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -4785,7 +4785,7 @@ def save( def __init__( self, name: str, - type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, inputBinding: CommandLineBinding | None = None, label: None | str = None, @@ -5111,7 +5111,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[InputRecordField] = None, label: None | str = None, name: None | str = None, @@ -5493,7 +5493,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, inputBinding: CommandLineBinding | None = None, @@ -5812,8 +5812,8 @@ def save( def __init__( self, - items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -6142,7 +6142,7 @@ def save( def __init__( self, name: str, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -6403,7 +6403,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[OutputRecordField] = None, label: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -6783,7 +6783,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, outputBinding: CommandOutputBinding | None = None, @@ -7102,8 +7102,8 @@ def save( def __init__( self, - items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - type_: Literal["array"], + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -7720,7 +7720,7 @@ def __init__( format: None | Sequence[str] | str = None, inputBinding: CommandLineBinding | None = None, default: CWLObjectType | None = None, - type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = None, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | None | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -10031,7 +10031,7 @@ def save( def __init__( self, name: str, - type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, inputBinding: CommandLineBinding | None = None, label: None | str = None, @@ -10357,7 +10357,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CommandInputRecordField] = None, label: None | str = None, name: None | str = None, @@ -10739,7 +10739,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, inputBinding: CommandLineBinding | None = None, @@ -11058,8 +11058,8 @@ def save( def __init__( self, - items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -11388,7 +11388,7 @@ def save( def __init__( self, name: str, - type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -11712,7 +11712,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CommandOutputRecordField] = None, label: None | str = None, name: None | str = None, @@ -12094,7 +12094,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, outputBinding: CommandOutputBinding | None = None, @@ -12413,8 +12413,8 @@ def save( def __init__( self, - items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -13035,7 +13035,7 @@ def __init__( format: None | Sequence[str] | str = None, inputBinding: CommandLineBinding | None = None, default: CWLObjectType | None = None, - type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = None, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | None | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -13614,7 +13614,7 @@ def __init__( doc: None | Sequence[str] | str = None, outputBinding: CommandOutputBinding | None = None, format: None | str = None, - type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | None | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str = None, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | None | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -14657,7 +14657,7 @@ def __init__( hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, label: None | str = None, doc: None | str = None, - cwlVersion: Literal["v1.0"] | None = None, + cwlVersion: CWLVersion | None = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, stdin: None | str = None, @@ -17577,7 +17577,7 @@ def __init__( doc: None | Sequence[str] | str = None, outputBinding: CommandOutputBinding | None = None, format: None | str = None, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, + type_: CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -18235,7 +18235,7 @@ def __init__( hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, label: None | str = None, doc: None | str = None, - cwlVersion: Literal["v1.0"] | None = None, + cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -18927,8 +18927,8 @@ def __init__( outputBinding: CommandOutputBinding | None = None, format: None | str = None, outputSource: None | Sequence[str] | str = None, - linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, + linkMerge: LinkMergeMethod | None = None, + type_: CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -19366,7 +19366,7 @@ def __init__( self, id: str, source: None | Sequence[str] | str = None, - linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + linkMerge: LinkMergeMethod | None = None, default: CWLObjectType | None = None, valueFrom: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -20256,7 +20256,7 @@ def __init__( label: None | str = None, doc: None | str = None, scatter: None | Sequence[str] | str = None, - scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = None, + scatterMethod: None | ScatterMethod = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -20959,7 +20959,7 @@ def __init__( hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, label: None | str = None, doc: None | str = None, - cwlVersion: Literal["v1.0"] | None = None, + cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -21636,7 +21636,7 @@ def save( def __init__( self, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"], + loadListing: LoadListingEnum, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23184,7 +23184,7 @@ def __init__( hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, label: None | str = None, doc: None | str = None, - cwlVersion: Literal["v1.0"] | None = None, + cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -24178,9 +24178,10 @@ def __init__( None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) Any_type: Final[_Loader[Any]] = _AnyLoader() longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) -PrimitiveTypeLoader: Final[ - _Loader[Literal["null", "boolean", "int", "long", "float", "double", "string"]] -] = _EnumLoader( +PrimitiveType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string" +] +PrimitiveTypeLoader: Final[_Loader[PrimitiveType]] = _EnumLoader( ( "null", "boolean", @@ -24206,7 +24207,8 @@ def __init__( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader: Final[_Loader[Literal["Any"]]] = _EnumLoader(("Any",), "Any") +Any_: TypeAlias = Literal["Any"] +Any_Loader: Final[_Loader[Any_]] = _EnumLoader(("Any",), "Any_") """ The **Any** type validates for any non-null value. """ @@ -24218,21 +24220,10 @@ def __init__( ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader: Final[ - _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - ] -] = _EnumLoader( +CWLType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" +] +CWLTypeLoader: Final[_Loader[CWLType]] = _EnumLoader( ( "null", "boolean", @@ -24280,11 +24271,13 @@ def __init__( CWLInputFileLoader: Final[_Loader[Mapping[str, CWLObjectType | None]]] = ( map_of_union_of_None_type_or_CWLObjectTypeLoader ) -CWLVersionLoader: Final[_Loader[Literal["v1.0"]]] = _EnumLoader(("v1.0",), "CWLVersion") +CWLVersion: TypeAlias = Literal["v1.0"] +CWLVersionLoader: Final[_Loader[CWLVersion]] = _EnumLoader(("v1.0",), "CWLVersion") """ Current version symbol for CWL documents. """ -ExpressionLoader = _ExpressionLoader(str) +Expression: TypeAlias = Literal["ExpressionPlaceholder"] +ExpressionLoader: Final[_Loader[str]] = _ExpressionLoader(str) InputRecordFieldLoader: Final[_Loader[InputRecordField]] = _RecordLoader( InputRecordField, None, None ) @@ -24360,7 +24353,8 @@ def __init__( CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( CommandOutputParameter, None, None ) -stdoutLoader: Final[_Loader[Literal["stdout"]]] = _EnumLoader(("stdout",), "stdout") +stdout: TypeAlias = Literal["stdout"] +stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24404,7 +24398,8 @@ def __init__( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader: Final[_Loader[Literal["stderr"]]] = _EnumLoader(("stderr",), "stderr") +stderr: TypeAlias = Literal["stderr"] +stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -24479,14 +24474,13 @@ def __init__( ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( ExpressionTool, None, None ) -LinkMergeMethodLoader: Final[_Loader[Literal["merge_nested", "merge_flattened"]]] = ( - _EnumLoader( - ( - "merge_nested", - "merge_flattened", - ), - "LinkMergeMethod", - ) +LinkMergeMethod: TypeAlias = Literal["merge_nested", "merge_flattened"] +LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod]] = _EnumLoader( + ( + "merge_nested", + "merge_flattened", + ), + "LinkMergeMethod", ) """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). @@ -24500,9 +24494,10 @@ def __init__( WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( WorkflowStepOutput, None, None ) -ScatterMethodLoader: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"]] -] = _EnumLoader( +ScatterMethod: TypeAlias = Literal[ + "dotproduct", "nested_crossproduct", "flat_crossproduct" +] +ScatterMethodLoader: Final[_Loader[ScatterMethod]] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -24568,8 +24563,8 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -24590,8 +24585,8 @@ def __init__( Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -24604,14 +24599,14 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -24635,14 +24630,14 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -24669,10 +24664,9 @@ def __init__( idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ _Loader[None | Sequence[RecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") -Record_nameLoader: Final[_Loader[Literal["record"]]] = _EnumLoader( - ("record",), "Record_name" -) -typedsl_Record_nameLoader_2: Final[_Loader[Literal["record"]]] = _TypeDSLLoader( +Record_name: TypeAlias = Literal["record"] +Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final[_Loader[Record_name]] = _TypeDSLLoader( Record_nameLoader, 2, "v1.1" ) union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( @@ -24687,22 +24681,23 @@ def __init__( uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader: Final[_Loader[Literal["enum"]]] = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2: Final[_Loader[Literal["enum"]]] = _TypeDSLLoader( +Enum_name: TypeAlias = Literal["enum"] +Enum_nameLoader: Final[_Loader[Enum_name]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Enum_name]] = _TypeDSLLoader( Enum_nameLoader, 2, "v1.1" ) uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -24717,30 +24712,23 @@ def __init__( 2, None, ) -Array_nameLoader: Final[_Loader[Literal["array"]]] = _EnumLoader( - ("array",), "Array_name" -) -typedsl_Array_nameLoader_2: Final[_Loader[Literal["array"]]] = _TypeDSLLoader( +Array_name: TypeAlias = Literal["array"] +Array_nameLoader: Final[_Loader[Array_name]] = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final[_Loader[Array_name]] = _TypeDSLLoader( Array_nameLoader, 2, "v1.1" ) -Map_nameLoader: Final[_Loader[Literal["map"]]] = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2: Final[_Loader[Literal["map"]]] = _TypeDSLLoader( +Map_name: TypeAlias = Literal["map"] +Map_nameLoader: Final[_Loader[Map_name]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Map_name]] = _TypeDSLLoader( Map_nameLoader, 2, "v1.1" ) -Union_nameLoader: Final[_Loader[Literal["union"]]] = _EnumLoader( - ("union",), "Union_name" -) -typedsl_Union_nameLoader_2: Final[_Loader[Literal["union"]]] = _TypeDSLLoader( +Union_name: TypeAlias = Literal["union"] +Union_nameLoader: Final[_Loader[Union_name]] = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final[_Loader[Union_name]] = _TypeDSLLoader( Union_nameLoader, 2, "v1.1" ) union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ - _Loader[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] ] = _UnionLoader( ( PrimitiveTypeLoader, @@ -24752,13 +24740,7 @@ def __init__( ) array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] ] ] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype @@ -24768,14 +24750,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _UnionLoader( @@ -24793,14 +24769,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _URILoader( @@ -24815,14 +24785,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _TypeDSLLoader( @@ -24844,8 +24808,9 @@ def __init__( idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ _Loader[None | Sequence[CWLRecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") -File_classLoader: Final[_Loader[Literal["File"]]] = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None: Final[_Loader[Literal["File"]]] = _URILoader( +File_class: TypeAlias = Literal["File"] +File_classLoader: Final[_Loader[File_class]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[File_class]] = _URILoader( File_classLoader, False, True, None, None ) uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( @@ -24878,10 +24843,11 @@ def __init__( uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( _URILoader(union_of_None_type_or_strtype, True, False, None, True) ) -Directory_classLoader: Final[_Loader[Literal["Directory"]]] = _EnumLoader( +Directory_class: TypeAlias = Literal["Directory"] +Directory_classLoader: Final[_Loader[Directory_class]] = _EnumLoader( ("Directory",), "Directory_class" ) -uri_Directory_classLoader_False_True_None_None: Final[_Loader[Literal["Directory"]]] = ( +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Directory_class]] = ( _URILoader(Directory_classLoader, False, True, None, None) ) union_of_strtype_or_ExpressionLoader: Final[_Loader[str]] = _UnionLoader( @@ -24910,23 +24876,7 @@ def __init__( ) ) union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ - _Loader[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] + _Loader[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] ] = _UnionLoader( ( CWLTypeLoader, @@ -24938,59 +24888,19 @@ def __init__( ) array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] + Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] ] ] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -25006,36 +24916,12 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -25068,36 +24954,12 @@ def __init__( ] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -25109,23 +24971,7 @@ def __init__( None, ) union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ - _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str - ] + _Loader[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] ] = _UnionLoader( ( CWLTypeLoader, @@ -25138,21 +24984,7 @@ def __init__( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] ] ] = _ArrayLoader( @@ -25160,36 +24992,12 @@ def __init__( ) union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -25205,36 +25013,12 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -25267,36 +25051,12 @@ def __init__( ] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -25328,37 +25088,13 @@ def __init__( ) union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | None | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -25375,37 +25111,13 @@ def __init__( ) typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | None | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -25731,7 +25443,7 @@ def __init__( "class", "None", ) -union_of_None_type_or_CWLVersionLoader: Final[_Loader[Literal["v1.0"] | None]] = ( +union_of_None_type_or_CWLVersionLoader: Final[_Loader[CWLVersion | None]] = ( _UnionLoader( ( None_type, @@ -25740,13 +25452,14 @@ def __init__( ) ) uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ - _Loader[Literal["v1.0"] | None] + _Loader[CWLVersion | None] ] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) +InlineJavascriptRequirement_class: TypeAlias = Literal["InlineJavascriptRequirement"] InlineJavascriptRequirement_classLoader: Final[ - _Loader[Literal["InlineJavascriptRequirement"]] + _Loader[InlineJavascriptRequirement_class] ] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["InlineJavascriptRequirement"]] + _Loader[InlineJavascriptRequirement_class] ] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( _UnionLoader( @@ -25756,11 +25469,12 @@ def __init__( ) ) ) -SchemaDefRequirement_classLoader: Final[_Loader[Literal["SchemaDefRequirement"]]] = ( +SchemaDefRequirement_class: TypeAlias = Literal["SchemaDefRequirement"] +SchemaDefRequirement_classLoader: Final[_Loader[SchemaDefRequirement_class]] = ( _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SchemaDefRequirement"]] + _Loader[SchemaDefRequirement_class] ] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader: ( Final[_Loader[InputArraySchema | InputEnumSchema | InputRecordSchema]] @@ -25794,20 +25508,10 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] = _UnionLoader( @@ -25822,20 +25526,10 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] @@ -25844,35 +25538,15 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -25889,35 +25563,15 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -25945,35 +25599,15 @@ def __init__( ) uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -25987,20 +25621,10 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] = _UnionLoader( @@ -26015,20 +25639,10 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] @@ -26037,35 +25651,15 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -26082,35 +25676,15 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -26138,35 +25712,15 @@ def __init__( ) uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -26180,36 +25734,16 @@ def __init__( ) union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | None | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -26227,36 +25761,16 @@ def __init__( ) typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | None | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -26268,40 +25782,20 @@ def __init__( ) union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stderr"] - | Literal["stdout"] | None | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stderr + | stdout | str ] ] = _UnionLoader( @@ -26319,40 +25813,20 @@ def __init__( ) typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stderr"] - | Literal["stdout"] | None | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stderr + | stdout | str ] ] = _TypeDSLLoader( @@ -26360,11 +25834,12 @@ def __init__( 2, "v1.1", ) -CommandLineTool_classLoader: Final[_Loader[Literal["CommandLineTool"]]] = _EnumLoader( +CommandLineTool_class: TypeAlias = Literal["CommandLineTool"] +CommandLineTool_classLoader: Final[_Loader[CommandLineTool_class]] = _EnumLoader( ("CommandLineTool",), "CommandLineTool_class" ) uri_CommandLineTool_classLoader_False_True_None_None: Final[ - _Loader[Literal["CommandLineTool"]] + _Loader[CommandLineTool_class] ] = _URILoader(CommandLineTool_classLoader, False, True, None, None) array_of_CommandInputParameterLoader: Final[ _Loader[Sequence[CommandInputParameter]] @@ -26407,17 +25882,19 @@ def __init__( ) ) ) -DockerRequirement_classLoader: Final[_Loader[Literal["DockerRequirement"]]] = ( - _EnumLoader(("DockerRequirement",), "DockerRequirement_class") +DockerRequirement_class: TypeAlias = Literal["DockerRequirement"] +DockerRequirement_classLoader: Final[_Loader[DockerRequirement_class]] = _EnumLoader( + ("DockerRequirement",), "DockerRequirement_class" ) uri_DockerRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["DockerRequirement"]] + _Loader[DockerRequirement_class] ] = _URILoader(DockerRequirement_classLoader, False, True, None, None) -SoftwareRequirement_classLoader: Final[_Loader[Literal["SoftwareRequirement"]]] = ( +SoftwareRequirement_class: TypeAlias = Literal["SoftwareRequirement"] +SoftwareRequirement_classLoader: Final[_Loader[SoftwareRequirement_class]] = ( _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SoftwareRequirement"]] + _Loader[SoftwareRequirement_class] ] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( _ArrayLoader(SoftwarePackageLoader) @@ -26428,11 +25905,12 @@ def __init__( uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ _Loader[None | Sequence[str]] ] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_class: TypeAlias = Literal["InitialWorkDirRequirement"] InitialWorkDirRequirement_classLoader: Final[ - _Loader[Literal["InitialWorkDirRequirement"]] + _Loader[InitialWorkDirRequirement_class] ] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["InitialWorkDirRequirement"]] + _Loader[InitialWorkDirRequirement_class] ] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader: ( Final[_Loader[Directory | Dirent | File | str]] @@ -26459,11 +25937,12 @@ def __init__( ExpressionLoader, ) ) -EnvVarRequirement_classLoader: Final[_Loader[Literal["EnvVarRequirement"]]] = ( - _EnumLoader(("EnvVarRequirement",), "EnvVarRequirement_class") +EnvVarRequirement_class: TypeAlias = Literal["EnvVarRequirement"] +EnvVarRequirement_classLoader: Final[_Loader[EnvVarRequirement_class]] = _EnumLoader( + ("EnvVarRequirement",), "EnvVarRequirement_class" ) uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["EnvVarRequirement"]] + _Loader[EnvVarRequirement_class] ] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( EnvironmentDefLoader @@ -26471,17 +25950,19 @@ def __init__( idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -ShellCommandRequirement_classLoader: Final[ - _Loader[Literal["ShellCommandRequirement"]] -] = _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +ShellCommandRequirement_class: TypeAlias = Literal["ShellCommandRequirement"] +ShellCommandRequirement_classLoader: Final[_Loader[ShellCommandRequirement_class]] = ( + _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +) uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ShellCommandRequirement"]] + _Loader[ShellCommandRequirement_class] ] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) -ResourceRequirement_classLoader: Final[_Loader[Literal["ResourceRequirement"]]] = ( +ResourceRequirement_class: TypeAlias = Literal["ResourceRequirement"] +ResourceRequirement_classLoader: Final[_Loader[ResourceRequirement_class]] = ( _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) uri_ResourceRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ResourceRequirement"]] + _Loader[ResourceRequirement_class] ] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader: Final[ _Loader[None | i32 | str] @@ -26506,37 +25987,13 @@ def __init__( ) union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -26553,37 +26010,13 @@ def __init__( ) typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -26592,11 +26025,12 @@ def __init__( 2, "v1.1", ) -ExpressionTool_classLoader: Final[_Loader[Literal["ExpressionTool"]]] = _EnumLoader( +ExpressionTool_class: TypeAlias = Literal["ExpressionTool"] +ExpressionTool_classLoader: Final[_Loader[ExpressionTool_class]] = _EnumLoader( ("ExpressionTool",), "ExpressionTool_class" ) uri_ExpressionTool_classLoader_False_True_None_None: Final[ - _Loader[Literal["ExpressionTool"]] + _Loader[ExpressionTool_class] ] = _URILoader(ExpressionTool_classLoader, False, True, None, None) array_of_ExpressionToolOutputParameterLoader: Final[ _Loader[Sequence[ExpressionToolOutputParameter]] @@ -26607,12 +26041,12 @@ def __init__( uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ _Loader[None | Sequence[str] | str] ] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) -union_of_None_type_or_LinkMergeMethodLoader: Final[ - _Loader[Literal["merge_nested", "merge_flattened"] | None] -] = _UnionLoader( - ( - None_type, - LinkMergeMethodLoader, +union_of_None_type_or_LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod | None]] = ( + _UnionLoader( + ( + None_type, + LinkMergeMethodLoader, + ) ) ) uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ @@ -26682,21 +26116,22 @@ def __init__( uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ _Loader[None | Sequence[str] | str] ] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) -union_of_None_type_or_ScatterMethodLoader: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] -] = _UnionLoader( - ( - None_type, - ScatterMethodLoader, +union_of_None_type_or_ScatterMethodLoader: Final[_Loader[None | ScatterMethod]] = ( + _UnionLoader( + ( + None_type, + ScatterMethodLoader, + ) ) ) uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] + _Loader[None | ScatterMethod] ] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) -Workflow_classLoader: Final[_Loader[Literal["Workflow"]]] = _EnumLoader( +Workflow_class: TypeAlias = Literal["Workflow"] +Workflow_classLoader: Final[_Loader[Workflow_class]] = _EnumLoader( ("Workflow",), "Workflow_class" ) -uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Literal["Workflow"]]] = ( +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Workflow_class]] = ( _URILoader(Workflow_classLoader, False, True, None, None) ) array_of_WorkflowOutputParameterLoader: Final[ @@ -26714,42 +26149,51 @@ def __init__( idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ _Loader[Sequence[WorkflowStep]] ] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_class: TypeAlias = Literal[ + "SubworkflowFeatureRequirement" +] SubworkflowFeatureRequirement_classLoader: Final[ - _Loader[Literal["SubworkflowFeatureRequirement"]] + _Loader[SubworkflowFeatureRequirement_class] ] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SubworkflowFeatureRequirement"]] + _Loader[SubworkflowFeatureRequirement_class] ] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_class: TypeAlias = Literal["ScatterFeatureRequirement"] ScatterFeatureRequirement_classLoader: Final[ - _Loader[Literal["ScatterFeatureRequirement"]] + _Loader[ScatterFeatureRequirement_class] ] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ScatterFeatureRequirement"]] + _Loader[ScatterFeatureRequirement_class] ] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_class: TypeAlias = Literal[ + "MultipleInputFeatureRequirement" +] MultipleInputFeatureRequirement_classLoader: Final[ - _Loader[Literal["MultipleInputFeatureRequirement"]] + _Loader[MultipleInputFeatureRequirement_class] ] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["MultipleInputFeatureRequirement"]] + _Loader[MultipleInputFeatureRequirement_class] ] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_class: TypeAlias = Literal[ + "StepInputExpressionRequirement" +] StepInputExpressionRequirement_classLoader: Final[ - _Loader[Literal["StepInputExpressionRequirement"]] + _Loader[StepInputExpressionRequirement_class] ] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["StepInputExpressionRequirement"]] + _Loader[StepInputExpressionRequirement_class] ] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( strtype, False, True, None, None ) -LoadListingEnumLoader: Final[ - _Loader[Literal["no_listing", "shallow_listing", "deep_listing"]] -] = _EnumLoader( +LoadListingEnum: TypeAlias = Literal["no_listing", "shallow_listing", "deep_listing"] +LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -26757,9 +26201,9 @@ def __init__( ), "LoadListingEnum", ) -union_of_LoadListingEnumLoader: Final[ - _Loader[Literal["no_listing", "shallow_listing", "deep_listing"]] -] = _UnionLoader((LoadListingEnumLoader,)) +union_of_LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _UnionLoader( + (LoadListingEnumLoader,) +) uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, False, False, 0, None ) diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index 74c4a38e..b9770844 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, Literal, TypeAlias, TypeVar, cast +from typing import IO, Any, TypeAlias, TypeVar, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -25,78 +25,26 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) +BasicInputTypeSchemas: TypeAlias = cwl.InputSchema | str | cwl.CWLType InputTypeSchemas: TypeAlias = BasicInputTypeSchemas | Sequence[BasicInputTypeSchemas] BasicCommandInputTypeSchemas: TypeAlias = ( cwl.CommandInputArraySchema | cwl.CommandInputEnumSchema | cwl.CommandInputRecordSchema | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + | cwl.CWLType ) CommandInputTypeSchemas: TypeAlias = ( BasicCommandInputTypeSchemas | Sequence[BasicCommandInputTypeSchemas] ) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) +BasicOutputTypeSchemas: TypeAlias = cwl.OutputSchema | str | cwl.CWLType OutputTypeSchemas: TypeAlias = BasicOutputTypeSchemas | Sequence[BasicOutputTypeSchemas] BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema | cwl.CommandOutputRecordSchema | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + | cwl.CWLType ) CommandOutputTypeSchemas: TypeAlias = ( BasicCommandOutputTypeSchemas | Sequence[BasicCommandOutputTypeSchemas] diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index 4fa86d51..91bd39bc 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -1455,7 +1455,7 @@ def save( def __init__( self, name: str, - type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1656,7 +1656,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[RecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1928,7 +1928,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -2129,8 +2129,8 @@ def save( def __init__( self, - items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Literal["array"], + items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Array_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2329,8 +2329,8 @@ def save( def __init__( self, - type_: Literal["map"], - values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Map_name, + values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2529,8 +2529,8 @@ def save( def __init__( self, - names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Literal["union"], + names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Union_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2729,8 +2729,8 @@ def save( def __init__( self, - items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, - type_: Literal["array"], + items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + type_: Array_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2997,7 +2997,7 @@ def save( def __init__( self, name: str, - type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -3198,7 +3198,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CWLRecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -5165,14 +5165,14 @@ def save( def __init__( self, name: str, - type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5562,7 +5562,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[InputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -5943,7 +5943,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -6322,8 +6322,8 @@ def save( def __init__( self, - items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, @@ -6825,7 +6825,7 @@ def save( def __init__( self, name: str, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, @@ -7208,7 +7208,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[OutputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -7589,7 +7589,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -7968,8 +7968,8 @@ def save( def __init__( self, - items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - type_: Literal["array"], + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, @@ -8725,7 +8725,7 @@ def save( def __init__( self, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -9814,7 +9814,7 @@ def save( def __init__( self, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, glob: None | Sequence[str] | str = None, outputEval: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -10485,14 +10485,14 @@ def save( def __init__( self, name: str, - type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -10950,7 +10950,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CommandInputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -11398,7 +11398,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -11837,8 +11837,8 @@ def save( def __init__( self, - items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, @@ -12399,7 +12399,7 @@ def save( def __init__( self, name: str, - type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, @@ -12793,7 +12793,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CommandOutputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -13174,7 +13174,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -13553,8 +13553,8 @@ def save( def __init__( self, - items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, @@ -14285,14 +14285,14 @@ def save( def __init__( self, id: str, - type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | stdin | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, doc: None | Sequence[str] | str = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, default: CWLObjectType | None = None, inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -14872,7 +14872,7 @@ def save( def __init__( self, id: str, - type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, @@ -15921,7 +15921,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.1"] | None = None, + cwlVersion: CWLVersion | None = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, stdin: None | str = None, @@ -19580,7 +19580,7 @@ def save( def __init__( self, id: str, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, @@ -20311,14 +20311,14 @@ def save( def __init__( self, id: str, - type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, doc: None | Sequence[str] | str = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, default: CWLObjectType | None = None, inputBinding: InputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -20990,7 +20990,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.1"] | None = None, + cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -21620,14 +21620,14 @@ def save( def __init__( self, id: str, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, doc: None | Sequence[str] | str = None, format: None | str = None, outputSource: None | Sequence[str] | str = None, - linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + linkMerge: LinkMergeMethod | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -22241,9 +22241,9 @@ def __init__( self, id: str, source: None | Sequence[str] | str = None, - linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + linkMerge: LinkMergeMethod | None = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, label: None | str = None, default: CWLObjectType | None = None, valueFrom: None | str = None, @@ -23152,7 +23152,7 @@ def __init__( requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any] = None, scatter: None | Sequence[str] | str = None, - scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = None, + scatterMethod: None | ScatterMethod = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23855,7 +23855,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.1"] | None = None, + cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25160,7 +25160,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.1"] | None = None, + cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -26178,9 +26178,10 @@ def __init__( None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) Any_type: Final[_Loader[Any]] = _AnyLoader() longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) -PrimitiveTypeLoader: Final[ - _Loader[Literal["null", "boolean", "int", "long", "float", "double", "string"]] -] = _EnumLoader( +PrimitiveType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string" +] +PrimitiveTypeLoader: Final[_Loader[PrimitiveType]] = _EnumLoader( ( "null", "boolean", @@ -26206,7 +26207,8 @@ def __init__( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader: Final[_Loader[Literal["Any"]]] = _EnumLoader(("Any",), "Any") +Any_: TypeAlias = Literal["Any"] +Any_Loader: Final[_Loader[Any_]] = _EnumLoader(("Any",), "Any_") """ The **Any** type validates for any non-null value. """ @@ -26218,21 +26220,10 @@ def __init__( ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader: Final[ - _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - ] -] = _EnumLoader( +CWLType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" +] +CWLTypeLoader: Final[_Loader[CWLType]] = _EnumLoader( ( "null", "boolean", @@ -26516,13 +26507,13 @@ def __init__( ] ] ] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader -CWLVersionLoader: Final[_Loader[Literal["v1.1"]]] = _EnumLoader(("v1.1",), "CWLVersion") +CWLVersion: TypeAlias = Literal["v1.1"] +CWLVersionLoader: Final[_Loader[CWLVersion]] = _EnumLoader(("v1.1",), "CWLVersion") """ Current version symbol for CWL documents. """ -LoadListingEnumLoader: Final[ - _Loader[Literal["no_listing", "shallow_listing", "deep_listing"]] -] = _EnumLoader( +LoadListingEnum: TypeAlias = Literal["no_listing", "shallow_listing", "deep_listing"] +LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -26538,7 +26529,8 @@ def __init__( shallow_listing: Only load the top level listing, do not recurse into subdirectories. deep_listing: Load the directory listing and recursively load all subdirectories as well. """ -ExpressionLoader = _ExpressionLoader(str) +Expression: TypeAlias = Literal["ExpressionPlaceholder"] +ExpressionLoader: Final[_Loader[str]] = _ExpressionLoader(str) InputBindingLoader: Final[_Loader[InputBinding]] = _RecordLoader( InputBinding, None, None ) @@ -26608,7 +26600,8 @@ def __init__( CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( CommandOutputParameter, None, None ) -stdinLoader: Final[_Loader[Literal["stdin"]]] = _EnumLoader(("stdin",), "stdin") +stdin: TypeAlias = Literal["stdin"] +stdinLoader: Final[_Loader[stdin]] = _EnumLoader(("stdin",), "stdin") """ Only valid as a `type` for a `CommandLineTool` input with no `inputBinding` set. `stdin` must not be specified at the `CommandLineTool` @@ -26630,7 +26623,8 @@ def __init__( stdin: ${inputs.an_input_name.path} ``` """ -stdoutLoader: Final[_Loader[Literal["stdout"]]] = _EnumLoader(("stdout",), "stdout") +stdout: TypeAlias = Literal["stdout"] +stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26674,7 +26668,8 @@ def __init__( stdout: random_stdout_filenameABCDEFG ``` """ -stderrLoader: Final[_Loader[Literal["stderr"]]] = _EnumLoader(("stderr",), "stderr") +stderr: TypeAlias = Literal["stderr"] +stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -26734,14 +26729,13 @@ def __init__( ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( ExpressionTool, None, None ) -LinkMergeMethodLoader: Final[_Loader[Literal["merge_nested", "merge_flattened"]]] = ( - _EnumLoader( - ( - "merge_nested", - "merge_flattened", - ), - "LinkMergeMethod", - ) +LinkMergeMethod: TypeAlias = Literal["merge_nested", "merge_flattened"] +LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod]] = _EnumLoader( + ( + "merge_nested", + "merge_flattened", + ), + "LinkMergeMethod", ) """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). @@ -26755,9 +26749,10 @@ def __init__( WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( WorkflowStepOutput, None, None ) -ScatterMethodLoader: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"]] -] = _EnumLoader( +ScatterMethod: TypeAlias = Literal[ + "dotproduct", "nested_crossproduct", "flat_crossproduct" +] +ScatterMethodLoader: Final[_Loader[ScatterMethod]] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -26792,8 +26787,8 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -26814,8 +26809,8 @@ def __init__( Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -26828,14 +26823,14 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -26859,14 +26854,14 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -26893,10 +26888,9 @@ def __init__( idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ _Loader[None | Sequence[RecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") -Record_nameLoader: Final[_Loader[Literal["record"]]] = _EnumLoader( - ("record",), "Record_name" -) -typedsl_Record_nameLoader_2: Final[_Loader[Literal["record"]]] = _TypeDSLLoader( +Record_name: TypeAlias = Literal["record"] +Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final[_Loader[Record_name]] = _TypeDSLLoader( Record_nameLoader, 2, "v1.1" ) union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( @@ -26911,22 +26905,23 @@ def __init__( uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader: Final[_Loader[Literal["enum"]]] = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2: Final[_Loader[Literal["enum"]]] = _TypeDSLLoader( +Enum_name: TypeAlias = Literal["enum"] +Enum_nameLoader: Final[_Loader[Enum_name]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Enum_name]] = _TypeDSLLoader( Enum_nameLoader, 2, "v1.1" ) uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -26941,30 +26936,23 @@ def __init__( 2, None, ) -Array_nameLoader: Final[_Loader[Literal["array"]]] = _EnumLoader( - ("array",), "Array_name" -) -typedsl_Array_nameLoader_2: Final[_Loader[Literal["array"]]] = _TypeDSLLoader( +Array_name: TypeAlias = Literal["array"] +Array_nameLoader: Final[_Loader[Array_name]] = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final[_Loader[Array_name]] = _TypeDSLLoader( Array_nameLoader, 2, "v1.1" ) -Map_nameLoader: Final[_Loader[Literal["map"]]] = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2: Final[_Loader[Literal["map"]]] = _TypeDSLLoader( +Map_name: TypeAlias = Literal["map"] +Map_nameLoader: Final[_Loader[Map_name]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Map_name]] = _TypeDSLLoader( Map_nameLoader, 2, "v1.1" ) -Union_nameLoader: Final[_Loader[Literal["union"]]] = _EnumLoader( - ("union",), "Union_name" -) -typedsl_Union_nameLoader_2: Final[_Loader[Literal["union"]]] = _TypeDSLLoader( +Union_name: TypeAlias = Literal["union"] +Union_nameLoader: Final[_Loader[Union_name]] = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final[_Loader[Union_name]] = _TypeDSLLoader( Union_nameLoader, 2, "v1.1" ) union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ - _Loader[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] ] = _UnionLoader( ( PrimitiveTypeLoader, @@ -26976,13 +26964,7 @@ def __init__( ) array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] ] ] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype @@ -26992,14 +26974,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _UnionLoader( @@ -27017,14 +26993,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _URILoader( @@ -27039,14 +27009,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _TypeDSLLoader( @@ -27068,8 +27032,9 @@ def __init__( idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ _Loader[None | Sequence[CWLRecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") -File_classLoader: Final[_Loader[Literal["File"]]] = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None: Final[_Loader[Literal["File"]]] = _URILoader( +File_class: TypeAlias = Literal["File"] +File_classLoader: Final[_Loader[File_class]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[File_class]] = _URILoader( File_classLoader, False, True, None, None ) uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( @@ -27112,10 +27077,11 @@ def __init__( uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( _URILoader(union_of_None_type_or_strtype, True, False, None, True) ) -Directory_classLoader: Final[_Loader[Literal["Directory"]]] = _EnumLoader( +Directory_class: TypeAlias = Literal["Directory"] +Directory_classLoader: Final[_Loader[Directory_class]] = _EnumLoader( ("Directory",), "Directory_class" ) -uri_Directory_classLoader_False_True_None_None: Final[_Loader[Literal["Directory"]]] = ( +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Directory_class]] = ( _URILoader(Directory_classLoader, False, True, None, None) ) union_of_None_type_or_booltype: Final[_Loader[None | bool]] = _UnionLoader( @@ -27124,12 +27090,12 @@ def __init__( booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader: Final[ - _Loader[Literal["no_listing", "shallow_listing", "deep_listing"] | None] -] = _UnionLoader( - ( - None_type, - LoadListingEnumLoader, +union_of_None_type_or_LoadListingEnumLoader: Final[_Loader[LoadListingEnum | None]] = ( + _UnionLoader( + ( + None_type, + LoadListingEnumLoader, + ) ) ) array_of_SecondaryFileSchemaLoader: Final[_Loader[Sequence[SecondaryFileSchema]]] = ( @@ -27188,23 +27154,7 @@ def __init__( union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True ) union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ - _Loader[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] + _Loader[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] ] = _UnionLoader( ( CWLTypeLoader, @@ -27216,59 +27166,19 @@ def __init__( ) array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] + Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] ] ] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -27284,36 +27194,12 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -27338,36 +27224,12 @@ def __init__( ] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -27379,23 +27241,7 @@ def __init__( None, ) union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ - _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str - ] + _Loader[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] ] = _UnionLoader( ( CWLTypeLoader, @@ -27408,21 +27254,7 @@ def __init__( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] ] ] = _ArrayLoader( @@ -27430,36 +27262,12 @@ def __init__( ) union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -27475,36 +27283,12 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -27529,36 +27313,12 @@ def __init__( ] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -27835,7 +27595,7 @@ def __init__( "class", "None", ) -union_of_None_type_or_CWLVersionLoader: Final[_Loader[Literal["v1.1"] | None]] = ( +union_of_None_type_or_CWLVersionLoader: Final[_Loader[CWLVersion | None]] = ( _UnionLoader( ( None_type, @@ -27844,13 +27604,14 @@ def __init__( ) ) uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ - _Loader[Literal["v1.1"] | None] + _Loader[CWLVersion | None] ] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) +InlineJavascriptRequirement_class: TypeAlias = Literal["InlineJavascriptRequirement"] InlineJavascriptRequirement_classLoader: Final[ - _Loader[Literal["InlineJavascriptRequirement"]] + _Loader[InlineJavascriptRequirement_class] ] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["InlineJavascriptRequirement"]] + _Loader[InlineJavascriptRequirement_class] ] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( _UnionLoader( @@ -27860,11 +27621,12 @@ def __init__( ) ) ) -SchemaDefRequirement_classLoader: Final[_Loader[Literal["SchemaDefRequirement"]]] = ( +SchemaDefRequirement_class: TypeAlias = Literal["SchemaDefRequirement"] +SchemaDefRequirement_classLoader: Final[_Loader[SchemaDefRequirement_class]] = ( _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SchemaDefRequirement"]] + _Loader[SchemaDefRequirement_class] ] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ _Loader[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] @@ -27899,11 +27661,12 @@ def __init__( ExpressionLoader, ) ) -LoadListingRequirement_classLoader: Final[ - _Loader[Literal["LoadListingRequirement"]] -] = _EnumLoader(("LoadListingRequirement",), "LoadListingRequirement_class") +LoadListingRequirement_class: TypeAlias = Literal["LoadListingRequirement"] +LoadListingRequirement_classLoader: Final[_Loader[LoadListingRequirement_class]] = ( + _EnumLoader(("LoadListingRequirement",), "LoadListingRequirement_class") +) uri_LoadListingRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["LoadListingRequirement"]] + _Loader[LoadListingRequirement_class] ] = _URILoader(LoadListingRequirement_classLoader, False, True, None, None) union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( _UnionLoader( @@ -27940,20 +27703,10 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] = _UnionLoader( @@ -27968,20 +27721,10 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] @@ -27990,35 +27733,15 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -28035,35 +27758,15 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -28091,35 +27794,15 @@ def __init__( ) uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -28133,20 +27816,10 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] = _UnionLoader( @@ -28161,20 +27834,10 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] @@ -28183,35 +27846,15 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -28228,35 +27871,15 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -28292,35 +27915,15 @@ def __init__( ) uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -28334,38 +27937,18 @@ def __init__( ) union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stdin"] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stdin | str ] ] = _UnionLoader( @@ -28381,38 +27964,18 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stdin"] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stdin | str ] ] = _TypeDSLLoader( @@ -28422,39 +27985,19 @@ def __init__( ) union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stderr"] - | Literal["stdout"] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stderr + | stdout | str ] ] = _UnionLoader( @@ -28471,39 +28014,19 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stderr"] - | Literal["stdout"] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stderr + | stdout | str ] ] = _TypeDSLLoader( @@ -28511,11 +28034,12 @@ def __init__( 2, "v1.1", ) -CommandLineTool_classLoader: Final[_Loader[Literal["CommandLineTool"]]] = _EnumLoader( +CommandLineTool_class: TypeAlias = Literal["CommandLineTool"] +CommandLineTool_classLoader: Final[_Loader[CommandLineTool_class]] = _EnumLoader( ("CommandLineTool",), "CommandLineTool_class" ) uri_CommandLineTool_classLoader_False_True_None_None: Final[ - _Loader[Literal["CommandLineTool"]] + _Loader[CommandLineTool_class] ] = _URILoader(CommandLineTool_classLoader, False, True, None, None) array_of_CommandInputParameterLoader: Final[ _Loader[Sequence[CommandInputParameter]] @@ -28558,17 +28082,19 @@ def __init__( ) ) ) -DockerRequirement_classLoader: Final[_Loader[Literal["DockerRequirement"]]] = ( - _EnumLoader(("DockerRequirement",), "DockerRequirement_class") +DockerRequirement_class: TypeAlias = Literal["DockerRequirement"] +DockerRequirement_classLoader: Final[_Loader[DockerRequirement_class]] = _EnumLoader( + ("DockerRequirement",), "DockerRequirement_class" ) uri_DockerRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["DockerRequirement"]] + _Loader[DockerRequirement_class] ] = _URILoader(DockerRequirement_classLoader, False, True, None, None) -SoftwareRequirement_classLoader: Final[_Loader[Literal["SoftwareRequirement"]]] = ( +SoftwareRequirement_class: TypeAlias = Literal["SoftwareRequirement"] +SoftwareRequirement_classLoader: Final[_Loader[SoftwareRequirement_class]] = ( _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SoftwareRequirement"]] + _Loader[SoftwareRequirement_class] ] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( _ArrayLoader(SoftwarePackageLoader) @@ -28579,11 +28105,12 @@ def __init__( uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ _Loader[None | Sequence[str]] ] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_class: TypeAlias = Literal["InitialWorkDirRequirement"] InitialWorkDirRequirement_classLoader: Final[ - _Loader[Literal["InitialWorkDirRequirement"]] + _Loader[InitialWorkDirRequirement_class] ] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["InitialWorkDirRequirement"]] + _Loader[InitialWorkDirRequirement_class] ] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader: Final[ _Loader[Directory | Dirent | File | None | Sequence[Directory | File] | str] @@ -28615,11 +28142,12 @@ def __init__( ExpressionLoader, ) ) -EnvVarRequirement_classLoader: Final[_Loader[Literal["EnvVarRequirement"]]] = ( - _EnumLoader(("EnvVarRequirement",), "EnvVarRequirement_class") +EnvVarRequirement_class: TypeAlias = Literal["EnvVarRequirement"] +EnvVarRequirement_classLoader: Final[_Loader[EnvVarRequirement_class]] = _EnumLoader( + ("EnvVarRequirement",), "EnvVarRequirement_class" ) uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["EnvVarRequirement"]] + _Loader[EnvVarRequirement_class] ] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( EnvironmentDefLoader @@ -28627,17 +28155,19 @@ def __init__( idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -ShellCommandRequirement_classLoader: Final[ - _Loader[Literal["ShellCommandRequirement"]] -] = _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +ShellCommandRequirement_class: TypeAlias = Literal["ShellCommandRequirement"] +ShellCommandRequirement_classLoader: Final[_Loader[ShellCommandRequirement_class]] = ( + _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +) uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ShellCommandRequirement"]] + _Loader[ShellCommandRequirement_class] ] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) -ResourceRequirement_classLoader: Final[_Loader[Literal["ResourceRequirement"]]] = ( +ResourceRequirement_class: TypeAlias = Literal["ResourceRequirement"] +ResourceRequirement_classLoader: Final[_Loader[ResourceRequirement_class]] = ( _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) uri_ResourceRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ResourceRequirement"]] + _Loader[ResourceRequirement_class] ] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader: Final[ _Loader[None | i32 | str] @@ -28649,10 +28179,11 @@ def __init__( ExpressionLoader, ) ) -WorkReuse_classLoader: Final[_Loader[Literal["WorkReuse"]]] = _EnumLoader( +WorkReuse_class: TypeAlias = Literal["WorkReuse"] +WorkReuse_classLoader: Final[_Loader[WorkReuse_class]] = _EnumLoader( ("WorkReuse",), "WorkReuse_class" ) -uri_WorkReuse_classLoader_False_True_None_None: Final[_Loader[Literal["WorkReuse"]]] = ( +uri_WorkReuse_classLoader_False_True_None_None: Final[_Loader[WorkReuse_class]] = ( _URILoader(WorkReuse_classLoader, False, True, None, None) ) union_of_booltype_or_ExpressionLoader: Final[_Loader[bool | str]] = _UnionLoader( @@ -28661,23 +28192,26 @@ def __init__( ExpressionLoader, ) ) -NetworkAccess_classLoader: Final[_Loader[Literal["NetworkAccess"]]] = _EnumLoader( +NetworkAccess_class: TypeAlias = Literal["NetworkAccess"] +NetworkAccess_classLoader: Final[_Loader[NetworkAccess_class]] = _EnumLoader( ("NetworkAccess",), "NetworkAccess_class" ) uri_NetworkAccess_classLoader_False_True_None_None: Final[ - _Loader[Literal["NetworkAccess"]] + _Loader[NetworkAccess_class] ] = _URILoader(NetworkAccess_classLoader, False, True, None, None) -InplaceUpdateRequirement_classLoader: Final[ - _Loader[Literal["InplaceUpdateRequirement"]] -] = _EnumLoader(("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class") +InplaceUpdateRequirement_class: TypeAlias = Literal["InplaceUpdateRequirement"] +InplaceUpdateRequirement_classLoader: Final[_Loader[InplaceUpdateRequirement_class]] = ( + _EnumLoader(("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class") +) uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["InplaceUpdateRequirement"]] + _Loader[InplaceUpdateRequirement_class] ] = _URILoader(InplaceUpdateRequirement_classLoader, False, True, None, None) -ToolTimeLimit_classLoader: Final[_Loader[Literal["ToolTimeLimit"]]] = _EnumLoader( +ToolTimeLimit_class: TypeAlias = Literal["ToolTimeLimit"] +ToolTimeLimit_classLoader: Final[_Loader[ToolTimeLimit_class]] = _EnumLoader( ("ToolTimeLimit",), "ToolTimeLimit_class" ) uri_ToolTimeLimit_classLoader_False_True_None_None: Final[ - _Loader[Literal["ToolTimeLimit"]] + _Loader[ToolTimeLimit_class] ] = _URILoader(ToolTimeLimit_classLoader, False, True, None, None) union_of_inttype_or_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = ( _UnionLoader( @@ -28696,11 +28230,12 @@ def __init__( ) ) ) -ExpressionTool_classLoader: Final[_Loader[Literal["ExpressionTool"]]] = _EnumLoader( +ExpressionTool_class: TypeAlias = Literal["ExpressionTool"] +ExpressionTool_classLoader: Final[_Loader[ExpressionTool_class]] = _EnumLoader( ("ExpressionTool",), "ExpressionTool_class" ) uri_ExpressionTool_classLoader_False_True_None_None: Final[ - _Loader[Literal["ExpressionTool"]] + _Loader[ExpressionTool_class] ] = _URILoader(ExpressionTool_classLoader, False, True, None, None) array_of_WorkflowInputParameterLoader: Final[ _Loader[Sequence[WorkflowInputParameter]] @@ -28717,12 +28252,12 @@ def __init__( uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ _Loader[None | Sequence[str] | str] ] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) -union_of_None_type_or_LinkMergeMethodLoader: Final[ - _Loader[Literal["merge_nested", "merge_flattened"] | None] -] = _UnionLoader( - ( - None_type, - LinkMergeMethodLoader, +union_of_None_type_or_LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod | None]] = ( + _UnionLoader( + ( + None_type, + LinkMergeMethodLoader, + ) ) ) uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ @@ -28792,21 +28327,22 @@ def __init__( uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ _Loader[None | Sequence[str] | str] ] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) -union_of_None_type_or_ScatterMethodLoader: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] -] = _UnionLoader( - ( - None_type, - ScatterMethodLoader, +union_of_None_type_or_ScatterMethodLoader: Final[_Loader[None | ScatterMethod]] = ( + _UnionLoader( + ( + None_type, + ScatterMethodLoader, + ) ) ) uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] + _Loader[None | ScatterMethod] ] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) -Workflow_classLoader: Final[_Loader[Literal["Workflow"]]] = _EnumLoader( +Workflow_class: TypeAlias = Literal["Workflow"] +Workflow_classLoader: Final[_Loader[Workflow_class]] = _EnumLoader( ("Workflow",), "Workflow_class" ) -uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Literal["Workflow"]]] = ( +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Workflow_class]] = ( _URILoader(Workflow_classLoader, False, True, None, None) ) array_of_WorkflowOutputParameterLoader: Final[ @@ -28824,35 +28360,45 @@ def __init__( idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ _Loader[Sequence[WorkflowStep]] ] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_class: TypeAlias = Literal[ + "SubworkflowFeatureRequirement" +] SubworkflowFeatureRequirement_classLoader: Final[ - _Loader[Literal["SubworkflowFeatureRequirement"]] + _Loader[SubworkflowFeatureRequirement_class] ] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SubworkflowFeatureRequirement"]] + _Loader[SubworkflowFeatureRequirement_class] ] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_class: TypeAlias = Literal["ScatterFeatureRequirement"] ScatterFeatureRequirement_classLoader: Final[ - _Loader[Literal["ScatterFeatureRequirement"]] + _Loader[ScatterFeatureRequirement_class] ] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ScatterFeatureRequirement"]] + _Loader[ScatterFeatureRequirement_class] ] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_class: TypeAlias = Literal[ + "MultipleInputFeatureRequirement" +] MultipleInputFeatureRequirement_classLoader: Final[ - _Loader[Literal["MultipleInputFeatureRequirement"]] + _Loader[MultipleInputFeatureRequirement_class] ] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["MultipleInputFeatureRequirement"]] + _Loader[MultipleInputFeatureRequirement_class] ] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_class: TypeAlias = Literal[ + "StepInputExpressionRequirement" +] StepInputExpressionRequirement_classLoader: Final[ - _Loader[Literal["StepInputExpressionRequirement"]] + _Loader[StepInputExpressionRequirement_class] ] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["StepInputExpressionRequirement"]] + _Loader[StepInputExpressionRequirement_class] ] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( strtype, False, True, None, None diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index 2331fbaa..6a56e9e8 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -5,7 +5,7 @@ from collections.abc import MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, Literal, TypeAlias, TypeVar, cast +from typing import IO, Any, TypeAlias, TypeVar, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -25,90 +25,35 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) +BasicInputTypeSchemas: TypeAlias = cwl.InputSchema | str | cwl.CWLType InputTypeSchemas: TypeAlias = ( - BasicInputTypeSchemas | Literal["stdin"] | Sequence[BasicInputTypeSchemas] + BasicInputTypeSchemas | cwl.stdin | Sequence[BasicInputTypeSchemas] ) BasicCommandInputTypeSchemas: TypeAlias = ( cwl.CommandInputArraySchema | cwl.CommandInputEnumSchema | cwl.CommandInputRecordSchema | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + | cwl.CWLType ) CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas - | Literal["stdin"] - | Sequence[BasicCommandInputTypeSchemas] -) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + BasicCommandInputTypeSchemas | cwl.stdin | Sequence[BasicCommandInputTypeSchemas] ) +BasicOutputTypeSchemas: TypeAlias = cwl.OutputSchema | str | cwl.CWLType OutputTypeSchemas: TypeAlias = ( - BasicOutputTypeSchemas - | Literal["stderr", "stdout"] - | Sequence[BasicOutputTypeSchemas] + BasicOutputTypeSchemas | cwl.stderr | cwl.stdout | Sequence[BasicOutputTypeSchemas] ) BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema | cwl.CommandOutputRecordSchema | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + | cwl.CWLType ) CommandOutputTypeSchemas: TypeAlias = ( BasicCommandOutputTypeSchemas - | Literal["stderr", "stdout"] + | cwl.stdout + | cwl.stderr | Sequence[BasicCommandOutputTypeSchemas] ) AnyTypeSchema = TypeVar( diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index a138ccfa..61b6b602 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -1455,7 +1455,7 @@ def save( def __init__( self, name: str, - type_: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1656,7 +1656,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[RecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1928,7 +1928,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -2129,8 +2129,8 @@ def save( def __init__( self, - items: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Literal["array"], + items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Array_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2329,8 +2329,8 @@ def save( def __init__( self, - type_: Literal["map"], - values: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Map_name, + values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2529,8 +2529,8 @@ def save( def __init__( self, - names: ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | Sequence[ArraySchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Literal["union"], + names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: Union_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2729,8 +2729,8 @@ def save( def __init__( self, - items: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, - type_: Literal["array"], + items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + type_: Array_name, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2997,7 +2997,7 @@ def save( def __init__( self, name: str, - type_: CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | Literal["null", "boolean", "int", "long", "float", "double", "string"] | str] | str, + type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -3198,7 +3198,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CWLRecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -5165,14 +5165,14 @@ def save( def __init__( self, name: str, - type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5562,7 +5562,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[InputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -5943,7 +5943,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -6322,8 +6322,8 @@ def save( def __init__( self, - items: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, @@ -6825,7 +6825,7 @@ def save( def __init__( self, name: str, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, @@ -7208,7 +7208,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[OutputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -7589,7 +7589,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -7968,8 +7968,8 @@ def save( def __init__( self, - items: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - type_: Literal["array"], + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, @@ -8747,7 +8747,7 @@ def save( def __init__( self, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -9836,7 +9836,7 @@ def save( def __init__( self, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, glob: None | Sequence[str] | str = None, outputEval: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -10507,14 +10507,14 @@ def save( def __init__( self, name: str, - type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -10972,7 +10972,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CommandInputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -11420,7 +11420,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -11859,8 +11859,8 @@ def save( def __init__( self, - items: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, @@ -12421,7 +12421,7 @@ def save( def __init__( self, name: str, - type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, @@ -12815,7 +12815,7 @@ def save( def __init__( self, - type_: Literal["record"], + type_: Record_name, fields: None | Sequence[CommandOutputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -13196,7 +13196,7 @@ def save( def __init__( self, symbols: Sequence[str], - type_: Literal["enum"], + type_: Enum_name, name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, @@ -13575,8 +13575,8 @@ def save( def __init__( self, - items: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, - type_: Literal["array"], + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, @@ -14307,14 +14307,14 @@ def save( def __init__( self, id: str, - type_: CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stdin"] | Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | stdin | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, doc: None | Sequence[str] | str = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, default: CWLObjectType | None = None, inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -14894,7 +14894,7 @@ def save( def __init__( self, id: str, - type_: CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Literal["stderr"] | Literal["stdout"] | Sequence[CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, @@ -15996,7 +15996,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.2"] | None = None, + cwlVersion: CWLVersion | None = None, intent: None | Sequence[str] = None, baseCommand: None | Sequence[str] | str = None, arguments: None | Sequence[CommandLineBinding | str] = None, @@ -19668,7 +19668,7 @@ def save( def __init__( self, id: str, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, @@ -20399,14 +20399,14 @@ def save( def __init__( self, id: str, - type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, doc: None | Sequence[str] | str = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, default: CWLObjectType | None = None, inputBinding: InputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -21131,7 +21131,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.2"] | None = None, + cwlVersion: CWLVersion | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -21821,15 +21821,15 @@ def save( def __init__( self, id: str, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, doc: None | Sequence[str] | str = None, format: None | str = None, outputSource: None | Sequence[str] | str = None, - linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, - pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = None, + linkMerge: LinkMergeMethod | None = None, + pickValue: None | PickValueMethod = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -22564,10 +22564,10 @@ def __init__( self, id: str, source: None | Sequence[str] | str = None, - linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, - pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = None, + linkMerge: LinkMergeMethod | None = None, + pickValue: None | PickValueMethod = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, label: None | str = None, default: CWLObjectType | None = None, valueFrom: None | str = None, @@ -23557,7 +23557,7 @@ def __init__( hints: None | Sequence[Any] = None, when: None | str = None, scatter: None | Sequence[str] | str = None, - scatterMethod: Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None = None, + scatterMethod: None | ScatterMethod = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -24321,7 +24321,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.2"] | None = None, + cwlVersion: CWLVersion | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -25492,14 +25492,14 @@ def save( def __init__( self, id: str, - type_: InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema | Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | str] | str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, doc: None | Sequence[str] | str = None, format: None | Sequence[str] | str = None, loadContents: None | bool = None, - loadListing: Literal["no_listing", "shallow_listing", "deep_listing"] | None = None, + loadListing: LoadListingEnum | None = None, default: CWLObjectType | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -26020,7 +26020,7 @@ def save( def __init__( self, id: str, - type_: Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[Literal["null", "boolean", "int", "long", "float", "double", "string", "File", "Directory"] | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, @@ -26673,7 +26673,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.2"] | None = None, + cwlVersion: CWLVersion | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -27552,7 +27552,7 @@ def __init__( doc: None | Sequence[str] | str = None, requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: Literal["v1.2"] | None = None, + cwlVersion: CWLVersion | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -28563,9 +28563,9 @@ def __init__( self, default: Any | None = None, id: None | str = None, - linkMerge: Literal["merge_nested", "merge_flattened"] | None = None, + linkMerge: LinkMergeMethod | None = None, loopSource: None | Sequence[str] | str = None, - pickValue: Literal["first_non_null", "the_only_non_null", "all_non_null"] | None = None, + pickValue: None | PickValueMethod = None, valueFrom: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -28875,7 +28875,7 @@ def __init__( self, loop: Sequence[LoopInput], loopWhen: str, - outputMethod: Literal["last", "all"], + outputMethod: LoopOutputModes, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -29344,9 +29344,10 @@ def __init__( None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) Any_type: Final[_Loader[Any]] = _AnyLoader() longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) -PrimitiveTypeLoader: Final[ - _Loader[Literal["null", "boolean", "int", "long", "float", "double", "string"]] -] = _EnumLoader( +PrimitiveType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string" +] +PrimitiveTypeLoader: Final[_Loader[PrimitiveType]] = _EnumLoader( ( "null", "boolean", @@ -29372,7 +29373,8 @@ def __init__( double: double precision (64-bit) IEEE 754 floating-point number string: Unicode character sequence """ -AnyLoader: Final[_Loader[Literal["Any"]]] = _EnumLoader(("Any",), "Any") +Any_: TypeAlias = Literal["Any"] +Any_Loader: Final[_Loader[Any_]] = _EnumLoader(("Any",), "Any_") """ The **Any** type validates for any non-null value. """ @@ -29384,21 +29386,10 @@ def __init__( ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) -CWLTypeLoader: Final[ - _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - ] -] = _EnumLoader( +CWLType: TypeAlias = Literal[ + "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" +] +CWLTypeLoader: Final[_Loader[CWLType]] = _EnumLoader( ( "null", "boolean", @@ -29689,13 +29680,13 @@ def __init__( ] ] ] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader -CWLVersionLoader: Final[_Loader[Literal["v1.2"]]] = _EnumLoader(("v1.2",), "CWLVersion") +CWLVersion: TypeAlias = Literal["v1.2"] +CWLVersionLoader: Final[_Loader[CWLVersion]] = _EnumLoader(("v1.2",), "CWLVersion") """ Current version symbol for CWL documents. """ -LoadListingEnumLoader: Final[ - _Loader[Literal["no_listing", "shallow_listing", "deep_listing"]] -] = _EnumLoader( +LoadListingEnum: TypeAlias = Literal["no_listing", "shallow_listing", "deep_listing"] +LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _EnumLoader( ( "no_listing", "shallow_listing", @@ -29711,7 +29702,8 @@ def __init__( shallow_listing: Only load the top level listing, do not recurse into subdirectories. deep_listing: Load the directory listing and recursively load all subdirectories as well. """ -ExpressionLoader = _ExpressionLoader(str) +Expression: TypeAlias = Literal["ExpressionPlaceholder"] +ExpressionLoader: Final[_Loader[str]] = _ExpressionLoader(str) InputBindingLoader: Final[_Loader[InputBinding]] = _RecordLoader( InputBinding, None, None ) @@ -29781,7 +29773,8 @@ def __init__( CommandOutputParameterLoader: Final[_Loader[CommandOutputParameter]] = _RecordLoader( CommandOutputParameter, None, None ) -stdinLoader: Final[_Loader[Literal["stdin"]]] = _EnumLoader(("stdin",), "stdin") +stdin: TypeAlias = Literal["stdin"] +stdinLoader: Final[_Loader[stdin]] = _EnumLoader(("stdin",), "stdin") """ Only valid as a `type` for a `CommandLineTool` input with no `inputBinding` set. `stdin` must not be specified at the `CommandLineTool` @@ -29803,7 +29796,8 @@ def __init__( stdin: $(inputs.an_input_name.path) ``` """ -stdoutLoader: Final[_Loader[Literal["stdout"]]] = _EnumLoader(("stdout",), "stdout") +stdout: TypeAlias = Literal["stdout"] +stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29851,7 +29845,8 @@ def __init__( (e.g. `echo a && echo b`) `stdout` must include the output of every command. """ -stderrLoader: Final[_Loader[Literal["stderr"]]] = _EnumLoader(("stderr",), "stderr") +stderr: TypeAlias = Literal["stderr"] +stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ Only valid as a `type` for a `CommandLineTool` output with no `outputBinding` set. @@ -29911,21 +29906,21 @@ def __init__( ExpressionToolLoader: Final[_Loader[ExpressionTool]] = _RecordLoader( ExpressionTool, None, None ) -LinkMergeMethodLoader: Final[_Loader[Literal["merge_nested", "merge_flattened"]]] = ( - _EnumLoader( - ( - "merge_nested", - "merge_flattened", - ), - "LinkMergeMethod", - ) +LinkMergeMethod: TypeAlias = Literal["merge_nested", "merge_flattened"] +LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod]] = _EnumLoader( + ( + "merge_nested", + "merge_flattened", + ), + "LinkMergeMethod", ) """ The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). """ -PickValueMethodLoader: Final[ - _Loader[Literal["first_non_null", "the_only_non_null", "all_non_null"]] -] = _EnumLoader( +PickValueMethod: TypeAlias = Literal[ + "first_non_null", "the_only_non_null", "all_non_null" +] +PickValueMethodLoader: Final[_Loader[PickValueMethod]] = _EnumLoader( ( "first_non_null", "the_only_non_null", @@ -29945,9 +29940,10 @@ def __init__( WorkflowStepOutputLoader: Final[_Loader[WorkflowStepOutput]] = _RecordLoader( WorkflowStepOutput, None, None ) -ScatterMethodLoader: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"]] -] = _EnumLoader( +ScatterMethod: TypeAlias = Literal[ + "dotproduct", "nested_crossproduct", "flat_crossproduct" +] +ScatterMethodLoader: Final[_Loader[ScatterMethod]] = _EnumLoader( ( "dotproduct", "nested_crossproduct", @@ -29990,8 +29986,8 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -30012,8 +30008,8 @@ def __init__( Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -30026,14 +30022,14 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -30057,14 +30053,14 @@ def __init__( _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -30091,10 +30087,9 @@ def __init__( idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ _Loader[None | Sequence[RecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") -Record_nameLoader: Final[_Loader[Literal["record"]]] = _EnumLoader( - ("record",), "Record_name" -) -typedsl_Record_nameLoader_2: Final[_Loader[Literal["record"]]] = _TypeDSLLoader( +Record_name: TypeAlias = Literal["record"] +Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") +typedsl_Record_nameLoader_2: Final[_Loader[Record_name]] = _TypeDSLLoader( Record_nameLoader, 2, "v1.1" ) union_of_None_type_or_strtype: Final[_Loader[None | str]] = _UnionLoader( @@ -30109,22 +30104,23 @@ def __init__( uri_array_of_strtype_True_False_None_None: Final[_Loader[Sequence[str]]] = _URILoader( array_of_strtype, True, False, None, None ) -Enum_nameLoader: Final[_Loader[Literal["enum"]]] = _EnumLoader(("enum",), "Enum_name") -typedsl_Enum_nameLoader_2: Final[_Loader[Literal["enum"]]] = _TypeDSLLoader( +Enum_name: TypeAlias = Literal["enum"] +Enum_nameLoader: Final[_Loader[Enum_name]] = _EnumLoader(("enum",), "Enum_name") +typedsl_Enum_nameLoader_2: Final[_Loader[Enum_name]] = _TypeDSLLoader( Enum_nameLoader, 2, "v1.1" ) uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | Sequence[ ArraySchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] | MapSchema + | PrimitiveType | RecordSchema | UnionSchema | str @@ -30139,30 +30135,23 @@ def __init__( 2, None, ) -Array_nameLoader: Final[_Loader[Literal["array"]]] = _EnumLoader( - ("array",), "Array_name" -) -typedsl_Array_nameLoader_2: Final[_Loader[Literal["array"]]] = _TypeDSLLoader( +Array_name: TypeAlias = Literal["array"] +Array_nameLoader: Final[_Loader[Array_name]] = _EnumLoader(("array",), "Array_name") +typedsl_Array_nameLoader_2: Final[_Loader[Array_name]] = _TypeDSLLoader( Array_nameLoader, 2, "v1.1" ) -Map_nameLoader: Final[_Loader[Literal["map"]]] = _EnumLoader(("map",), "Map_name") -typedsl_Map_nameLoader_2: Final[_Loader[Literal["map"]]] = _TypeDSLLoader( +Map_name: TypeAlias = Literal["map"] +Map_nameLoader: Final[_Loader[Map_name]] = _EnumLoader(("map",), "Map_name") +typedsl_Map_nameLoader_2: Final[_Loader[Map_name]] = _TypeDSLLoader( Map_nameLoader, 2, "v1.1" ) -Union_nameLoader: Final[_Loader[Literal["union"]]] = _EnumLoader( - ("union",), "Union_name" -) -typedsl_Union_nameLoader_2: Final[_Loader[Literal["union"]]] = _TypeDSLLoader( +Union_name: TypeAlias = Literal["union"] +Union_nameLoader: Final[_Loader[Union_name]] = _EnumLoader(("union",), "Union_name") +typedsl_Union_nameLoader_2: Final[_Loader[Union_name]] = _TypeDSLLoader( Union_nameLoader, 2, "v1.1" ) union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ - _Loader[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] ] = _UnionLoader( ( PrimitiveTypeLoader, @@ -30174,13 +30163,7 @@ def __init__( ) array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] ] ] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype @@ -30190,14 +30173,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _UnionLoader( @@ -30215,14 +30192,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _URILoader( @@ -30237,14 +30208,8 @@ def __init__( CWLArraySchema | CWLRecordSchema | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | Sequence[ - CWLArraySchema - | CWLRecordSchema - | EnumSchema - | Literal["null", "boolean", "int", "long", "float", "double", "string"] - | str - ] + | PrimitiveType + | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str ] ] = _TypeDSLLoader( @@ -30266,8 +30231,9 @@ def __init__( idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader: Final[ _Loader[None | Sequence[CWLRecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_CWLRecordFieldLoader, "name", "type") -File_classLoader: Final[_Loader[Literal["File"]]] = _EnumLoader(("File",), "File_class") -uri_File_classLoader_False_True_None_None: Final[_Loader[Literal["File"]]] = _URILoader( +File_class: TypeAlias = Literal["File"] +File_classLoader: Final[_Loader[File_class]] = _EnumLoader(("File",), "File_class") +uri_File_classLoader_False_True_None_None: Final[_Loader[File_class]] = _URILoader( File_classLoader, False, True, None, None ) uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( @@ -30310,10 +30276,11 @@ def __init__( uri_union_of_None_type_or_strtype_True_False_None_True: Final[_Loader[None | str]] = ( _URILoader(union_of_None_type_or_strtype, True, False, None, True) ) -Directory_classLoader: Final[_Loader[Literal["Directory"]]] = _EnumLoader( +Directory_class: TypeAlias = Literal["Directory"] +Directory_classLoader: Final[_Loader[Directory_class]] = _EnumLoader( ("Directory",), "Directory_class" ) -uri_Directory_classLoader_False_True_None_None: Final[_Loader[Literal["Directory"]]] = ( +uri_Directory_classLoader_False_True_None_None: Final[_Loader[Directory_class]] = ( _URILoader(Directory_classLoader, False, True, None, None) ) union_of_None_type_or_booltype: Final[_Loader[None | bool]] = _UnionLoader( @@ -30322,12 +30289,12 @@ def __init__( booltype, ) ) -union_of_None_type_or_LoadListingEnumLoader: Final[ - _Loader[Literal["no_listing", "shallow_listing", "deep_listing"] | None] -] = _UnionLoader( - ( - None_type, - LoadListingEnumLoader, +union_of_None_type_or_LoadListingEnumLoader: Final[_Loader[LoadListingEnum | None]] = ( + _UnionLoader( + ( + None_type, + LoadListingEnumLoader, + ) ) ) array_of_SecondaryFileSchemaLoader: Final[_Loader[Sequence[SecondaryFileSchema]]] = ( @@ -30386,23 +30353,7 @@ def __init__( union_of_None_type_or_strtype_or_ExpressionLoader, True, False, None, True ) union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ - _Loader[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] + _Loader[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] ] = _UnionLoader( ( CWLTypeLoader, @@ -30414,59 +30365,19 @@ def __init__( ) array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str - ] + Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] ] ] = _ArrayLoader( union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype ) union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -30482,36 +30393,12 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -30536,36 +30423,12 @@ def __init__( ] = _IdMapLoader(union_of_None_type_or_array_of_InputRecordFieldLoader, "name", "type") uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - InputArraySchema + CWLType + | InputArraySchema | InputEnumSchema | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - InputArraySchema - | InputEnumSchema - | InputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | str + CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str ] | str ] @@ -30577,23 +30440,7 @@ def __init__( None, ) union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ - _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str - ] + _Loader[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] ] = _UnionLoader( ( CWLTypeLoader, @@ -30606,21 +30453,7 @@ def __init__( array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] ] ] = _ArrayLoader( @@ -30628,36 +30461,12 @@ def __init__( ) union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -30673,36 +30482,12 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -30727,36 +30512,12 @@ def __init__( ] = _IdMapLoader(union_of_None_type_or_array_of_OutputRecordFieldLoader, "name", "type") uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[ - Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | OutputArraySchema - | OutputEnumSchema - | OutputRecordSchema - | str + CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str ] | str ] @@ -31057,7 +30818,7 @@ def __init__( "class", "None", ) -union_of_None_type_or_CWLVersionLoader: Final[_Loader[Literal["v1.2"] | None]] = ( +union_of_None_type_or_CWLVersionLoader: Final[_Loader[CWLVersion | None]] = ( _UnionLoader( ( None_type, @@ -31066,7 +30827,7 @@ def __init__( ) ) uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None: Final[ - _Loader[Literal["v1.2"] | None] + _Loader[CWLVersion | None] ] = _URILoader(union_of_None_type_or_CWLVersionLoader, False, True, None, None) union_of_None_type_or_array_of_strtype: Final[_Loader[None | Sequence[str]]] = ( _UnionLoader( @@ -31079,17 +30840,19 @@ def __init__( uri_union_of_None_type_or_array_of_strtype_True_False_None_None: Final[ _Loader[None | Sequence[str]] ] = _URILoader(union_of_None_type_or_array_of_strtype, True, False, None, None) +InlineJavascriptRequirement_class: TypeAlias = Literal["InlineJavascriptRequirement"] InlineJavascriptRequirement_classLoader: Final[ - _Loader[Literal["InlineJavascriptRequirement"]] + _Loader[InlineJavascriptRequirement_class] ] = _EnumLoader(("InlineJavascriptRequirement",), "InlineJavascriptRequirement_class") uri_InlineJavascriptRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["InlineJavascriptRequirement"]] + _Loader[InlineJavascriptRequirement_class] ] = _URILoader(InlineJavascriptRequirement_classLoader, False, True, None, None) -SchemaDefRequirement_classLoader: Final[_Loader[Literal["SchemaDefRequirement"]]] = ( +SchemaDefRequirement_class: TypeAlias = Literal["SchemaDefRequirement"] +SchemaDefRequirement_classLoader: Final[_Loader[SchemaDefRequirement_class]] = ( _EnumLoader(("SchemaDefRequirement",), "SchemaDefRequirement_class") ) uri_SchemaDefRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SchemaDefRequirement"]] + _Loader[SchemaDefRequirement_class] ] = _URILoader(SchemaDefRequirement_classLoader, False, True, None, None) union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader: Final[ _Loader[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema] @@ -31124,11 +30887,12 @@ def __init__( ExpressionLoader, ) ) -LoadListingRequirement_classLoader: Final[ - _Loader[Literal["LoadListingRequirement"]] -] = _EnumLoader(("LoadListingRequirement",), "LoadListingRequirement_class") +LoadListingRequirement_class: TypeAlias = Literal["LoadListingRequirement"] +LoadListingRequirement_classLoader: Final[_Loader[LoadListingRequirement_class]] = ( + _EnumLoader(("LoadListingRequirement",), "LoadListingRequirement_class") +) uri_LoadListingRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["LoadListingRequirement"]] + _Loader[LoadListingRequirement_class] ] = _URILoader(LoadListingRequirement_classLoader, False, True, None, None) union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( _UnionLoader( @@ -31165,20 +30929,10 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] = _UnionLoader( @@ -31193,20 +30947,10 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] @@ -31215,35 +30959,15 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -31260,35 +30984,15 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -31316,35 +31020,15 @@ def __init__( ) uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -31358,20 +31042,10 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] = _UnionLoader( @@ -31386,20 +31060,10 @@ def __init__( array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] ] @@ -31408,35 +31072,15 @@ def __init__( ) union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -31453,35 +31097,15 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -31517,35 +31141,15 @@ def __init__( ) uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] | str @@ -31559,38 +31163,18 @@ def __init__( ) union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stdin"] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stdin | str ] ] = _UnionLoader( @@ -31606,38 +31190,18 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stdin"] | Sequence[ - CommandInputArraySchema + CWLType + | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stdin | str ] ] = _TypeDSLLoader( @@ -31647,39 +31211,19 @@ def __init__( ) union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stderr"] - | Literal["stdout"] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stderr + | stdout | str ] ] = _UnionLoader( @@ -31696,39 +31240,19 @@ def __init__( ) typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2: Final[ _Loader[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] - | Literal["stderr"] - | Literal["stdout"] | Sequence[ - CommandOutputArraySchema + CWLType + | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] | str ] + | stderr + | stdout | str ] ] = _TypeDSLLoader( @@ -31736,11 +31260,12 @@ def __init__( 2, "v1.1", ) -CommandLineTool_classLoader: Final[_Loader[Literal["CommandLineTool"]]] = _EnumLoader( +CommandLineTool_class: TypeAlias = Literal["CommandLineTool"] +CommandLineTool_classLoader: Final[_Loader[CommandLineTool_class]] = _EnumLoader( ("CommandLineTool",), "CommandLineTool_class" ) uri_CommandLineTool_classLoader_False_True_None_None: Final[ - _Loader[Literal["CommandLineTool"]] + _Loader[CommandLineTool_class] ] = _URILoader(CommandLineTool_classLoader, False, True, None, None) array_of_CommandInputParameterLoader: Final[ _Loader[Sequence[CommandInputParameter]] @@ -31783,17 +31308,19 @@ def __init__( ) ) ) -DockerRequirement_classLoader: Final[_Loader[Literal["DockerRequirement"]]] = ( - _EnumLoader(("DockerRequirement",), "DockerRequirement_class") +DockerRequirement_class: TypeAlias = Literal["DockerRequirement"] +DockerRequirement_classLoader: Final[_Loader[DockerRequirement_class]] = _EnumLoader( + ("DockerRequirement",), "DockerRequirement_class" ) uri_DockerRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["DockerRequirement"]] + _Loader[DockerRequirement_class] ] = _URILoader(DockerRequirement_classLoader, False, True, None, None) -SoftwareRequirement_classLoader: Final[_Loader[Literal["SoftwareRequirement"]]] = ( +SoftwareRequirement_class: TypeAlias = Literal["SoftwareRequirement"] +SoftwareRequirement_classLoader: Final[_Loader[SoftwareRequirement_class]] = ( _EnumLoader(("SoftwareRequirement",), "SoftwareRequirement_class") ) uri_SoftwareRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SoftwareRequirement"]] + _Loader[SoftwareRequirement_class] ] = _URILoader(SoftwareRequirement_classLoader, False, True, None, None) array_of_SoftwarePackageLoader: Final[_Loader[Sequence[SoftwarePackage]]] = ( _ArrayLoader(SoftwarePackageLoader) @@ -31804,11 +31331,12 @@ def __init__( uri_union_of_None_type_or_array_of_strtype_False_False_None_True: Final[ _Loader[None | Sequence[str]] ] = _URILoader(union_of_None_type_or_array_of_strtype, False, False, None, True) +InitialWorkDirRequirement_class: TypeAlias = Literal["InitialWorkDirRequirement"] InitialWorkDirRequirement_classLoader: Final[ - _Loader[Literal["InitialWorkDirRequirement"]] + _Loader[InitialWorkDirRequirement_class] ] = _EnumLoader(("InitialWorkDirRequirement",), "InitialWorkDirRequirement_class") uri_InitialWorkDirRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["InitialWorkDirRequirement"]] + _Loader[InitialWorkDirRequirement_class] ] = _URILoader(InitialWorkDirRequirement_classLoader, False, True, None, None) union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader: Final[ _Loader[Directory | Dirent | File | None | Sequence[Directory | File] | str] @@ -31840,11 +31368,12 @@ def __init__( array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader, ) ) -EnvVarRequirement_classLoader: Final[_Loader[Literal["EnvVarRequirement"]]] = ( - _EnumLoader(("EnvVarRequirement",), "EnvVarRequirement_class") +EnvVarRequirement_class: TypeAlias = Literal["EnvVarRequirement"] +EnvVarRequirement_classLoader: Final[_Loader[EnvVarRequirement_class]] = _EnumLoader( + ("EnvVarRequirement",), "EnvVarRequirement_class" ) uri_EnvVarRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["EnvVarRequirement"]] + _Loader[EnvVarRequirement_class] ] = _URILoader(EnvVarRequirement_classLoader, False, True, None, None) array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = _ArrayLoader( EnvironmentDefLoader @@ -31852,17 +31381,19 @@ def __init__( idmap_envDef_array_of_EnvironmentDefLoader: Final[_Loader[Sequence[EnvironmentDef]]] = ( _IdMapLoader(array_of_EnvironmentDefLoader, "envName", "envValue") ) -ShellCommandRequirement_classLoader: Final[ - _Loader[Literal["ShellCommandRequirement"]] -] = _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +ShellCommandRequirement_class: TypeAlias = Literal["ShellCommandRequirement"] +ShellCommandRequirement_classLoader: Final[_Loader[ShellCommandRequirement_class]] = ( + _EnumLoader(("ShellCommandRequirement",), "ShellCommandRequirement_class") +) uri_ShellCommandRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ShellCommandRequirement"]] + _Loader[ShellCommandRequirement_class] ] = _URILoader(ShellCommandRequirement_classLoader, False, True, None, None) -ResourceRequirement_classLoader: Final[_Loader[Literal["ResourceRequirement"]]] = ( +ResourceRequirement_class: TypeAlias = Literal["ResourceRequirement"] +ResourceRequirement_classLoader: Final[_Loader[ResourceRequirement_class]] = ( _EnumLoader(("ResourceRequirement",), "ResourceRequirement_class") ) uri_ResourceRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ResourceRequirement"]] + _Loader[ResourceRequirement_class] ] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader: Final[ _Loader[None | float | i32 | str] @@ -31875,10 +31406,11 @@ def __init__( ExpressionLoader, ) ) -WorkReuse_classLoader: Final[_Loader[Literal["WorkReuse"]]] = _EnumLoader( +WorkReuse_class: TypeAlias = Literal["WorkReuse"] +WorkReuse_classLoader: Final[_Loader[WorkReuse_class]] = _EnumLoader( ("WorkReuse",), "WorkReuse_class" ) -uri_WorkReuse_classLoader_False_True_None_None: Final[_Loader[Literal["WorkReuse"]]] = ( +uri_WorkReuse_classLoader_False_True_None_None: Final[_Loader[WorkReuse_class]] = ( _URILoader(WorkReuse_classLoader, False, True, None, None) ) union_of_booltype_or_ExpressionLoader: Final[_Loader[bool | str]] = _UnionLoader( @@ -31887,23 +31419,26 @@ def __init__( ExpressionLoader, ) ) -NetworkAccess_classLoader: Final[_Loader[Literal["NetworkAccess"]]] = _EnumLoader( +NetworkAccess_class: TypeAlias = Literal["NetworkAccess"] +NetworkAccess_classLoader: Final[_Loader[NetworkAccess_class]] = _EnumLoader( ("NetworkAccess",), "NetworkAccess_class" ) uri_NetworkAccess_classLoader_False_True_None_None: Final[ - _Loader[Literal["NetworkAccess"]] + _Loader[NetworkAccess_class] ] = _URILoader(NetworkAccess_classLoader, False, True, None, None) -InplaceUpdateRequirement_classLoader: Final[ - _Loader[Literal["InplaceUpdateRequirement"]] -] = _EnumLoader(("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class") +InplaceUpdateRequirement_class: TypeAlias = Literal["InplaceUpdateRequirement"] +InplaceUpdateRequirement_classLoader: Final[_Loader[InplaceUpdateRequirement_class]] = ( + _EnumLoader(("InplaceUpdateRequirement",), "InplaceUpdateRequirement_class") +) uri_InplaceUpdateRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["InplaceUpdateRequirement"]] + _Loader[InplaceUpdateRequirement_class] ] = _URILoader(InplaceUpdateRequirement_classLoader, False, True, None, None) -ToolTimeLimit_classLoader: Final[_Loader[Literal["ToolTimeLimit"]]] = _EnumLoader( +ToolTimeLimit_class: TypeAlias = Literal["ToolTimeLimit"] +ToolTimeLimit_classLoader: Final[_Loader[ToolTimeLimit_class]] = _EnumLoader( ("ToolTimeLimit",), "ToolTimeLimit_class" ) uri_ToolTimeLimit_classLoader_False_True_None_None: Final[ - _Loader[Literal["ToolTimeLimit"]] + _Loader[ToolTimeLimit_class] ] = _URILoader(ToolTimeLimit_classLoader, False, True, None, None) union_of_inttype_or_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = ( _UnionLoader( @@ -31922,11 +31457,12 @@ def __init__( ) ) ) -ExpressionTool_classLoader: Final[_Loader[Literal["ExpressionTool"]]] = _EnumLoader( +ExpressionTool_class: TypeAlias = Literal["ExpressionTool"] +ExpressionTool_classLoader: Final[_Loader[ExpressionTool_class]] = _EnumLoader( ("ExpressionTool",), "ExpressionTool_class" ) uri_ExpressionTool_classLoader_False_True_None_None: Final[ - _Loader[Literal["ExpressionTool"]] + _Loader[ExpressionTool_class] ] = _URILoader(ExpressionTool_classLoader, False, True, None, None) array_of_WorkflowInputParameterLoader: Final[ _Loader[Sequence[WorkflowInputParameter]] @@ -31943,20 +31479,20 @@ def __init__( uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None: Final[ _Loader[None | Sequence[str] | str] ] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 1, None) -union_of_None_type_or_LinkMergeMethodLoader: Final[ - _Loader[Literal["merge_nested", "merge_flattened"] | None] -] = _UnionLoader( - ( - None_type, - LinkMergeMethodLoader, +union_of_None_type_or_LinkMergeMethodLoader: Final[_Loader[LinkMergeMethod | None]] = ( + _UnionLoader( + ( + None_type, + LinkMergeMethodLoader, + ) ) ) -union_of_None_type_or_PickValueMethodLoader: Final[ - _Loader[Literal["first_non_null", "the_only_non_null", "all_non_null"] | None] -] = _UnionLoader( - ( - None_type, - PickValueMethodLoader, +union_of_None_type_or_PickValueMethodLoader: Final[_Loader[None | PickValueMethod]] = ( + _UnionLoader( + ( + None_type, + PickValueMethodLoader, + ) ) ) uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None: Final[ @@ -32031,21 +31567,22 @@ def __init__( uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None: Final[ _Loader[None | Sequence[str] | str] ] = _URILoader(union_of_None_type_or_strtype_or_array_of_strtype, False, False, 0, None) -union_of_None_type_or_ScatterMethodLoader: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] -] = _UnionLoader( - ( - None_type, - ScatterMethodLoader, +union_of_None_type_or_ScatterMethodLoader: Final[_Loader[None | ScatterMethod]] = ( + _UnionLoader( + ( + None_type, + ScatterMethodLoader, + ) ) ) uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None: Final[ - _Loader[Literal["dotproduct", "nested_crossproduct", "flat_crossproduct"] | None] + _Loader[None | ScatterMethod] ] = _URILoader(union_of_None_type_or_ScatterMethodLoader, False, True, None, None) -Workflow_classLoader: Final[_Loader[Literal["Workflow"]]] = _EnumLoader( +Workflow_class: TypeAlias = Literal["Workflow"] +Workflow_classLoader: Final[_Loader[Workflow_class]] = _EnumLoader( ("Workflow",), "Workflow_class" ) -uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Literal["Workflow"]]] = ( +uri_Workflow_classLoader_False_True_None_None: Final[_Loader[Workflow_class]] = ( _URILoader(Workflow_classLoader, False, True, None, None) ) array_of_WorkflowOutputParameterLoader: Final[ @@ -32063,40 +31600,51 @@ def __init__( idmap_steps_union_of_array_of_WorkflowStepLoader: Final[ _Loader[Sequence[WorkflowStep]] ] = _IdMapLoader(union_of_array_of_WorkflowStepLoader, "id", "None") +SubworkflowFeatureRequirement_class: TypeAlias = Literal[ + "SubworkflowFeatureRequirement" +] SubworkflowFeatureRequirement_classLoader: Final[ - _Loader[Literal["SubworkflowFeatureRequirement"]] + _Loader[SubworkflowFeatureRequirement_class] ] = _EnumLoader( ("SubworkflowFeatureRequirement",), "SubworkflowFeatureRequirement_class" ) uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["SubworkflowFeatureRequirement"]] + _Loader[SubworkflowFeatureRequirement_class] ] = _URILoader(SubworkflowFeatureRequirement_classLoader, False, True, None, None) +ScatterFeatureRequirement_class: TypeAlias = Literal["ScatterFeatureRequirement"] ScatterFeatureRequirement_classLoader: Final[ - _Loader[Literal["ScatterFeatureRequirement"]] + _Loader[ScatterFeatureRequirement_class] ] = _EnumLoader(("ScatterFeatureRequirement",), "ScatterFeatureRequirement_class") uri_ScatterFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["ScatterFeatureRequirement"]] + _Loader[ScatterFeatureRequirement_class] ] = _URILoader(ScatterFeatureRequirement_classLoader, False, True, None, None) +MultipleInputFeatureRequirement_class: TypeAlias = Literal[ + "MultipleInputFeatureRequirement" +] MultipleInputFeatureRequirement_classLoader: Final[ - _Loader[Literal["MultipleInputFeatureRequirement"]] + _Loader[MultipleInputFeatureRequirement_class] ] = _EnumLoader( ("MultipleInputFeatureRequirement",), "MultipleInputFeatureRequirement_class" ) uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["MultipleInputFeatureRequirement"]] + _Loader[MultipleInputFeatureRequirement_class] ] = _URILoader(MultipleInputFeatureRequirement_classLoader, False, True, None, None) +StepInputExpressionRequirement_class: TypeAlias = Literal[ + "StepInputExpressionRequirement" +] StepInputExpressionRequirement_classLoader: Final[ - _Loader[Literal["StepInputExpressionRequirement"]] + _Loader[StepInputExpressionRequirement_class] ] = _EnumLoader( ("StepInputExpressionRequirement",), "StepInputExpressionRequirement_class" ) uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ - _Loader[Literal["StepInputExpressionRequirement"]] + _Loader[StepInputExpressionRequirement_class] ] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) -Operation_classLoader: Final[_Loader[Literal["Operation"]]] = _EnumLoader( +Operation_class: TypeAlias = Literal["Operation"] +Operation_classLoader: Final[_Loader[Operation_class]] = _EnumLoader( ("Operation",), "Operation_class" ) -uri_Operation_classLoader_False_True_None_None: Final[_Loader[Literal["Operation"]]] = ( +uri_Operation_classLoader_False_True_None_None: Final[_Loader[Operation_class]] = ( _URILoader(Operation_classLoader, False, True, None, None) ) array_of_OperationInputParameterLoader: Final[ @@ -32143,7 +31691,8 @@ def __init__( idmap_loop_array_of_LoopInputLoader: Final[_Loader[Sequence[LoopInput]]] = _IdMapLoader( array_of_LoopInputLoader, "id", "loopSource" ) -LoopOutputModesLoader: Final[_Loader[Literal["last", "all"]]] = _EnumLoader( +LoopOutputModes: TypeAlias = Literal["last", "all"] +LoopOutputModesLoader: Final[_Loader[LoopOutputModes]] = _EnumLoader( ( "last", "all", diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 1e42a706..da9835ba 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -5,7 +5,7 @@ from collections.abc import Mapping, MutableMapping, MutableSequence, Sequence from io import StringIO from pathlib import Path -from typing import IO, Any, Literal, TypeAlias, TypeVar, cast +from typing import IO, Any, TypeAlias, TypeVar, cast from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -25,90 +25,35 @@ SrcSink = namedtuple("SrcSink", ["src", "sink", "linkMerge", "message"]) -BasicInputTypeSchemas: TypeAlias = ( - cwl.InputArraySchema - | cwl.InputEnumSchema - | cwl.InputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] -) +BasicInputTypeSchemas: TypeAlias = cwl.InputSchema | str | cwl.CWLType InputTypeSchemas: TypeAlias = ( - BasicInputTypeSchemas | Literal["stdin"] | Sequence[BasicInputTypeSchemas] + BasicInputTypeSchemas | cwl.stdin | Sequence[BasicInputTypeSchemas] ) BasicCommandInputTypeSchemas: TypeAlias = ( cwl.CommandInputArraySchema | cwl.CommandInputEnumSchema | cwl.CommandInputRecordSchema | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + | cwl.CWLType ) CommandInputTypeSchemas: TypeAlias = ( - BasicCommandInputTypeSchemas - | Literal["stdin"] - | Sequence[BasicCommandInputTypeSchemas] -) -BasicOutputTypeSchemas: TypeAlias = ( - cwl.OutputArraySchema - | cwl.OutputEnumSchema - | cwl.OutputRecordSchema - | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + BasicCommandInputTypeSchemas | cwl.stdin | Sequence[BasicCommandInputTypeSchemas] ) +BasicOutputTypeSchemas: TypeAlias = cwl.OutputSchema | str | cwl.CWLType OutputTypeSchemas: TypeAlias = ( - BasicOutputTypeSchemas - | Literal["stderr", "stdout"] - | Sequence[BasicOutputTypeSchemas] + BasicOutputTypeSchemas | cwl.stderr | cwl.stdout | Sequence[BasicOutputTypeSchemas] ) BasicCommandOutputTypeSchemas: TypeAlias = ( cwl.CommandOutputArraySchema | cwl.CommandOutputEnumSchema | cwl.CommandOutputRecordSchema | str - | Literal[ - "null", - "boolean", - "int", - "long", - "float", - "double", - "string", - "File", - "Directory", - ] + | cwl.CWLType ) CommandOutputTypeSchemas: TypeAlias = ( BasicCommandOutputTypeSchemas - | Literal["stderr", "stdout"] + | cwl.stderr + | cwl.stdout | Sequence[BasicCommandOutputTypeSchemas] ) AnyTypeSchema = TypeVar( diff --git a/src/cwl_utils/parser/utils.py b/src/cwl_utils/parser/utils.py index 69b93a37..009e411a 100644 --- a/src/cwl_utils/parser/utils.py +++ b/src/cwl_utils/parser/utils.py @@ -37,6 +37,7 @@ OutputArraySchema, InputArraySchema, ) +from ..types import is_sequence _logger = logging.getLogger("cwl_utils") @@ -189,7 +190,7 @@ def static_checker(workflow: Workflow) -> None: """Check if all source and sink types of a workflow are compatible before run time.""" step_inputs: Final[MutableSequence[WorkflowStepInput]] = [] step_outputs = [] - type_dict = {} + type_dict: dict[str, InputTypeSchemas | OutputTypeSchemas | None] = {} param_to_step: Final[MutableMapping[str, WorkflowStep]] = {} for step in workflow.steps: if step.in_ is not None: @@ -347,12 +348,10 @@ def static_checker(workflow: Workflow) -> None: exception_msgs.append(msg) for sink in step_inputs: + sink_type = type_dict[sink.id] if ( - "null" != type_dict[sink.id] - and not ( - isinstance(type_dict[sink.id], MutableSequence) - and "null" in type_dict[sink.id] - ) + "null" != sink_type + and not (is_sequence(sink_type) and "null" in sink_type) and getattr(sink, "source", None) is None and getattr(sink, "default", None) is None and getattr(sink, "valueFrom", None) is None diff --git a/src/cwl_utils/utils.py b/src/cwl_utils/utils.py index 57dc8c9f..926bb9c2 100644 --- a/src/cwl_utils/utils.py +++ b/src/cwl_utils/utils.py @@ -421,16 +421,7 @@ def sanitise_schema_field( schema_field_item["type"] = InputArraySchemaV1_2( type_="array", items=cast( - str - | cwl_v1_2.InputArraySchema - | cwl_v1_2.InputEnumSchema - | cwl_v1_2.InputRecordSchema - | Sequence[ - str - | cwl_v1_2.InputArraySchema - | cwl_v1_2.InputEnumSchema - | cwl_v1_2.InputRecordSchema, - ], + str | cwl_v1_2.InputSchema | Sequence[str | cwl_v1_2.InputSchema], rest.get("items", ""), ), ) From b0a0b2d83fa7f96ba9e3dc2ec2689951605bb7c3 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Sun, 5 Apr 2026 23:47:57 +0200 Subject: [PATCH 21/23] Simplify union types --- src/cwl_utils/cwl_v1_0_expression_refactor.py | 8 +----- src/cwl_utils/cwl_v1_1_expression_refactor.py | 8 +----- src/cwl_utils/cwl_v1_2_expression_refactor.py | 10 +------ src/cwl_utils/parser/__init__.py | 11 ++++++-- src/cwl_utils/parser/cwl_v1_0_utils.py | 25 +++--------------- src/cwl_utils/parser/cwl_v1_1_utils.py | 25 +++--------------- src/cwl_utils/parser/cwl_v1_2_utils.py | 25 +++--------------- src/cwl_utils/parser/utils.py | 26 +++---------------- 8 files changed, 27 insertions(+), 111 deletions(-) diff --git a/src/cwl_utils/cwl_v1_0_expression_refactor.py b/src/cwl_utils/cwl_v1_0_expression_refactor.py index 4b1eeaf4..8ec09e14 100755 --- a/src/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_0_expression_refactor.py @@ -301,13 +301,7 @@ def plain_output_type_to_clt_output_type( def parameter_to_plain_input_paramater( - parameter: ( - cwl.InputParameter - | cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.WorkflowOutputParameter - ), + parameter: cwl.InputParameter | cwl.OutputParameter, ) -> cwl.InputParameter: return cwl.InputParameter.fromDoc( parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions diff --git a/src/cwl_utils/cwl_v1_1_expression_refactor.py b/src/cwl_utils/cwl_v1_1_expression_refactor.py index 0e077ab9..a3a25326 100755 --- a/src/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_1_expression_refactor.py @@ -295,13 +295,7 @@ def plain_output_type_to_clt_output_type( def parameter_to_workflow_input_paramater( - parameter: ( - cwl.WorkflowInputParameter - | cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.WorkflowOutputParameter - ), + parameter: cwl.InputParameter | cwl.OutputParameter, ) -> cwl.WorkflowInputParameter: return cwl.WorkflowInputParameter.fromDoc( parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions diff --git a/src/cwl_utils/cwl_v1_2_expression_refactor.py b/src/cwl_utils/cwl_v1_2_expression_refactor.py index f4a5a195..634705b4 100755 --- a/src/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_2_expression_refactor.py @@ -335,15 +335,7 @@ def plain_output_type_to_clt_output_type( def parameter_to_workflow_input_paramater( - parameter: ( - cwl.WorkflowInputParameter - | cwl.CommandInputParameter - | cwl.CommandOutputParameter - | cwl.ExpressionToolOutputParameter - | cwl.WorkflowOutputParameter - | cwl.OperationOutputParameter - | cwl.OperationInputParameter - ), + parameter: cwl.InputParameter | cwl.OutputParameter, ) -> cwl.WorkflowInputParameter: return cwl.WorkflowInputParameter.fromDoc( parameter.save(), parameter.loadingOptions.baseuri, parameter.loadingOptions diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index a26797a7..a89db222 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -25,7 +25,10 @@ class NoType(ABC): Saveable: TypeAlias = cwl_v1_0.Saveable | cwl_v1_1.Saveable | cwl_v1_2.Saveable """Type union for a CWL v1.x Saveable object.""" InputParameter: TypeAlias = ( - cwl_v1_0.InputParameter | cwl_v1_1.InputParameter | cwl_v1_2.InputParameter + cwl_v1_0.InputParameter + | cwl_v1_0.CommandInputParameter + | cwl_v1_1.InputParameter + | cwl_v1_2.InputParameter ) """Type union for a CWL v1.x InputEnumSchema object.""" InputRecordField: TypeAlias = ( @@ -37,7 +40,11 @@ class NoType(ABC): ) """Type union for a CWL v1.x InputSchema object.""" OutputParameter: TypeAlias = ( - cwl_v1_0.OutputParameter | cwl_v1_1.OutputParameter | cwl_v1_2.OutputParameter + cwl_v1_0.CommandOutputParameter + | cwl_v1_0.ExpressionToolOutputParameter + | cwl_v1_0.WorkflowOutputParameter + | cwl_v1_1.OutputParameter + | cwl_v1_2.OutputParameter ) """Type union for a CWL v1.x OutputParameter object.""" OutputArraySchema: TypeAlias = ( diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index b9770844..dcec5596 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -601,34 +601,17 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter + | cwl_utils.parser.OutputParameter | MutableSequence[ - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index 6a56e9e8..44f73639 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -623,34 +623,17 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter + | cwl_utils.parser.OutputParameter | MutableSequence[ - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index da9835ba..49fc1ab6 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -721,34 +721,17 @@ def param_for_source_id( parent: cwl.Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter + | cwl_utils.parser.OutputParameter | MutableSequence[ - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] ): """Find the process input parameter that matches one of the given sourcenames.""" if isinstance(sourcenames, str): sourcenames = [sourcenames] params: MutableSequence[ - cwl_utils.parser.CommandInputParameter - | cwl_utils.parser.CommandOutputParameter - | cwl_utils.parser.ExpressionToolOutputParameter - | cwl_utils.parser.OperationInputParameter - | cwl_utils.parser.OperationOutputParameter - | cwl_utils.parser.WorkflowInputParameter - | cwl_utils.parser.WorkflowOutputParameter + cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter ] = [] for sourcename in sourcenames: if not isinstance(process, cwl.Workflow): diff --git a/src/cwl_utils/parser/utils.py b/src/cwl_utils/parser/utils.py index 009e411a..0261dfbe 100644 --- a/src/cwl_utils/parser/utils.py +++ b/src/cwl_utils/parser/utils.py @@ -27,15 +27,10 @@ cwl_v1_2, cwl_v1_2_utils, load_document_by_uri, - CommandInputParameter, - CommandOutputParameter, - ExpressionToolOutputParameter, - OperationInputParameter, - OperationOutputParameter, - WorkflowInputParameter, - WorkflowOutputParameter, OutputArraySchema, InputArraySchema, + OutputParameter, + InputParameter, ) from ..types import is_sequence @@ -530,22 +525,7 @@ def param_for_source_id( parent: Workflow | None = None, scatter_context: list[tuple[int, str] | None] | None = None, ) -> ( - CommandInputParameter - | CommandOutputParameter - | ExpressionToolOutputParameter - | OperationInputParameter - | OperationOutputParameter - | WorkflowInputParameter - | WorkflowOutputParameter - | MutableSequence[ - CommandInputParameter - | CommandOutputParameter - | ExpressionToolOutputParameter - | OperationInputParameter - | OperationOutputParameter - | WorkflowInputParameter - | WorkflowOutputParameter - ] + InputParameter | OutputParameter | MutableSequence[InputParameter | OutputParameter] ): match process.cwlVersion: case "v1.0": From fda9ab2888fc59f294f4368654b9f0e989a95b9f Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Tue, 7 Apr 2026 14:35:24 +0200 Subject: [PATCH 22/23] Moved out version-independent functions --- src/cwl_utils/parser/__init__.py | 20 +- src/cwl_utils/parser/cwl_v1_0_utils.py | 128 ++---------- src/cwl_utils/parser/cwl_v1_1_utils.py | 128 ++---------- src/cwl_utils/parser/cwl_v1_2_utils.py | 129 ++----------- src/cwl_utils/parser/utils.py | 257 ++++++++++++++++++++++--- 5 files changed, 288 insertions(+), 374 deletions(-) diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index a89db222..dff3cdb3 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -25,16 +25,13 @@ class NoType(ABC): Saveable: TypeAlias = cwl_v1_0.Saveable | cwl_v1_1.Saveable | cwl_v1_2.Saveable """Type union for a CWL v1.x Saveable object.""" InputParameter: TypeAlias = ( - cwl_v1_0.InputParameter - | cwl_v1_0.CommandInputParameter - | cwl_v1_1.InputParameter - | cwl_v1_2.InputParameter + cwl_v1_0.InputParameter | cwl_v1_1.InputParameter | cwl_v1_2.InputParameter ) """Type union for a CWL v1.x InputEnumSchema object.""" InputRecordField: TypeAlias = ( cwl_v1_0.InputRecordField | cwl_v1_1.InputRecordField | cwl_v1_2.InputRecordField ) -"""Type union for a CWL v1.x InputRecordSchema object.""" +"""Type union for a CWL v1.x InputRecordField object.""" InputSchema: TypeAlias = ( cwl_v1_0.InputSchema | cwl_v1_1.InputSchema | cwl_v1_2.InputSchema ) @@ -166,6 +163,17 @@ class NoType(ABC): | cwl_v1_2.CommandOutputRecordField ) """Type union for a CWL v1.x CommandOutputRecordField object.""" +CommandOutputRecordSchema: TypeAlias = ( + cwl_v1_0.CommandOutputRecordSchema + | cwl_v1_1.CommandOutputRecordSchema + | cwl_v1_2.CommandOutputRecordSchema +) +CommandOutputRecordSchemaTypes = ( + cwl_v1_0.CommandOutputRecordSchema, + cwl_v1_1.CommandOutputRecordSchema, + cwl_v1_2.CommandOutputRecordSchema, +) +"""Type Union for a CWL v1.x CommandOutputRecordSchema object.""" ExpressionTool: TypeAlias = ( cwl_v1_0.ExpressionTool | cwl_v1_1.ExpressionTool | cwl_v1_2.ExpressionTool ) @@ -242,7 +250,7 @@ class NoType(ABC): cwl_v1_1.InputRecordSchema, cwl_v1_2.InputRecordSchema, ) -"""Type Union for a CWL v1.x RecordSchema object.""" +"""Type Union for a CWL v1.x InputRecordSchema object.""" File: TypeAlias = cwl_v1_0.File | cwl_v1_1.File | cwl_v1_2.File """Type Union for a CWL v1.x File object.""" diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index dcec5596..ec33287e 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -2,10 +2,10 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence, Sequence +from collections.abc import MutableMapping, MutableSequence, Sequence, Mapping from io import StringIO from pathlib import Path -from typing import IO, Any, TypeAlias, TypeVar, cast +from typing import IO, Any, TypeAlias, TypeVar from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -100,39 +100,6 @@ def in_output_type_schema_to_output_type_schema( return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) -def _compare_records( - src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False -) -> bool: - """ - Compare two records, ensuring they have compatible fields. - - This handles normalizing record names, which will be relative to workflow - step, so that they can be compared. - """ - srcfields = {cwl.shortname(field.name): field.type_ for field in (src.fields or {})} - sinkfields = { - cwl.shortname(field.name): field.type_ for field in (sink.fields or {}) - } - for key in sinkfields.keys(): - if ( - not can_assign_src_to_sink( - srcfields.get(key, "null"), sinkfields.get(key, "null"), strict - ) - and sinkfields.get(key) is not None - ): - _logger.info( - "Record comparison failure for %s and %s\n" - "Did not match fields for %s: %s and %s", - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, src).name, - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, sink).name, - key, - srcfields.get(key), - sinkfields.get(key), - ) - return False - return True - - def _compare_type(type1: Any, type2: Any) -> bool: match (type1, type1): case cwl.ArraySchema() as t1, cwl.ArraySchema() as t2: @@ -219,45 +186,15 @@ def _inputfile_load( ) -def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: - """ - Check for identical type specifications, ignoring extra keys like inputBinding. - - src: admissible source types - sink: admissible sink types - - In non-strict comparison, at least one source type must match one sink type, - except for 'null'. - In strict comparison, all source types must match at least one sink type. - """ - if "Any" in (src, sink): - return True - if isinstance(src, cwl.ArraySchema) and isinstance(sink, cwl.ArraySchema): - return can_assign_src_to_sink(src.items, sink.items, strict) - if isinstance(src, cwl.RecordSchema) and isinstance(sink, cwl.RecordSchema): - return _compare_records(src, sink, strict) - if isinstance(src, MutableSequence): - if strict: - for this_src in src: - if not can_assign_src_to_sink(this_src, sink): - return False - return True - for this_src in src: - if this_src != "null" and can_assign_src_to_sink(this_src, sink): - return True - return False - if isinstance(sink, MutableSequence): - for this_sink in sink: - if can_assign_src_to_sink(src, this_sink): - return True - return False - return bool(src == sink) - - def check_all_types( - src_dict: dict[str, Any], + src_dict: Mapping[str, cwl.InputParameter | cwl.WorkflowStepOutput], sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], - type_dict: dict[str, Any], + type_dict: Mapping[ + str, + cwl_utils.parser.utils.InputTypeSchemas + | cwl_utils.parser.utils.OutputTypeSchemas + | None, + ], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" validation: dict[str, list[SrcSink]] = {"warning": [], "exception": []} @@ -288,45 +225,17 @@ def check_all_types( srcs_of_sink = [src_dict[parm_id]] linkMerge = None for src in srcs_of_sink: - check_result = check_types( - type_dict[cast(str, src.id)], + check_result = cwl_utils.parser.utils.check_types( + type_dict[src.id], type_dict[sink.id], linkMerge, - getattr(sink, "valueFrom", None), + sink.valueFrom if isinstance(sink, cwl.WorkflowStepInput) else None, ) if check_result in ("warning", "exception"): validation[check_result].append(SrcSink(src, sink, linkMerge, None)) return validation -def check_types( - srctype: Any, - sinktype: Any, - linkMerge: str | None, - valueFrom: str | None = None, -) -> str: - """ - Check if the source and sink types are correct. - - Acceptable types are "pass", "warning", or "exception". - """ - if valueFrom is not None: - return "pass" - if linkMerge is None: - if can_assign_src_to_sink(srctype, sinktype, strict=True): - return "pass" - if can_assign_src_to_sink(srctype, sinktype, strict=False): - return "warning" - return "exception" - if linkMerge == "merge_nested": - return check_types( - cwl.ArraySchema(items=srctype, type_="array"), sinktype, None, None - ) - if linkMerge == "merge_flattened": - return check_types(merge_flatten_type(srctype), sinktype, None, None) - raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.") - - def content_limit_respected_read_bytes(f: IO[bytes]) -> bytes: """ Read file content up to 64 kB as a byte array. @@ -430,15 +339,6 @@ def load_inputfile_by_yaml( return result -def merge_flatten_type(src: Any) -> Any: - """Return the merge flattened type of the source type.""" - if isinstance(src, MutableSequence): - return [merge_flatten_type(t) for t in src] - if isinstance(src, cwl.ArraySchema): - return src - return cwl.ArraySchema(type_="array", items=src) - - def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: return cwl.InputArraySchema(type_="array", items=type_) @@ -542,7 +442,7 @@ def type_for_source( type_="array", ) elif linkMerge == "merge_flattened": - new_type = merge_flatten_type(new_type) + new_type = cwl_utils.parser.utils.merge_flatten_type(new_type) return new_type new_types: MutableSequence[InputTypeSchemas | OutputTypeSchemas] = [] for p, sc in zip(params, scatter_context): @@ -586,7 +486,7 @@ def type_for_source( type_="array", ) elif linkMerge == "merge_flattened": - final_type = merge_flatten_type(final_type) + final_type = cwl_utils.parser.utils.merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: return cwl.OutputArraySchema( items=final_type, diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index 44f73639..c64bb9ec 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -2,10 +2,10 @@ import hashlib import logging from collections import namedtuple -from collections.abc import MutableMapping, MutableSequence, Sequence +from collections.abc import MutableMapping, MutableSequence, Sequence, Mapping from io import StringIO from pathlib import Path -from typing import IO, Any, TypeAlias, TypeVar, cast +from typing import IO, Any, TypeAlias, TypeVar from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException @@ -107,39 +107,6 @@ def in_output_type_schema_to_output_type_schema( return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) -def _compare_records( - src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False -) -> bool: - """ - Compare two records, ensuring they have compatible fields. - - This handles normalizing record names, which will be relative to workflow - step, so that they can be compared. - """ - srcfields = {cwl.shortname(field.name): field.type_ for field in (src.fields or {})} - sinkfields = { - cwl.shortname(field.name): field.type_ for field in (sink.fields or {}) - } - for key in sinkfields.keys(): - if ( - not can_assign_src_to_sink( - srcfields.get(key, "null"), sinkfields.get(key, "null"), strict - ) - and sinkfields.get(key) is not None - ): - _logger.info( - "Record comparison failure for %s and %s\n" - "Did not match fields for %s: %s and %s", - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, src).name, - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, sink).name, - key, - srcfields.get(key), - sinkfields.get(key), - ) - return False - return True - - def _compare_type(type1: Any, type2: Any) -> bool: match (type1, type1): case cwl.ArraySchema() as t1, cwl.ArraySchema() as t2: @@ -226,45 +193,15 @@ def _inputfile_load( ) -def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: - """ - Check for identical type specifications, ignoring extra keys like inputBinding. - - src: admissible source types - sink: admissible sink types - - In non-strict comparison, at least one source type must match one sink type, - except for 'null'. - In strict comparison, all source types must match at least one sink type. - """ - if "Any" in (src, sink): - return True - if isinstance(src, cwl.ArraySchema) and isinstance(sink, cwl.ArraySchema): - return can_assign_src_to_sink(src.items, sink.items, strict) - if isinstance(src, cwl.RecordSchema) and isinstance(sink, cwl.RecordSchema): - return _compare_records(src, sink, strict) - if isinstance(src, MutableSequence): - if strict: - for this_src in src: - if not can_assign_src_to_sink(this_src, sink): - return False - return True - for this_src in src: - if this_src != "null" and can_assign_src_to_sink(this_src, sink): - return True - return False - if isinstance(sink, MutableSequence): - for this_sink in sink: - if can_assign_src_to_sink(src, this_sink): - return True - return False - return bool(src == sink) - - def check_all_types( - src_dict: dict[str, Any], + src_dict: Mapping[str, cwl.WorkflowInputParameter | cwl.WorkflowStepOutput], sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], - type_dict: dict[str, Any], + type_dict: Mapping[ + str, + cwl_utils.parser.utils.InputTypeSchemas + | cwl_utils.parser.utils.OutputTypeSchemas + | None, + ], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" validation: dict[str, list[SrcSink]] = {"warning": [], "exception": []} @@ -295,45 +232,17 @@ def check_all_types( srcs_of_sink = [src_dict[parm_id]] linkMerge = None for src in srcs_of_sink: - check_result = check_types( - type_dict[cast(str, src.id)], + check_result = cwl_utils.parser.utils.check_types( + type_dict[src.id], type_dict[sink.id], linkMerge, - getattr(sink, "valueFrom", None), + sink.valueFrom if isinstance(sink, cwl.WorkflowStepInput) else None, ) if check_result in ("warning", "exception"): validation[check_result].append(SrcSink(src, sink, linkMerge, None)) return validation -def check_types( - srctype: Any, - sinktype: Any, - linkMerge: str | None, - valueFrom: str | None = None, -) -> str: - """ - Check if the source and sink types are correct. - - Acceptable types are "pass", "warning", or "exception". - """ - if valueFrom is not None: - return "pass" - if linkMerge is None: - if can_assign_src_to_sink(srctype, sinktype, strict=True): - return "pass" - if can_assign_src_to_sink(srctype, sinktype, strict=False): - return "warning" - return "exception" - if linkMerge == "merge_nested": - return check_types( - cwl.ArraySchema(items=srctype, type_="array"), sinktype, None, None - ) - if linkMerge == "merge_flattened": - return check_types(merge_flatten_type(srctype), sinktype, None, None) - raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.") - - def content_limit_respected_read_bytes(f: IO[bytes]) -> bytes: """ Read file content up to 64 kB as a byte array. @@ -452,15 +361,6 @@ def load_inputfile_by_yaml( return result -def merge_flatten_type(src: Any) -> Any: - """Return the merge flattened type of the source type.""" - if isinstance(src, MutableSequence): - return [merge_flatten_type(t) for t in src] - if isinstance(src, cwl.ArraySchema): - return src - return cwl.ArraySchema(type_="array", items=src) - - def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: return cwl.InputArraySchema(type_="array", items=type_) @@ -564,7 +464,7 @@ def type_for_source( type_="array", ) elif linkMerge == "merge_flattened": - new_type = merge_flatten_type(new_type) + new_type = cwl_utils.parser.utils.merge_flatten_type(new_type) return new_type new_types: MutableSequence[InputTypeSchemas | OutputTypeSchemas] = [] for p, sc in zip(params, scatter_context): @@ -608,7 +508,7 @@ def type_for_source( type_="array", ) elif linkMerge == "merge_flattened": - final_type = merge_flatten_type(final_type) + final_type = cwl_utils.parser.utils.merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: return cwl.OutputArraySchema( items=final_type, diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 49fc1ab6..7d973ef4 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -107,39 +107,6 @@ def in_output_type_schema_to_output_type_schema( return _in_output_type_schema_to_output_type_schema(schema_type, loading_options) -def _compare_records( - src: cwl.RecordSchema, sink: cwl.RecordSchema, strict: bool = False -) -> bool: - """ - Compare two records, ensuring they have compatible fields. - - This handles normalizing record names, which will be relative to workflow - step, so that they can be compared. - """ - srcfields = {cwl.shortname(field.name): field.type_ for field in (src.fields or {})} - sinkfields = { - cwl.shortname(field.name): field.type_ for field in (sink.fields or {}) - } - for key in sinkfields.keys(): - if ( - not can_assign_src_to_sink( - srcfields.get(key, "null"), sinkfields.get(key, "null"), strict - ) - and sinkfields.get(key) is not None - ): - _logger.info( - "Record comparison failure for %s and %s\n" - "Did not match fields for %s: %s and %s", - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, src).name, - cast(cwl.InputRecordSchema | cwl.CommandOutputRecordSchema, sink).name, - key, - srcfields.get(key), - sinkfields.get(key), - ) - return False - return True - - def _compare_type(type1: Any, type2: Any) -> bool: match (type1, type1): case cwl.ArraySchema() as t1, cwl.ArraySchema() as t2: @@ -245,46 +212,16 @@ def _inputfile_load( ) -def can_assign_src_to_sink(src: Any, sink: Any, strict: bool = False) -> bool: - """ - Check for identical type specifications, ignoring extra keys like inputBinding. - - src: admissible source types - sink: admissible sink types - - In non-strict comparison, at least one source type must match one sink type, - except for 'null'. - In strict comparison, all source types must match at least one sink type. - """ - if "Any" in (src, sink): - return True - if isinstance(src, cwl.ArraySchema) and isinstance(sink, cwl.ArraySchema): - return can_assign_src_to_sink(src.items, sink.items, strict) - if isinstance(src, cwl.RecordSchema) and isinstance(sink, cwl.RecordSchema): - return _compare_records(src, sink, strict) - if isinstance(src, MutableSequence): - if strict: - for this_src in src: - if not can_assign_src_to_sink(this_src, sink): - return False - return True - for this_src in src: - if this_src != "null" and can_assign_src_to_sink(this_src, sink): - return True - return False - if isinstance(sink, MutableSequence): - for this_sink in sink: - if can_assign_src_to_sink(src, this_sink): - return True - return False - return bool(src == sink) - - def check_all_types( - src_dict: dict[str, Any], + src_dict: Mapping[str, cwl.WorkflowInputParameter | cwl.WorkflowStepOutput], sinks: Sequence[cwl.WorkflowStepInput | cwl.WorkflowOutputParameter], param_to_step: Mapping[str, cwl.WorkflowStep], - type_dict: dict[str, Any], + type_dict: MutableMapping[ + str, + cwl_utils.parser.utils.InputTypeSchemas + | cwl_utils.parser.utils.OutputTypeSchemas + | None, + ], ) -> dict[str, list[SrcSink]]: """Given a list of sinks, check if their types match with the types of their sources.""" validation: dict[str, list[SrcSink]] = {"warning": [], "exception": []} @@ -372,11 +309,11 @@ def check_all_types( items=src_typ, type_="array" ) for src in srcs_of_sink: - check_result = check_types( - type_dict[cast(str, src.id)], + check_result = cwl_utils.parser.utils.check_types( + type_dict[src.id], sink_type, linkMerge, - getattr(sink, "valueFrom", None), + sink.valueFrom if isinstance(sink, cwl.WorkflowStepInput) else None, ) if check_result in ("warning", "exception"): validation[check_result].append( @@ -385,39 +322,6 @@ def check_all_types( return validation -def check_types( - srctype: Any, - sinktype: Any, - linkMerge: str | None, - valueFrom: str | None = None, -) -> str: - """ - Check if the source and sink types are correct. - - Acceptable types are "pass", "warning", or "exception". - """ - if valueFrom is not None: - return "pass" - match linkMerge: - case None: - if can_assign_src_to_sink(srctype, sinktype, strict=True): - return "pass" - if can_assign_src_to_sink(srctype, sinktype, strict=False): - return "warning" - return "exception" - case "merge_nested": - return check_types( - cwl.ArraySchema(items=srctype, type_="array"), - sinktype, - None, - None, - ) - case "merge_flattened": - return check_types(merge_flatten_type(srctype), sinktype, None, None) - case _: - raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.") - - def content_limit_respected_read_bytes(f: IO[bytes]) -> bytes: """ Read file content up to 64 kB as a byte array. @@ -541,15 +445,6 @@ def load_inputfile_by_yaml( return result -def merge_flatten_type(src: Any) -> Any: - """Return the merge flattened type of the source type.""" - if isinstance(src, MutableSequence): - return [merge_flatten_type(t) for t in src] - if isinstance(src, cwl.ArraySchema): - return src - return cwl.ArraySchema(type_="array", items=src) - - def to_input_array(type_: InputTypeSchemas) -> cwl.InputArraySchema: return cwl.InputArraySchema(type_="array", items=type_) @@ -654,7 +549,7 @@ def type_for_source( type_="array", ) elif linkMerge == "merge_flattened": - new_type = merge_flatten_type(new_type) + new_type = cwl_utils.parser.utils.merge_flatten_type(new_type) if pickValue is not None: if isinstance(new_type, cwl.ArraySchema): if pickValue in ("first_non_null", "the_only_non_null"): @@ -702,7 +597,7 @@ def type_for_source( type_="array", ) elif linkMerge == "merge_flattened": - final_type = merge_flatten_type(final_type) + final_type = cwl_utils.parser.utils.merge_flatten_type(final_type) elif isinstance(sourcenames, list) and len(sourcenames) > 1: final_type = cwl.OutputArraySchema( items=final_type, diff --git a/src/cwl_utils/parser/utils.py b/src/cwl_utils/parser/utils.py index 0261dfbe..10b180bb 100644 --- a/src/cwl_utils/parser/utils.py +++ b/src/cwl_utils/parser/utils.py @@ -2,10 +2,18 @@ import copy import logging -from collections.abc import MutableMapping, MutableSequence +from collections.abc import MutableMapping, MutableSequence, Sequence from pathlib import Path -from types import ModuleType -from typing import Any, Final, Optional, cast, Literal, TypeAlias, overload +from typing import ( + Any, + Final, + Optional, + cast, + Literal, + TypeAlias, + overload, + Mapping, +) from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException @@ -31,6 +39,12 @@ InputArraySchema, OutputParameter, InputParameter, + ArraySchema, + InputRecordSchema, + CommandOutputRecordSchema, + OutputRecordSchema, + InputRecordField, + OutputRecordField, ) from ..types import is_sequence @@ -65,6 +79,133 @@ ) +SrcSink: TypeAlias = ( + cwl_v1_0_utils.SrcSink | cwl_v1_1_utils.SrcSink | cwl_v1_2_utils.SrcSink +) + + +def _compare_records( + src: InputRecordSchema | OutputRecordSchema, + sink: InputRecordSchema | OutputRecordSchema, + strict: bool = False, +) -> bool: + """ + Compare two records, ensuring they have compatible fields. + + This handles normalizing record names, which will be relative to workflow + step, so that they can be compared. + """ + srcfields = { + cwl_v1_2.shortname(field.name): cast( + InputTypeSchemas | OutputTypeSchemas | None, field.type_ + ) + for field in cast( + Sequence[InputRecordField | OutputRecordField], src.fields or [] + ) + } + sinkfields = { + cwl_v1_2.shortname(field.name): cast( + InputTypeSchemas | OutputTypeSchemas | None, field.type_ + ) + for field in cast( + Sequence[InputRecordField | OutputRecordField], sink.fields or [] + ) + } + for key in sinkfields.keys(): + if ( + not can_assign_src_to_sink( + srcfields.get(key, "null"), sinkfields.get(key, "null"), strict + ) + and sinkfields.get(key) is not None + ): + _logger.info( + "Record comparison failure for %s and %s\n" + "Did not match fields for %s: %s and %s", + cast(InputRecordSchema | CommandOutputRecordSchema, src).name, + cast(InputRecordSchema | CommandOutputRecordSchema, sink).name, + key, + srcfields.get(key), + sinkfields.get(key), + ) + return False + return True + + +def can_assign_src_to_sink( + src: InputTypeSchemas | OutputTypeSchemas | None, + sink: InputTypeSchemas | OutputTypeSchemas | None, + strict: bool = False, +) -> bool: + """ + Check for identical type specifications, ignoring extra keys like inputBinding. + + src: admissible source types + sink: admissible sink types + + In non-strict comparison, at least one source type must match one sink type, + except for 'null'. + In strict comparison, all source types must match at least one sink type. + """ + if "Any" in (src, sink): + return True + if isinstance(src, InputArraySchema | OutputArraySchema) and isinstance( + sink, InputArraySchema | OutputArraySchema + ): + return can_assign_src_to_sink( + cast(InputTypeSchemas | OutputTypeSchemas | None, src.items), + cast(InputTypeSchemas | OutputTypeSchemas | None, sink.items), + strict, + ) + if isinstance(src, InputRecordSchema | OutputRecordSchema) and isinstance( + sink, InputRecordSchema | OutputRecordSchema + ): + return _compare_records(src, sink, strict) + if isinstance(src, MutableSequence): + if strict: + for this_src in src: + if not can_assign_src_to_sink(this_src, sink): + return False + return True + for this_src in src: + if this_src != "null" and can_assign_src_to_sink(this_src, sink): + return True + return False + if isinstance(sink, MutableSequence): + for this_sink in sink: + if can_assign_src_to_sink(src, this_sink): + return True + return False + return bool(src == sink) + + +def check_types( + srctype: InputTypeSchemas | OutputTypeSchemas | None, + sinktype: InputTypeSchemas | OutputTypeSchemas | None, + linkMerge: str | None, + valueFrom: str | None = None, +) -> str: + """ + Check if the source and sink types are correct. + + Acceptable types are "pass", "warning", or "exception". + """ + if valueFrom is not None: + return "pass" + if linkMerge is None: + if can_assign_src_to_sink(srctype, sinktype, strict=True): + return "pass" + if can_assign_src_to_sink(srctype, sinktype, strict=False): + return "warning" + return "exception" + if linkMerge == "merge_nested": + return check_types( + cwl_v1_2.ArraySchema(items=srctype, type_="array"), sinktype, None, None + ) + if linkMerge == "merge_flattened": + return check_types(merge_flatten_type(srctype), sinktype, None, None) + raise ValidationException(f"Invalid value {linkMerge} for linkMerge field.") + + def convert_stdstreams_to_files(process: Process) -> None: """Convert stdin, stdout and stderr type shortcuts to files.""" match process: @@ -76,6 +217,21 @@ def convert_stdstreams_to_files(process: Process) -> None: cwl_v1_2_utils.convert_stdstreams_to_files(process) +def dump_type( + type_: InputTypeSchemas | OutputTypeSchemas | None, + cwlVersion: Literal["v1.0", "v1.1", "v1.2"], +) -> str: + match cwlVersion: + case "v1.0": + return json_dumps(cwl_v1_0.save(type_)) + case "v1.1": + return json_dumps(cwl_v1_1.save(type_)) + case "v1.2": + return json_dumps(cwl_v1_2.save(type_)) + case _: + raise Exception(f"Unsupported CWL version {cwlVersion}") + + def load_inputfile_by_uri( version: str, path: str | Path, @@ -181,6 +337,15 @@ def load_step( return cast(Process, copy.deepcopy(step.run)) +def merge_flatten_type(src: Any) -> Any: + """Return the merge flattened type of the source type.""" + if isinstance(src, MutableSequence): + return [merge_flatten_type(t) for t in src] + if isinstance(src, ArraySchema): + return src + return cwl_v1_2.ArraySchema(type_="array", items=src) + + def static_checker(workflow: Workflow) -> None: """Check if all source and sink types of a workflow are compatible before run time.""" step_inputs: Final[MutableSequence[WorkflowStepInput]] = [] @@ -235,40 +400,70 @@ def static_checker(workflow: Workflow) -> None: **{param.id: param.type_ for param in workflow.outputs}, } - parser: ModuleType - step_inputs_val: dict[str, Any] - workflow_outputs_val: dict[str, Any] + step_inputs_val: Mapping[str, Sequence[SrcSink]] + workflow_outputs_val: Mapping[str, Sequence[SrcSink]] match workflow.cwlVersion: case "v1.0": - parser = cwl_v1_0 step_inputs_val = cwl_v1_0_utils.check_all_types( - src_dict, + cast( + Mapping[str, cwl_v1_0.InputParameter | cwl_v1_0.WorkflowStepOutput], + src_dict, + ), cast(MutableSequence[cwl_v1_0.WorkflowStepInput], step_inputs), type_dict, ) workflow_outputs_val = cwl_v1_0_utils.check_all_types( - src_dict, workflow.outputs, type_dict + cast( + Mapping[str, cwl_v1_0.InputParameter | cwl_v1_0.WorkflowStepOutput], + src_dict, + ), + workflow.outputs, + type_dict, ) case "v1.1": - parser = cwl_v1_1 step_inputs_val = cwl_v1_1_utils.check_all_types( - src_dict, + cast( + Mapping[ + str, + cwl_v1_1.WorkflowInputParameter | cwl_v1_1.WorkflowStepOutput, + ], + src_dict, + ), cast(MutableSequence[cwl_v1_1.WorkflowStepInput], step_inputs), type_dict, ) workflow_outputs_val = cwl_v1_1_utils.check_all_types( - src_dict, workflow.outputs, type_dict + cast( + Mapping[ + str, + cwl_v1_1.WorkflowInputParameter | cwl_v1_1.WorkflowStepOutput, + ], + src_dict, + ), + workflow.outputs, + type_dict, ) case "v1.2": - parser = cwl_v1_2 step_inputs_val = cwl_v1_2_utils.check_all_types( - src_dict, + cast( + Mapping[ + str, + cwl_v1_2.WorkflowInputParameter | cwl_v1_2.WorkflowStepOutput, + ], + src_dict, + ), cast(MutableSequence[cwl_v1_2.WorkflowStepInput], step_inputs), cast(MutableMapping[str, cwl_v1_2.WorkflowStep], param_to_step), type_dict, ) workflow_outputs_val = cwl_v1_2_utils.check_all_types( - src_dict, + cast( + Mapping[ + str, + cwl_v1_2.WorkflowInputParameter | cwl_v1_2.WorkflowStepOutput, + ], + src_dict, + ), workflow.outputs, cast(MutableMapping[str, cwl_v1_2.WorkflowStep], param_to_step), type_dict, @@ -285,20 +480,21 @@ def static_checker(workflow: Workflow) -> None: src = warning.src sink = warning.sink linkMerge = warning.linkMerge + msg = ( SourceLine(src, "type").makeError( "Source '%s' of type %s may be incompatible" % ( - parser.shortname(src.id), - json_dumps(parser.save(type_dict[src.id])), + shortname(src.id, workflow.cwlVersion), + dump_type(type_dict[src.id], workflow.cwlVersion), ) ) + "\n" + SourceLine(sink, "type").makeError( " with sink '%s' of type %s" % ( - parser.shortname(sink.id), - json_dumps(parser.save(type_dict[sink.id])), + shortname(sink.id, workflow.cwlVersion), + dump_type(type_dict[sink.id], workflow.cwlVersion), ) ) ) @@ -322,14 +518,17 @@ def static_checker(workflow: Workflow) -> None: msg = ( SourceLine(src, "type").makeError( "Source '%s' of type %s is incompatible" - % (parser.shortname(src.id), json_dumps(parser.save(type_dict[src.id]))) + % ( + shortname(src.id, workflow.cwlVersion), + dump_type(type_dict[src.id], workflow.cwlVersion), + ) ) + "\n" + SourceLine(sink, "type").makeError( " with sink '%s' of type %s" % ( - parser.shortname(sink.id), - json_dumps(parser.save(type_dict[sink.id])), + shortname(sink.id, workflow.cwlVersion), + dump_type(type_dict[sink.id], workflow.cwlVersion), ) ) ) @@ -353,7 +552,7 @@ def static_checker(workflow: Workflow) -> None: ): msg = SourceLine(sink).makeError( "Required parameter '%s' does not have source, default, or valueFrom expression" - % parser.shortname(sink.id) + % shortname(sink.id, workflow.cwlVersion), ) exception_msgs.append(msg) @@ -555,3 +754,15 @@ def param_for_source_id( raise ValidationException( f"Version error. Did not recognise {process.cwlVersion} as a CWL version" ) + + +def shortname(name: str, cwlVersion: Literal["v1.0", "v1.1", "v1.2"]) -> str: + match cwlVersion: + case "v1.0": + return cwl_v1_0.shortname(name) + case "v1.1": + return cwl_v1_1.shortname(name) + case "v1.2": + return cwl_v1_2.shortname(name) + case _: + raise Exception(f"Unsupported CWL version {cwlVersion}") From 8e67d0c4bdc265a5ba9f12b7fea3832cf67d3589 Mon Sep 17 00:00:00 2001 From: GlassOfWhiskey Date: Tue, 30 Jun 2026 14:20:01 +0200 Subject: [PATCH 23/23] Merging link-based inheritance --- .github/workflows/ci-tests.yml | 2 +- Makefile | 10 +- README.rst | 6 +- pyproject.toml | 5 +- src/cwl_utils/cite_extract.py | 2 +- src/cwl_utils/cwl_v1_0_expression_refactor.py | 143 +- src/cwl_utils/cwl_v1_1_expression_refactor.py | 144 +- src/cwl_utils/cwl_v1_2_expression_refactor.py | 171 +- src/cwl_utils/docker_extract.py | 2 +- src/cwl_utils/expression_refactor.py | 26 +- src/cwl_utils/graph_split.py | 2 +- src/cwl_utils/normalizer.py | 3 +- src/cwl_utils/parser/__init__.py | 93 +- src/cwl_utils/parser/cwl_v1_0.py | 25819 ++++++-------- src/cwl_utils/parser/cwl_v1_0_utils.py | 139 +- src/cwl_utils/parser/cwl_v1_1.py | 24117 ++++++------- src/cwl_utils/parser/cwl_v1_1_utils.py | 139 +- src/cwl_utils/parser/cwl_v1_2.py | 29258 +++++++--------- src/cwl_utils/parser/cwl_v1_2_utils.py | 163 +- src/cwl_utils/parser/utils.py | 215 +- .../extensions/all-output-loop_v1_2.cwl | 32 - .../extensions/cuda-requirement_v1_0.cwl | 16 - .../extensions/cuda-requirement_v1_1.cwl | 16 - .../extensions/cuda-requirement_v1_2.cwl | 16 - .../inplace-update-requirement_v1_0.cwl | 21 - .../load-listing-requirement_v1_0.cwl | 13 - .../extensions/mpi-requirement_v1_0.cwl | 14 - .../extensions/mpi-requirement_v1_1.cwl | 13 - .../extensions/mpi-requirement_v1_2.cwl | 13 - .../extensions/network-access_v1_0.cwl | 16 - .../extensions/process-generator_v1_0.cwl | 32 - .../extensions/process-generator_v1_1.cwl | 32 - .../extensions/process-generator_v1_2.cwl | 32 - .../testdata/extensions/secrets_v1_0.cwl | 13 - .../testdata/extensions/secrets_v1_1.cwl | 13 - .../testdata/extensions/secrets_v1_2.cwl | 13 - .../testdata/extensions/shm-size_v1_0.cwl | 15 - .../testdata/extensions/shm-size_v1_1.cwl | 15 - .../testdata/extensions/shm-size_v1_2.cwl | 15 - .../extensions/single-var-loop_v1_2.cwl | 32 - .../testdata/extensions/time-limit_v1_0.cwl | 15 - .../testdata/extensions/work-reuse_v1_0.cwl | 18 - src/cwl_utils/tests/test_extensions.py | 197 - src/cwl_utils/tests/test_parser.py | 14 +- src/cwl_utils/tests/test_parser_utils.py | 80 +- 45 files changed, 33803 insertions(+), 47362 deletions(-) delete mode 100755 src/cwl_utils/testdata/extensions/all-output-loop_v1_2.cwl delete mode 100755 src/cwl_utils/testdata/extensions/cuda-requirement_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/cuda-requirement_v1_1.cwl delete mode 100755 src/cwl_utils/testdata/extensions/cuda-requirement_v1_2.cwl delete mode 100755 src/cwl_utils/testdata/extensions/inplace-update-requirement_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/load-listing-requirement_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/mpi-requirement_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/mpi-requirement_v1_1.cwl delete mode 100755 src/cwl_utils/testdata/extensions/mpi-requirement_v1_2.cwl delete mode 100755 src/cwl_utils/testdata/extensions/network-access_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/process-generator_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/process-generator_v1_1.cwl delete mode 100755 src/cwl_utils/testdata/extensions/process-generator_v1_2.cwl delete mode 100755 src/cwl_utils/testdata/extensions/secrets_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/secrets_v1_1.cwl delete mode 100755 src/cwl_utils/testdata/extensions/secrets_v1_2.cwl delete mode 100755 src/cwl_utils/testdata/extensions/shm-size_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/shm-size_v1_1.cwl delete mode 100755 src/cwl_utils/testdata/extensions/shm-size_v1_2.cwl delete mode 100755 src/cwl_utils/testdata/extensions/single-var-loop_v1_2.cwl delete mode 100755 src/cwl_utils/testdata/extensions/time-limit_v1_0.cwl delete mode 100755 src/cwl_utils/testdata/extensions/work-reuse_v1_0.cwl delete mode 100644 src/cwl_utils/tests/test_extensions.py diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 29b4adbc..c8706edd 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -74,7 +74,7 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: - fail_ci_if_error: true + fail_ci_if_error: false tox-style: name: CI linters via Tox diff --git a/Makefile b/Makefile index 1e565aa9..23b62578 100644 --- a/Makefile +++ b/Makefile @@ -194,21 +194,25 @@ flake8: FORCE src/cwl_utils/parser/cwl_v1_0.py: FORCE schema-salad-tool --codegen python \ --codegen-parser-info "org.w3id.cwl.v1_0" \ - https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/extensions.yml \ + --codegen-parent "https://w3id.org/cwl/salad=schema_salad.metaschema" \ + https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/CommonWorkflowLanguage.yml \ > $@ src/cwl_utils/parser/cwl_v1_1.py: FORCE schema-salad-tool --codegen python \ --codegen-parser-info "org.w3id.cwl.v1_1" \ - https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/extensions.yml \ + --codegen-parent "https://w3id.org/cwl/salad=schema_salad.metaschema" \ + https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/CommonWorkflowLanguage.yml \ > $@ src/cwl_utils/parser/cwl_v1_2.py: FORCE schema-salad-tool --codegen python \ --codegen-parser-info "org.w3id.cwl.v1_2" \ - https://github.com/common-workflow-language/cwl-v1.2/raw/codegen/extensions.yml \ + --codegen-parent "https://w3id.org/cwl/salad=schema_salad.metaschema" \ + https://github.com/common-workflow-language/cwl-v1.2/raw/codegen/CommonWorkflowLanguage.yml \ > $@ + regen_parsers: src/cwl_utils/parser/cwl_v1_*.py FORCE: diff --git a/README.rst b/README.rst index 204a1f87..1748ce52 100644 --- a/README.rst +++ b/README.rst @@ -173,13 +173,13 @@ Regenerate parsers To regenerate install the ``schema_salad`` package and run: ``cwl_utils/parser/cwl_v1_0.py`` was created via -``schema-salad-tool --codegen python https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/extensions.yml --codegen-parser-info "org.w3id.cwl.v1_0" > cwl_utils/parser/cwl_v1_0.py`` +``schema-salad-tool --codegen python https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/CommonWorkflowLanguage.yml --codegen-parent "https://w3id.org/cwl/salad=schema_salad.metaschema" --codegen-parser-info "org.w3id.cwl.v1_0" > src/cwl_utils/parser/cwl_v1_0.py`` ``cwl_utils/parser/cwl_v1_1.py`` was created via -``schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/extensions.yml --codegen-parser-info "org.w3id.cwl.v1_1" > cwl_utils/parser/cwl_v1_1.py`` +``schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/CommonWorkflowLanguage.yml --codegen-parent "https://w3id.org/cwl/salad=schema_salad.metaschema" --codegen-parser-info "org.w3id.cwl.v1_1" > src/cwl_utils/parser/cwl_v1_1.py`` ``cwl_utils/parser/cwl_v1_2.py`` was created via -``schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.2/raw/codegen/extensions.yml --codegen-parser-info "org.w3id.cwl.v1_2" > cwl_utils/parser/cwl_v1_2.py`` +``schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.2/raw/codegen/CommonWorkflowLanguage.yml --codegen-parent "https://w3id.org/cwl/salad=schema_salad.metaschema" --codegen-parser-info "org.w3id.cwl.v1_2" > src/cwl_utils/parser/cwl_v1_2.py`` Release ~~~~~~~ diff --git a/pyproject.toml b/pyproject.toml index 31b9b921..cb9e0dc3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ dependencies = [ "packaging", "rdflib", "requests", - "schema-salad >= 8.8.20250205075315,<9", + "schema-salad @ git+https://github.com/common-workflow-language/schema_salad.git@refs/pull/993/head", "ruamel.yaml >= 0.17.6, < 0.20", "typing_extensions >= 4.10.0", ] @@ -71,6 +71,9 @@ cwl-pack = "cwl_utils.pack_cli:main" cwl-normalizer = "cwl_utils.normalizer:main" cwl-inputs-schema-gen = "cwl_utils.inputs_schema_gen:main" +[tool.hatch.metadata] +allow-direct-references = true + [tool.pytest.ini_options] addopts = "-rsx -n auto --pyargs cwl_utils.tests" diff --git a/src/cwl_utils/cite_extract.py b/src/cwl_utils/cite_extract.py index e7ff61c6..099aacd6 100755 --- a/src/cwl_utils/cite_extract.py +++ b/src/cwl_utils/cite_extract.py @@ -67,7 +67,7 @@ def get_process_from_step(step: cwl.WorkflowStep) -> cwl.Process: """Return the process for this step, loading it if needed.""" if isinstance(step.run, str): return cast(cwl.Process, cwl.load_document_by_uri(step.run)) - return cast(cwl.Process, step.run) + return step.run def traverse_workflow(workflow: cwl.Workflow) -> Iterator[cwl.SoftwareRequirement]: diff --git a/src/cwl_utils/cwl_v1_0_expression_refactor.py b/src/cwl_utils/cwl_v1_0_expression_refactor.py index 8ec09e14..82ebb151 100755 --- a/src/cwl_utils/cwl_v1_0_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_0_expression_refactor.py @@ -11,6 +11,8 @@ from typing import Any, cast from ruamel import yaml +from schema_salad.metaschema import ArraySchema, RecordSchema +from schema_salad.runtime import LoadingOptions, save from schema_salad.sourceline import SourceLine from schema_salad.utils import json_dumps @@ -29,6 +31,7 @@ InputTypeSchemas, OutputTypeSchemas, ) +from cwl_utils.parser.utils import param_for_source_id from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -53,7 +56,7 @@ def expand_stream_shortcuts(process: cwl.CommandLineTool) -> cwl.CommandLineTool stdout_path = process.stdout if not stdout_path: stdout_path = hashlib.sha1( # nosec - json_dumps(cwl.save(process)).encode("utf-8") + json_dumps(save(process)).encode("utf-8") ).hexdigest() result.stdout = stdout_path result.outputs[index].type_ = "File" @@ -71,12 +74,12 @@ def escape_expression_field(contents: str) -> str: def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: - if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype, ArraySchema): if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(cwltype.items, cwl.RecordSchema): + elif isinstance(cwltype.items, RecordSchema): if ( isinstance( cwltype.items, @@ -88,7 +91,7 @@ def _clean_type_ids( if cwltype.items.fields: for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(cwltype, cwl.RecordSchema): + elif isinstance(cwltype, RecordSchema): if cwltype.fields: for field in cwltype.fields: field.name = field.name.split("/")[-1] @@ -508,15 +511,7 @@ def generate_etool_from_expr( | cwl.CommandInputParameter | list[cwl.InputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output - extra_processes: None | ( - Sequence[ - cwl.Workflow - | cwl.WorkflowStep - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - ] - ) = None, + extra_processes: None | Sequence[cwl.Process | cwl.WorkflowStep] = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" inputs: list[cwl.InputParameter] = [] @@ -596,12 +591,7 @@ def generate_etool_from_expr( ) -def get_input_for_id( - name: str, - tool: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ProcessGenerator | cwl.ExpressionTool - ), -) -> cwl.CommandInputParameter | None: +def get_input_for_id(name: str, tool: cwl.Process) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] @@ -622,13 +612,7 @@ def get_input_for_id( def find_expressionLib( - processes: Sequence[ - cwl.CommandLineTool - | cwl.Workflow - | cwl.ExpressionTool - | cwl.WorkflowStep - | cwl.ProcessGenerator - ], + processes: Sequence[cwl.Process | cwl.WorkflowStep], ) -> list[str] | None: """ Return the expressionLib from the highest priority InlineJavascriptRequirement. @@ -651,36 +635,18 @@ def replace_expr_with_etool( target: cwl.CommandInputParameter | cwl.InputParameter, source: str | list[Any] | None, replace_etool: bool = False, - extra_process: None | ( - cwl.Workflow - | cwl.WorkflowStep - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - ) = None, + extra_process: cwl.Process | cwl.WorkflowStep | None = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[ - cwl.WorkflowStep - | cwl.Workflow - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - ] = [workflow] + extra_processes: list[cwl.Process | cwl.WorkflowStep] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[ - cwl.WorkflowStep - | cwl.Workflow - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - ] = [workflow] + processes: list[cwl.Process | cwl.WorkflowStep] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -730,13 +696,7 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( - process_or_step: ( - cwl.CommandLineTool - | cwl.WorkflowStep - | cwl.ExpressionTool - | cwl.Workflow - | cwl.ProcessGenerator - ), + process_or_step: cwl.Process | cwl.WorkflowStep, parent: cwl.Workflow | None = None, ) -> dict[str, Any]: """Produce a mock input object for the given inputs.""" @@ -1189,9 +1149,7 @@ def process_workflow_reqs_and_hints( def process_level_reqs( - process: ( - cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow - ), + process: cwl.Process, step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -1479,7 +1437,7 @@ def process_level_reqs( def add_input_to_process( - process: cwl.Process, name: str, inptype: Any, loadingOptions: cwl.LoadingOptions + process: cwl.Process, name: str, inptype: Any, loadingOptions: LoadingOptions ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): @@ -1555,7 +1513,7 @@ def traverse_CommandLineTool( ) new_target_clt_arguments = list(target_clt.arguments or []) new_target_clt_arguments[index] = cwl.CommandLineBinding( - valueFrom="$(inputs.{})".format(inp_id) + valueFrom=f"$(inputs.{inp_id})" ) target_clt.arguments = new_target_clt_arguments new_target_clt_inputs = list(target_clt.inputs) @@ -1954,9 +1912,7 @@ def replace_step_process_hintreq_expr_with_etool( def process_inputs_to_etool_inputs( - tool: ( - cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow - ), + tool: cwl.Process, ) -> list[cwl.InputParameter]: """Copy Process input parameters to matching ExpressionTool versions.""" inputs = [] @@ -2027,13 +1983,7 @@ def generate_etool_from_expr2( cwl.InputParameter | cwl.CommandInputParameter | cwl.CommandOutputParameter ], self_name: str | None = None, - process: ( - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.Workflow - | cwl.ProcessGenerator - | None - ) = None, + process: cwl.Process | None = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -2061,55 +2011,16 @@ def generate_etool_from_expr2( + """}()}; }""" ) - hints = None - procs: list[ - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.Workflow - | cwl.WorkflowStep - | cwl.ProcessGenerator - ] = [] + procs: list[cwl.Process | cwl.WorkflowStep] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs: MutableSequence[ - cwl.CUDARequirement - | cwl.DockerRequirement - | cwl.EnvVarRequirement - | cwl.InitialWorkDirRequirement - | cwl.InlineJavascriptRequirement - | cwl.InplaceUpdateRequirement - | cwl.LoadListingRequirement - | cwl.MPIRequirement - | cwl.MultipleInputFeatureRequirement - | cwl.NetworkAccess - | cwl.ResourceRequirement - | cwl.ScatterFeatureRequirement - | cwl.SchemaDefRequirement - | cwl.Secrets - | cwl.ShellCommandRequirement - | cwl.ShmSize - | cwl.SoftwareRequirement - | cwl.StepInputExpressionRequirement - | cwl.SubworkflowFeatureRequirement - | cwl.TimeLimit - | cwl.WorkReuse - ] = [inlineJSReq] - if process: - if process.hints: - hints = copy.deepcopy(process.hints) - hints = [ - x - for x in copy.deepcopy(hints) - if not isinstance(x, cwl.InitialWorkDirRequirement) - ] - if process.requirements: - reqs.extend(copy.deepcopy(process.requirements)) - reqs[:] = [ - x for x in reqs if not isinstance(x, cwl.InitialWorkDirRequirement) - ] + reqs: MutableSequence[cwl.ProcessRequirement] = [inlineJSReq] + if process and process.requirements: + reqs.extend(copy.deepcopy(process.requirements)) + reqs[:] = [x for x in reqs if not isinstance(x, cwl.InitialWorkDirRequirement)] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), inputs=parameters_to_plain_input_paramaters(inputs), @@ -2259,7 +2170,7 @@ def workflow_step_to_InputParameters( inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( - utils.param_for_source_id(parent, sourcenames=inp.source) + param_for_source_id(parent, sourcenames=inp.source) ) if is_sequence(param): for p in param: @@ -2290,9 +2201,7 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.InputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: ( - cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow - ), + original_process: cwl.Process, original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, diff --git a/src/cwl_utils/cwl_v1_1_expression_refactor.py b/src/cwl_utils/cwl_v1_1_expression_refactor.py index a3a25326..24106dc6 100755 --- a/src/cwl_utils/cwl_v1_1_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_1_expression_refactor.py @@ -11,6 +11,8 @@ from typing import Any, cast from ruamel import yaml +from schema_salad.metaschema import ArraySchema, RecordSchema +from schema_salad.runtime import LoadingOptions, save from schema_salad.sourceline import SourceLine from schema_salad.utils import json_dumps @@ -29,6 +31,7 @@ InputTypeSchemas, OutputTypeSchemas, ) +from cwl_utils.parser.utils import param_for_source_id from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -53,7 +56,7 @@ def expand_stream_shortcuts(process: cwl.CommandLineTool) -> cwl.CommandLineTool stdout_path = process.stdout if not stdout_path: stdout_path = hashlib.sha1( # nosec - json_dumps(cwl.save(process)).encode("utf-8") + json_dumps(save(process)).encode("utf-8") ).hexdigest() result.stdout = stdout_path result.outputs[index].type_ = "File" @@ -71,12 +74,12 @@ def escape_expression_field(contents: str) -> str: def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: - if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype, ArraySchema): if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(cwltype.items, cwl.RecordSchema): + elif isinstance(cwltype.items, RecordSchema): if ( isinstance( cwltype.items, @@ -88,7 +91,7 @@ def _clean_type_ids( if cwltype.items.fields: for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(cwltype, cwl.RecordSchema): + elif isinstance(cwltype, RecordSchema): if cwltype.fields: for field in cwltype.fields: field.name = field.name.split("/")[-1] @@ -506,15 +509,7 @@ def generate_etool_from_expr( | cwl.CommandInputParameter | list[cwl.WorkflowInputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output - extra_processes: None | ( - Sequence[ - cwl.Workflow - | cwl.WorkflowStep - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - ] - ) = None, + extra_processes: Sequence[cwl.Process | cwl.WorkflowStep] | None = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" inputs: list[cwl.WorkflowInputParameter] = [] @@ -590,15 +585,13 @@ def generate_etool_from_expr( outputs=outputs, expression=expression, requirements=[inlineJSReq], - cwlVersion="v1.0", + cwlVersion="v1.1", ) def get_input_for_id( name: str, - tool: ( - cwl.CommandLineTool | cwl.Workflow | cwl.ProcessGenerator | cwl.ExpressionTool - ), + tool: cwl.Process, ) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] @@ -620,13 +613,7 @@ def get_input_for_id( def find_expressionLib( - processes: Sequence[ - cwl.CommandLineTool - | cwl.Workflow - | cwl.ExpressionTool - | cwl.WorkflowStep - | cwl.ProcessGenerator - ], + processes: Sequence[cwl.Process | cwl.WorkflowStep], ) -> list[str] | None: """ Return the expressionLib from the highest priority InlineJavascriptRequirement. @@ -649,36 +636,18 @@ def replace_expr_with_etool( target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, source: str | list[Any] | None, replace_etool: bool = False, - extra_process: None | ( - cwl.Workflow - | cwl.WorkflowStep - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - ) = None, + extra_process: cwl.Process | cwl.WorkflowStep | None = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[ - cwl.WorkflowStep - | cwl.Workflow - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - ] = [workflow] + extra_processes: list[cwl.Process | cwl.WorkflowStep] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[ - cwl.WorkflowStep - | cwl.Workflow - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - ] = [workflow] + processes: list[cwl.Process | cwl.WorkflowStep] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -728,13 +697,7 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( - process_or_step: ( - cwl.CommandLineTool - | cwl.WorkflowStep - | cwl.ExpressionTool - | cwl.Workflow - | cwl.ProcessGenerator - ), + process_or_step: cwl.Process | cwl.WorkflowStep, parent: cwl.Workflow | None = None, ) -> dict[str, Any]: """Produce a mock input object for the given inputs.""" @@ -1200,9 +1163,7 @@ def process_workflow_reqs_and_hints( def process_level_reqs( - process: ( - cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow - ), + process: cwl.Process, step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -1490,7 +1451,7 @@ def process_level_reqs( def add_input_to_process( - process: cwl.Process, name: str, inptype: Any, loadingOptions: cwl.LoadingOptions + process: cwl.Process, name: str, inptype: Any, loadingOptions: LoadingOptions ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): @@ -1566,7 +1527,7 @@ def traverse_CommandLineTool( ) new_target_clt_arguments = list(target_clt.arguments or []) new_target_clt_arguments[index] = cwl.CommandLineBinding( - valueFrom="$(inputs.{})".format(inp_id) + valueFrom=f"$(inputs.{inp_id})" ) target_clt.arguments = new_target_clt_arguments new_target_clt_inputs = list(target_clt.inputs) @@ -1965,9 +1926,7 @@ def replace_step_process_hintreq_expr_with_etool( def process_inputs_to_etool_inputs( - tool: ( - cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow - ), + tool: cwl.Process, ) -> list[cwl.WorkflowInputParameter]: """Copy Process input parameters to matching ExpressionTool versions.""" inputs = [] @@ -2040,13 +1999,7 @@ def generate_etool_from_expr2( | cwl.CommandOutputParameter ], self_name: str | None = None, - process: ( - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.Workflow - | cwl.ProcessGenerator - | None - ) = None, + process: cwl.Process | None = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -2074,62 +2027,23 @@ def generate_etool_from_expr2( + """}()}; }""" ) - hints = None - procs: list[ - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.Workflow - | cwl.WorkflowStep - | cwl.ProcessGenerator - ] = [] + procs: list[cwl.Process | cwl.WorkflowStep] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs: MutableSequence[ - cwl.CUDARequirement - | cwl.DockerRequirement - | cwl.EnvVarRequirement - | cwl.InitialWorkDirRequirement - | cwl.InlineJavascriptRequirement - | cwl.InplaceUpdateRequirement - | cwl.LoadListingRequirement - | cwl.MPIRequirement - | cwl.MultipleInputFeatureRequirement - | cwl.NetworkAccess - | cwl.ResourceRequirement - | cwl.ScatterFeatureRequirement - | cwl.SchemaDefRequirement - | cwl.Secrets - | cwl.ShellCommandRequirement - | cwl.ShmSize - | cwl.SoftwareRequirement - | cwl.StepInputExpressionRequirement - | cwl.SubworkflowFeatureRequirement - | cwl.ToolTimeLimit - | cwl.WorkReuse - ] = [inlineJSReq] - if process: - if process.hints: - hints = copy.deepcopy(process.hints) - hints = [ - x - for x in copy.deepcopy(hints) - if not isinstance(x, cwl.InitialWorkDirRequirement) - ] - if process.requirements: - reqs.extend(copy.deepcopy(process.requirements)) - reqs[:] = [ - x for x in reqs if not isinstance(x, cwl.InitialWorkDirRequirement) - ] + reqs: MutableSequence[cwl.ProcessRequirement] = [inlineJSReq] + if process and process.requirements: + reqs.extend(copy.deepcopy(process.requirements)) + reqs[:] = [x for x in reqs if not isinstance(x, cwl.InitialWorkDirRequirement)] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), inputs=parameters_to_workflow_input_paramaters(inputs), outputs=outputs, expression=expression, requirements=reqs, - cwlVersion="v1.0", + cwlVersion="v1.1", ) @@ -2274,7 +2188,7 @@ def workflow_step_to_WorkflowInputParameters( inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( - utils.param_for_source_id(parent, sourcenames=inp.source) + param_for_source_id(parent, sourcenames=inp.source) ) if is_sequence(param): for p in param: @@ -2305,9 +2219,7 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: ( - cwl.CommandLineTool | cwl.ExpressionTool | cwl.ProcessGenerator | cwl.Workflow - ), + original_process: cwl.Process, original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, diff --git a/src/cwl_utils/cwl_v1_2_expression_refactor.py b/src/cwl_utils/cwl_v1_2_expression_refactor.py index 634705b4..044ed71b 100755 --- a/src/cwl_utils/cwl_v1_2_expression_refactor.py +++ b/src/cwl_utils/cwl_v1_2_expression_refactor.py @@ -11,6 +11,8 @@ from typing import Any, cast from ruamel import yaml +from schema_salad.metaschema import ArraySchema, RecordSchema +from schema_salad.runtime import LoadingOptions, save from schema_salad.sourceline import SourceLine from schema_salad.utils import json_dumps @@ -29,6 +31,7 @@ InputTypeSchemas, OutputTypeSchemas, ) +from cwl_utils.parser.utils import param_for_source_id from cwl_utils.types import ( CWLDirectoryType, CWLFileType, @@ -53,7 +56,7 @@ def expand_stream_shortcuts(process: cwl.CommandLineTool) -> cwl.CommandLineTool stdout_path = process.stdout if not stdout_path: stdout_path = hashlib.sha1( # nosec - json_dumps(cwl.save(process)).encode("utf-8") + json_dumps(save(process)).encode("utf-8") ).hexdigest() result.stdout = stdout_path result.outputs[index].type_ = "File" @@ -71,12 +74,12 @@ def escape_expression_field(contents: str) -> str: def _clean_type_ids( cwltype: InputTypeSchemas | CommandOutputTypeSchemas, ) -> None: - if isinstance(cwltype, cwl.ArraySchema): + if isinstance(cwltype, ArraySchema): if is_sequence(cwltype.items): for item in cwltype.items: if hasattr(item, "id"): item.id = item.id.split("#")[-1] - elif isinstance(cwltype.items, cwl.RecordSchema): + elif isinstance(cwltype.items, RecordSchema): if ( isinstance( cwltype.items, @@ -88,7 +91,7 @@ def _clean_type_ids( if cwltype.items.fields: for field in cwltype.items.fields: field.name = field.name.split("/")[-1] - elif isinstance(cwltype, cwl.RecordSchema): + elif isinstance(cwltype, RecordSchema): if cwltype.name: cwltype.name = cwltype.name.split("/")[-1] if cwltype.fields: @@ -546,16 +549,7 @@ def generate_etool_from_expr( | cwl.CommandInputParameter | Sequence[cwl.WorkflowInputParameter | cwl.CommandInputParameter] ) = None, # if the "self" input should be a different type than the "result" output - extra_processes: None | ( - Sequence[ - cwl.Workflow - | cwl.WorkflowStep - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Operation - ] - ) = None, + extra_processes: Sequence[cwl.Process | cwl.WorkflowStep] | None = None, ) -> cwl.ExpressionTool: """Convert a CWL Expression into an ExpressionTool.""" inputs: list[cwl.WorkflowInputParameter] = [] @@ -631,19 +625,13 @@ def generate_etool_from_expr( outputs=outputs, expression=expression, requirements=[inlineJSReq], - cwlVersion="v1.0", + cwlVersion="v1.2", ) def get_input_for_id( name: str, - tool: ( - cwl.CommandLineTool - | cwl.Workflow - | cwl.ProcessGenerator - | cwl.ExpressionTool - | cwl.Operation - ), + tool: cwl.Process, ) -> cwl.CommandInputParameter | None: """Determine the CommandInputParameter for the given input name.""" name = name.split("/")[-1] @@ -665,14 +653,7 @@ def get_input_for_id( def find_expressionLib( - processes: Sequence[ - cwl.CommandLineTool - | cwl.Workflow - | cwl.ExpressionTool - | cwl.WorkflowStep - | cwl.ProcessGenerator - | cwl.Operation - ], + processes: Sequence[cwl.Process | cwl.WorkflowStep], ) -> list[str] | None: """ Return the expressionLib from the highest priority InlineJavascriptRequirement. @@ -695,39 +676,18 @@ def replace_expr_with_etool( target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, source: str | Sequence[Any] | None, replace_etool: bool = False, - extra_process: None | ( - cwl.Workflow - | cwl.WorkflowStep - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Operation - ) = None, + extra_process: cwl.Process | cwl.WorkflowStep | None = None, source_type: cwl.CommandInputParameter | None = None, ) -> None: """Modify the given workflow, replacing the expr with an standalone ExpressionTool.""" - extra_processes: list[ - cwl.WorkflowStep - | cwl.Workflow - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Operation - ] = [workflow] + extra_processes: list[cwl.Process | cwl.WorkflowStep] = [workflow] if extra_process: extra_processes.append(extra_process) etool: cwl.ExpressionTool = generate_etool_from_expr( expr, target, source is None, source_type, extra_processes ) if replace_etool: - processes: list[ - cwl.WorkflowStep - | cwl.Workflow - | cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Operation - ] = [workflow] + processes: list[cwl.Process | cwl.WorkflowStep] = [workflow] if extra_process: processes.append(extra_process) final_tool: cwl.ExpressionTool | cwl.CommandLineTool = etool_to_cltool( @@ -777,14 +737,7 @@ def replace_wf_input_ref_with_step_output( def empty_inputs( - process_or_step: ( - cwl.CommandLineTool - | cwl.WorkflowStep - | cwl.ExpressionTool - | cwl.Workflow - | cwl.ProcessGenerator - | cwl.Operation - ), + process_or_step: cwl.Process | cwl.WorkflowStep, parent: cwl.Workflow | None = None, ) -> dict[str, Any]: """Produce a mock input object for the given inputs.""" @@ -983,7 +936,7 @@ def process_workflow_inputs_and_outputs( else: sources = [s.split("#")[-1] for s in param2.outputSource] source_type_items = utils.type_for_source(workflow, sources) - if isinstance(source_type_items, cwl.ArraySchema): + if isinstance(source_type_items, ArraySchema): if is_sequence(source_type_items.items): if "null" not in source_type_items.items: new_source_type_items_items = list(source_type_items.items) @@ -1356,13 +1309,7 @@ def process_workflow_reqs_and_hints( def process_level_reqs( - process: ( - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Workflow - | cwl.Operation - ), + process: cwl.Process, step: cwl.WorkflowStep, parent: cwl.Workflow, replace_etool: bool, @@ -1650,7 +1597,7 @@ def process_level_reqs( def add_input_to_process( - process: cwl.Process, name: str, inptype: Any, loadingOptions: cwl.LoadingOptions + process: cwl.Process, name: str, inptype: Any, loadingOptions: LoadingOptions ) -> None: """Add a new InputParameter to the given CommandLineTool.""" if isinstance(process, cwl.CommandLineTool): @@ -1726,7 +1673,7 @@ def traverse_CommandLineTool( ) new_target_clt_arguments = list(target_clt.arguments or []) new_target_clt_arguments[index] = cwl.CommandLineBinding( - valueFrom="$(inputs.{})".format(inp_id) + valueFrom=f"$(inputs.{inp_id})" ) target_clt.arguments = new_target_clt_arguments new_target_clt_inputs = list(target_clt.inputs) @@ -2125,13 +2072,7 @@ def replace_step_process_hintreq_expr_with_etool( def process_inputs_to_etool_inputs( - tool: ( - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Workflow - | cwl.Operation - ), + tool: cwl.Process, ) -> list[cwl.WorkflowInputParameter]: """Copy Process input parameters to matching ExpressionTool versions.""" inputs = [] @@ -2204,14 +2145,7 @@ def generate_etool_from_expr2( | cwl.CommandOutputParameter ], self_name: str | None = None, - process: ( - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.Workflow - | cwl.ProcessGenerator - | cwl.Operation - | None - ) = None, + process: cwl.Process | None = None, extra_processes: None | ( Sequence[cwl.Workflow | cwl.WorkflowStep | cwl.CommandLineTool] ) = None, @@ -2239,64 +2173,23 @@ def generate_etool_from_expr2( + """}()}; }""" ) - hints = None - procs: list[ - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.Workflow - | cwl.WorkflowStep - | cwl.ProcessGenerator - | cwl.Operation - ] = [] + procs: list[cwl.Process | cwl.WorkflowStep] = [] if process: procs.append(process) if extra_processes: procs.extend(extra_processes) inlineJSReq = cwl.InlineJavascriptRequirement(find_expressionLib(procs)) - reqs: MutableSequence[ - cwl.CUDARequirement - | cwl.DockerRequirement - | cwl.EnvVarRequirement - | cwl.InitialWorkDirRequirement - | cwl.InlineJavascriptRequirement - | cwl.InplaceUpdateRequirement - | cwl.LoadListingRequirement - | cwl.Loop - | cwl.MPIRequirement - | cwl.MultipleInputFeatureRequirement - | cwl.NetworkAccess - | cwl.ResourceRequirement - | cwl.ScatterFeatureRequirement - | cwl.SchemaDefRequirement - | cwl.Secrets - | cwl.ShellCommandRequirement - | cwl.ShmSize - | cwl.SoftwareRequirement - | cwl.StepInputExpressionRequirement - | cwl.SubworkflowFeatureRequirement - | cwl.ToolTimeLimit - | cwl.WorkReuse - ] = [inlineJSReq] - if process: - if process.hints: - hints = copy.deepcopy(process.hints) - hints = [ - x - for x in copy.deepcopy(hints) - if not isinstance(x, cwl.InitialWorkDirRequirement) - ] - if process.requirements: - reqs.extend(copy.deepcopy(process.requirements)) - reqs[:] = [ - x for x in reqs if not isinstance(x, cwl.InitialWorkDirRequirement) - ] + reqs: MutableSequence[cwl.ProcessRequirement] = [inlineJSReq] + if process and process.requirements: + reqs.extend(copy.deepcopy(process.requirements)) + reqs[:] = [x for x in reqs if not isinstance(x, cwl.InitialWorkDirRequirement)] return cwl.ExpressionTool( id="_:" + str(uuid.uuid4()), inputs=parameters_to_workflow_input_paramaters(inputs), outputs=outputs, expression=expression, requirements=reqs, - cwlVersion="v1.0", + cwlVersion="v1.2", ) @@ -2441,7 +2334,7 @@ def workflow_step_to_WorkflowInputParameters( inp_id = inp.id.split("#")[-1].split("/")[-1] if inp.source and inp_id != except_in_id: param = copy.deepcopy( - utils.param_for_source_id(parent, sourcenames=inp.source) + param_for_source_id(parent, sourcenames=inp.source) ) if is_sequence(param): for p in param: @@ -2472,13 +2365,7 @@ def replace_step_valueFrom_expr_with_etool( target: cwl.CommandInputParameter | cwl.WorkflowInputParameter, step: cwl.WorkflowStep, step_inp: cwl.WorkflowStepInput, - original_process: ( - cwl.CommandLineTool - | cwl.ExpressionTool - | cwl.ProcessGenerator - | cwl.Workflow - | cwl.Operation - ), + original_process: cwl.Process, original_step_ins: Sequence[cwl.WorkflowStepInput], source: str | list[str] | None, replace_etool: bool, diff --git a/src/cwl_utils/docker_extract.py b/src/cwl_utils/docker_extract.py index 6fa7528d..1c5626d9 100755 --- a/src/cwl_utils/docker_extract.py +++ b/src/cwl_utils/docker_extract.py @@ -127,7 +127,7 @@ def get_process_from_step(step: cwl.WorkflowStep) -> cwl.Process: """Return the process for this step, loading it if necessary.""" if isinstance(step.run, str): return cast(cwl.Process, cwl.load_document_by_uri(step.run)) - return cast(cwl.Process, step.run) + return step.run def traverse_workflow(workflow: cwl.Workflow) -> Iterator[cwl.DockerRequirement]: diff --git a/src/cwl_utils/expression_refactor.py b/src/cwl_utils/expression_refactor.py index 094f5810..fd40d404 100755 --- a/src/cwl_utils/expression_refactor.py +++ b/src/cwl_utils/expression_refactor.py @@ -7,12 +7,13 @@ import logging import shutil import sys -from collections.abc import Callable, MutableMapping, MutableSequence +from collections.abc import Callable, MutableSequence from pathlib import Path -from typing import Any, Protocol +from typing import Any from ruamel.yaml.main import YAML from ruamel.yaml.scalarstring import walk_tree +from schema_salad.runtime import save from cwl_utils import ( cwl_v1_0_expression_refactor, @@ -29,24 +30,6 @@ _logger.setLevel(logging.INFO) _cwlutilslogger.setLevel(100) -save_type = ( - MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str | None -) - - -class saveCWL(Protocol): - """Shortcut type for CWL v1.x parse.save().""" - - def __call__( - self, - val: Any, - top: bool = True, - base_url: str = "", - relative_uris: bool = True, - ) -> save_type: - """Must use this instead of a Callable due to the keyword args.""" - ... - def arg_parser() -> argparse.ArgumentParser: """Build the argument parser.""" @@ -111,15 +94,12 @@ def refactor(args: argparse.Namespace) -> int: traverse: Callable[[Any, bool, bool, bool, bool], tuple[Any, bool]] = ( cwl_v1_0_expression_refactor.traverse ) - save: saveCWL = cwl_v1_0.save case "v1.1": top = cwl_v1_1.load_document_by_yaml(result, uri) traverse = cwl_v1_1_expression_refactor.traverse - save = cwl_v1_1.save case "v1.2": top = cwl_v1_2.load_document_by_yaml(result, uri) traverse = cwl_v1_2_expression_refactor.traverse - save = cwl_v1_2.save case _: _logger.error( "Sorry, %s is not a supported CWL version by this tool.", diff --git a/src/cwl_utils/graph_split.py b/src/cwl_utils/graph_split.py index 8a1ef14a..525d055b 100755 --- a/src/cwl_utils/graph_split.py +++ b/src/cwl_utils/graph_split.py @@ -20,9 +20,9 @@ from typing import ( IO, Any, - Callable, cast, ) +from collections.abc import Callable try: stringify_dict: Callable[[dict[str, Any]], str] | None diff --git a/src/cwl_utils/normalizer.py b/src/cwl_utils/normalizer.py index 29231758..100095d5 100644 --- a/src/cwl_utils/normalizer.py +++ b/src/cwl_utils/normalizer.py @@ -13,12 +13,13 @@ from cwlupgrader import main as cwlupgrader from ruamel.yaml import YAML +from schema_salad.runtime import save from schema_salad.sourceline import add_lc_filename from cwl_utils import cwl_v1_2_expression_refactor from cwl_utils.loghandler import _logger as _cwlutilslogger from cwl_utils.pack import pack -from cwl_utils.parser.cwl_v1_2 import load_document_by_yaml, save +from cwl_utils.parser.cwl_v1_2 import load_document_by_yaml _logger = logging.getLogger("cwl-normalizer") # pylint: disable=invalid-name defaultStreamHandler = logging.StreamHandler() # pylint: disable=invalid-name diff --git a/src/cwl_utils/parser/__init__.py b/src/cwl_utils/parser/__init__.py index dff3cdb3..cde0764d 100644 --- a/src/cwl_utils/parser/__init__.py +++ b/src/cwl_utils/parser/__init__.py @@ -4,26 +4,21 @@ from abc import ABC from collections.abc import MutableMapping, MutableSequence from pathlib import Path -from typing import Any, Optional, TypeAlias, cast, TypeVar +from typing import Any, TypeAlias, cast, TypeVar from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException +from schema_salad.runtime import LoadingOptions, Saveable, file_uri from schema_salad.utils import yaml_no_ts -from ..errors import GraphTargetMissingException from . import cwl_v1_0, cwl_v1_1, cwl_v1_2 +from ..errors import GraphTargetMissingException class NoType(ABC): pass -LoadingOptions: TypeAlias = ( - cwl_v1_0.LoadingOptions | cwl_v1_1.LoadingOptions | cwl_v1_2.LoadingOptions -) -"""Type union for a CWL v1.x LoadingOptions object.""" -Saveable: TypeAlias = cwl_v1_0.Saveable | cwl_v1_1.Saveable | cwl_v1_2.Saveable -"""Type union for a CWL v1.x Saveable object.""" InputParameter: TypeAlias = ( cwl_v1_0.InputParameter | cwl_v1_1.InputParameter | cwl_v1_2.InputParameter ) @@ -217,9 +212,6 @@ class NoType(ABC): cwl_v1_2.SoftwareRequirement, ) """Type union for a CWL v1.x SoftwareRequirement object.""" -ArraySchema: TypeAlias = ( - cwl_v1_0.ArraySchema | cwl_v1_1.ArraySchema | cwl_v1_2.ArraySchema -) InputArraySchema: TypeAlias = ( cwl_v1_0.InputArraySchema | cwl_v1_1.InputArraySchema | cwl_v1_2.InputArraySchema ) @@ -228,8 +220,6 @@ class NoType(ABC): cwl_v1_1.InputArraySchema, cwl_v1_2.InputArraySchema, ) -"""Type Union for a CWL v1.x ArraySchema object.""" -EnumSchema: TypeAlias = cwl_v1_0.EnumSchema | cwl_v1_1.EnumSchema | cwl_v1_2.EnumSchema InputEnumSchema: TypeAlias = ( cwl_v1_0.InputEnumSchema | cwl_v1_1.InputEnumSchema | cwl_v1_2.InputEnumSchema ) @@ -238,10 +228,6 @@ class NoType(ABC): cwl_v1_1.InputEnumSchema, cwl_v1_2.InputEnumSchema, ) -"""Type Union for a CWL v1.x EnumSchema object.""" -RecordSchema: TypeAlias = ( - cwl_v1_0.RecordSchema | cwl_v1_1.RecordSchema | cwl_v1_2.RecordSchema -) InputRecordSchema: TypeAlias = ( cwl_v1_0.InputRecordSchema | cwl_v1_1.InputRecordSchema | cwl_v1_2.InputRecordSchema ) @@ -324,53 +310,16 @@ def load_document_by_uri( base_uri = path.resolve().parent.as_uri() id_ = path.resolve().name.split("#")[1] if "#" in path.resolve().name else None - match loadingOptions: - case cwl_v1_0.LoadingOptions(): - loadingOptions = cwl_v1_0.LoadingOptions( - fileuri=real_uri, baseuri=base_uri, copyfrom=loadingOptions - ) - return load_document_by_string( - loadingOptions.fetcher.fetch_text(real_uri), - real_uri, - loadingOptions, - id_, - load_all, - ) - case cwl_v1_1.LoadingOptions(): - loadingOptions = cwl_v1_1.LoadingOptions( - fileuri=real_uri, baseuri=base_uri, copyfrom=loadingOptions - ) - return load_document_by_string( - loadingOptions.fetcher.fetch_text(real_uri), - real_uri, - loadingOptions, - id_, - load_all, - ) - case cwl_v1_2.LoadingOptions(): - loadingOptions = cwl_v1_2.LoadingOptions( - fileuri=real_uri, baseuri=base_uri, copyfrom=loadingOptions - ) - return load_document_by_string( - loadingOptions.fetcher.fetch_text(real_uri), - real_uri, - loadingOptions, - id_, - load_all, - ) - case None: - loadingOptions = cwl_v1_2.LoadingOptions(fileuri=real_uri, baseuri=base_uri) - return load_document_by_string( - loadingOptions.fetcher.fetch_text(real_uri), - real_uri, - None, - id_, - load_all, - ) - case _: - raise ValidationException( - f"Unsupported loadingOptions type: {type(loadingOptions)}" - ) + loadingOptions = LoadingOptions( + fileuri=real_uri, baseuri=base_uri, copyfrom=loadingOptions + ) + return load_document_by_string( + loadingOptions.fetcher.fetch_text(real_uri), + real_uri, + loadingOptions, + id_, + load_all, + ) def load_document( @@ -382,7 +331,7 @@ def load_document( ) -> Any: """Load a CWL object from a serialized YAML string or a YAML object.""" if baseuri is None: - baseuri = cwl_v1_0.file_uri(str(Path.cwd())) + "/" + baseuri = file_uri(str(Path.cwd())) + "/" if isinstance(doc, str): return load_document_by_string(doc, baseuri, loadingOptions, id_) return load_document_by_yaml(doc, baseuri, loadingOptions, id_, load_all) @@ -414,17 +363,11 @@ def load_document_by_yaml( yaml["cwlVersion"] = version match version: case "v1.0": - result = cwl_v1_0.load_document_by_yaml( - yaml, uri, cast(Optional[cwl_v1_0.LoadingOptions], loadingOptions) - ) + result = cwl_v1_0.load_document_by_yaml(yaml, uri, loadingOptions) case "v1.1": - result = cwl_v1_1.load_document_by_yaml( - yaml, uri, cast(Optional[cwl_v1_1.LoadingOptions], loadingOptions) - ) + result = cwl_v1_1.load_document_by_yaml(yaml, uri, loadingOptions) case "v1.2": - result = cwl_v1_2.load_document_by_yaml( - yaml, uri, cast(Optional[cwl_v1_2.LoadingOptions], loadingOptions) - ) + result = cwl_v1_2.load_document_by_yaml(yaml, uri, loadingOptions) case None: raise ValidationException("could not get the cwlVersion") case _: @@ -450,7 +393,7 @@ def save( ) -> Any: """Convert a CWL Python object into a JSON/YAML serializable object.""" match val: - case cwl_v1_0.Saveable() | cwl_v1_1.Saveable() | cwl_v1_2.Saveable(): + case Saveable(): return val.save(top=top, base_url=base_url, relative_uris=relative_uris) case MutableSequence(): lst = [ diff --git a/src/cwl_utils/parser/cwl_v1_0.py b/src/cwl_utils/parser/cwl_v1_0.py index 02fe801e..60af0275 100644 --- a/src/cwl_utils/parser/cwl_v1_0.py +++ b/src/cwl_utils/parser/cwl_v1_0.py @@ -2,452 +2,63 @@ # This file was autogenerated using schema-salad-tool --codegen=python # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. - from __future__ import annotations -import copy -import logging import os -import pathlib import sys -import tempfile -import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 -import xml.sax # nosec -from abc import ABCMeta, abstractmethod -from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 -from collections.abc import MutableMapping, MutableSequence, Sequence -from io import StringIO -from itertools import chain -from mypy_extensions import i32, i64, mypyc_attr -from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 -from typing import Any, Final, Generic, TypeAlias, TypeVar, cast -from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit -from urllib.request import pathname2url - -from rdflib import Graph -from rdflib.plugins.parsers.notation3 import BadSyntax -from ruamel.yaml.comments import CommentedMap - -from schema_salad.exceptions import SchemaSaladException, ValidationException -from schema_salad.fetcher import DefaultFetcher, Fetcher, MemoryCachingFetcher -from schema_salad.sourceline import SourceLine, add_lc_filename -from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ +import uuid as _uuid__ +from collections.abc import Collection +from typing import ClassVar + +from schema_salad.runtime import ( + Saveable, + file_uri, + parse_errors, + prefix_url, + save, + save_relative_uri, +) if sys.version_info >= (3, 11): from typing import Self else: from typing_extensions import Self -_vocab: Final[dict[str, str]] = {} -_rvocab: Final[dict[str, str]] = {} - -_logger: Final = logging.getLogger("salad") - - -IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] -E = TypeVar("E", bound=str) -S = TypeVar("S", bound="Saveable") -T = TypeVar("T", covariant=True) - - -@mypyc_attr(native_class=True) -class LoadingOptions: - idx: Final[IdxType] - fileuri: Final[str | None] - baseuri: Final[str] - namespaces: Final[MutableMapping[str, str]] - schemas: Final[MutableSequence[str]] - original_doc: Final[Any | None] - addl_metadata: Final[MutableMapping[str, Any]] - fetcher: Final[Fetcher] - vocab: Final[dict[str, str]] - rvocab: Final[dict[str, str]] - cache: Final[CacheType] - imports: Final[list[str]] - includes: Final[list[str]] - no_link_check: Final[bool | None] - container: Final[str | None] - - def __init__( - self, - fetcher: Fetcher | None = None, - namespaces: dict[str, str] | None = None, - schemas: list[str] | None = None, - fileuri: str | None = None, - copyfrom: LoadingOptions | None = None, - original_doc: Any | None = None, - addl_metadata: dict[str, str] | None = None, - baseuri: str | None = None, - idx: IdxType | None = None, - imports: list[str] | None = None, - includes: list[str] | None = None, - no_link_check: bool | None = None, - container: str | None = None, - ) -> None: - """Create a LoadingOptions object.""" - self.original_doc = original_doc - - if idx is not None: - temp_idx = idx - else: - temp_idx = copyfrom.idx if copyfrom is not None else {} - self.idx = temp_idx - - if fileuri is not None: - temp_fileuri: str | None = fileuri - else: - temp_fileuri = copyfrom.fileuri if copyfrom is not None else None - self.fileuri = temp_fileuri - - if baseuri is not None: - temp_baseuri = baseuri - else: - temp_baseuri = copyfrom.baseuri if copyfrom is not None else "" - self.baseuri = temp_baseuri - - if namespaces is not None: - temp_namespaces: MutableMapping[str, str] = namespaces - else: - temp_namespaces = copyfrom.namespaces if copyfrom is not None else {} - self.namespaces = temp_namespaces - - if schemas is not None: - temp_schemas: MutableSequence[str] = schemas - else: - temp_schemas = copyfrom.schemas if copyfrom is not None else [] - self.schemas = temp_schemas - - if addl_metadata is not None: - temp_addl_metadata: MutableMapping[str, Any] = addl_metadata - else: - temp_addl_metadata = copyfrom.addl_metadata if copyfrom is not None else {} - self.addl_metadata = temp_addl_metadata - - if imports is not None: - temp_imports = imports - else: - temp_imports = copyfrom.imports if copyfrom is not None else [] - self.imports = temp_imports - - if includes is not None: - temp_includes = includes - else: - temp_includes = copyfrom.includes if copyfrom is not None else [] - self.includes = temp_includes - - if no_link_check is not None: - temp_no_link_check: bool | None = no_link_check - else: - temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False - self.no_link_check = temp_no_link_check - - if container is not None: - temp_container: str | None = container - else: - temp_container = copyfrom.container if copyfrom is not None else None - self.container = temp_container - - if fetcher is not None: - temp_fetcher = fetcher - elif copyfrom is not None: - temp_fetcher = copyfrom.fetcher - else: - import requests - from cachecontrol.caches import SeparateBodyFileCache - from cachecontrol.wrapper import CacheControl - - root = pathlib.Path(os.environ.get("HOME", tempfile.gettempdir())) - session = CacheControl( - requests.Session(), - cache=SeparateBodyFileCache(root / ".cache" / "salad"), - ) - temp_fetcher = DefaultFetcher({}, session) - self.fetcher = temp_fetcher - - self.cache = self.fetcher.cache if isinstance(self.fetcher, MemoryCachingFetcher) else {} - - if self.namespaces != {}: - temp_vocab = _vocab.copy() - temp_rvocab = _rvocab.copy() - for k, v in self.namespaces.items(): - temp_vocab[k] = v - temp_rvocab[v] = k - else: - temp_vocab = _vocab - temp_rvocab = _rvocab - self.vocab = temp_vocab - self.rvocab = temp_rvocab - - @property - def graph(self) -> Graph: - """Generate a merged rdflib.Graph from all entries in self.schemas.""" - graph = Graph() - if not self.schemas: - return graph - key: Final = str(hash(tuple(self.schemas))) - if key in self.cache: - return cast(Graph, self.cache[key]) - for schema in self.schemas: - fetchurl = ( - self.fetcher.urljoin(self.fileuri, schema) - if self.fileuri is not None - else pathlib.Path(schema).resolve().as_uri() - ) - if fetchurl not in self.cache or self.cache[fetchurl] is True: - _logger.debug("Getting external schema %s", fetchurl) - try: - content = self.fetcher.fetch_text(fetchurl) - except Exception as e: - _logger.warning("Could not load extension schema %s: %s", fetchurl, str(e)) - continue - newGraph = Graph() - err_msg = "unknown error" - for fmt in ["xml", "turtle"]: - try: - newGraph.parse(data=content, format=fmt, publicID=str(fetchurl)) - self.cache[fetchurl] = newGraph - graph += newGraph - break - except (xml.sax.SAXParseException, TypeError, BadSyntax) as e: - err_msg = str(e) - else: - _logger.warning("Could not load extension schema %s: %s", fetchurl, err_msg) - self.cache[key] = graph - return graph - - -@mypyc_attr(native_class=True) -class Saveable(metaclass=ABCMeta): - """Mark classes than have a save() and fromDoc() function.""" - - @classmethod - @abstractmethod - def fromDoc( - cls, - _doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None, - ) -> Self: - """Construct this object from the result of yaml.load().""" - - @abstractmethod - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - """Convert this object to a JSON/YAML friendly dictionary.""" - - -def load_field( - val: Any | None, - fieldtype: _Loader[T], - baseuri: str, - loadingOptions: LoadingOptions, - lc: Any | None = None, -) -> T: - """Load field.""" - if isinstance(val, MutableMapping): - if "$import" in val: - if loadingOptions.fileuri is None: - raise SchemaSaladException("Cannot load $import without fileuri") - url1: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$import"]) - result, metadata = _document_load_by_url( - fieldtype, - url1, - loadingOptions, - ) - loadingOptions.imports.append(url1) - return result - if "$include" in val: - if loadingOptions.fileuri is None: - raise SchemaSaladException("Cannot load $import without fileuri") - url2: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$include"]) - val = loadingOptions.fetcher.fetch_text(url2) - loadingOptions.includes.append(url2) - return fieldtype.load(val, baseuri, loadingOptions, lc=lc) +import schema_salad.metaschema +import copy +from abc import ABCMeta, abstractmethod +from collections.abc import MutableSequence, Sequence, MutableMapping +from io import StringIO +from itertools import chain +from typing import Literal, TypeVar # pylint: disable=unused-import # noqa: F401 +from collections.abc import Mapping +from typing import TypeAlias # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, cast, Generic +from urllib.parse import urldefrag, urlsplit, urlunsplit + +from mypy_extensions import i32, i64 # pylint: disable=unused-import # noqa: F401 +from mypy_extensions import mypyc_attr +from ruamel.yaml.comments import CommentedMap -save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str +from schema_salad.exceptions import ValidationException, SchemaSaladException +from schema_salad.runtime import ( + LoadingOptions, + convert_typing, + extract_type, + SaveableType, + FieldType, + EnumFieldType, ) +from schema_salad.sourceline import SourceLine, add_lc_filename +from schema_salad.utils import yaml_no_ts # requires schema-salad v8.2+ - -def extract_type(val_type: type[Any]) -> str: - """Take a type of value, and extracts the value as a string.""" - val_str: Final = str(val_type) - return val_str.split("'")[1] - - -def convert_typing(val_type: str) -> str: - """Normalize type names to schema-salad types.""" - if "None" in val_type: - return "null" - if "CommentedSeq" in val_type or "list" in val_type: - return "array" - if "CommentedMap" in val_type or "dict" in val_type: - return "object" - if "False" in val_type or "True" in val_type: - return "boolean" - return val_type - - -def parse_errors(error_message: str) -> tuple[str, str, str]: - """Parse error messages from several loaders into one error message.""" - if not error_message.startswith("Expected"): - return error_message, "", "" - vals: Final = error_message.split("\n") - if len(vals) == 1: - return error_message, "", "" - types1: Final = set() - for val in vals: - individual_vals = val.split(" ") - if val == "": - continue - if individual_vals[1] == "one": - individual_vals = val.split("(")[1].split(",") - for t in individual_vals: - types1.add(t.strip(" ").strip(")\n")) - elif individual_vals[2] == "").replace("'", "")) - elif individual_vals[0] == "Value": - types1.add(individual_vals[-1].strip(".")) - else: - types1.add(individual_vals[1].replace(",", "")) - types2: Final = {val for val in types1 if val != "NoneType"} - if "str" in types2: - types3 = {convert_typing(val) for val in types2 if "'" not in val} - else: - types3 = types2 - to_print = "" - for val in types3: - if "'" in val: - to_print = "value" if len(types3) == 1 else "values" - - if to_print == "": - to_print = "type" if len(types3) == 1 else "types" - - verb_tensage: Final = "is" if len(types3) == 1 else "are" - - return str(types3).replace("{", "(").replace("}", ")").replace("'", ""), to_print, verb_tensage - - -def save( - val: Any, - top: bool = True, - base_url: str = "", - relative_uris: bool = True, -) -> save_type: - if isinstance(val, Saveable): - return val.save(top=top, base_url=base_url, relative_uris=relative_uris) - if isinstance(val, MutableSequence): - return [save(v, top=False, base_url=base_url, relative_uris=relative_uris) for v in val] - if isinstance(val, MutableMapping): - newdict: Final = {} - for key in val: - newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) - return newdict - if val is None or isinstance(val, (i32, i64, float, bool, str)): - return val - raise Exception("Not Saveable: %s" % type(val)) - - -def save_with_metadata( - val: Any, - valLoadingOpts: LoadingOptions, - top: bool = True, - base_url: str = "", - relative_uris: bool = True, -) -> save_type: - """Save and set $namespaces, $schemas, $base and any other metadata fields at the top level.""" - saved_val: Final = save(val, top, base_url, relative_uris) - newdict: MutableMapping[str, Any] = {} - if isinstance(saved_val, MutableSequence): - newdict = {"$graph": saved_val} - elif isinstance(saved_val, MutableMapping): - newdict = saved_val - - if valLoadingOpts.namespaces: - newdict["$namespaces"] = valLoadingOpts.namespaces - if valLoadingOpts.schemas: - newdict["$schemas"] = valLoadingOpts.schemas - if valLoadingOpts.baseuri: - newdict["$base"] = valLoadingOpts.baseuri - for k, v in valLoadingOpts.addl_metadata.items(): - if k not in newdict: - newdict[k] = v - - return newdict - - -def expand_url( - url: str, - base_url: str, - loadingOptions: LoadingOptions, - scoped_id: bool = False, - vocab_term: bool = False, - scoped_ref: int | None = None, -) -> str: - if url in ("@id", "@type"): - return url - - if vocab_term and url in loadingOptions.vocab: - return url - - if bool(loadingOptions.vocab) and ":" in url: - prefix: Final = url.split(":")[0] - if prefix in loadingOptions.vocab: - url = loadingOptions.vocab[prefix] + url[len(prefix) + 1 :] - - split1: Final = urlsplit(url) - - if ( - (bool(split1.scheme) and split1.scheme in loadingOptions.fetcher.supported_schemes()) - or url.startswith("$(") - or url.startswith("${") - ): - pass - elif scoped_id and not bool(split1.fragment): - splitbase1: Final = urlsplit(base_url) - frg: str - if bool(splitbase1.fragment): - frg = splitbase1.fragment + "/" + split1.path - else: - frg = split1.path - pt: Final = splitbase1.path if splitbase1.path != "" else "/" - url = urlunsplit((splitbase1.scheme, splitbase1.netloc, pt, splitbase1.query, frg)) - elif scoped_ref is not None and not bool(split1.fragment): - splitbase2: Final = urlsplit(base_url) - sp = splitbase2.fragment.split("/") - n = scoped_ref - while n > 0 and len(sp) > 0: - sp.pop() - n -= 1 - sp.append(url) - url = urlunsplit( - ( - splitbase2.scheme, - splitbase2.netloc, - splitbase2.path, - splitbase2.query, - "/".join(sp), - ) - ) - else: - url = loadingOptions.fetcher.urljoin(base_url, url) - - if vocab_term: - split2: Final = urlsplit(url) - if bool(split2.scheme): - if url in loadingOptions.rvocab: - return loadingOptions.rvocab[url] - else: - raise ValidationException(f"Term {url!r} not in vocabulary") - - return url +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} @mypyc_attr(native_class=True) -class _Loader(Generic[T], metaclass=ABCMeta): +class _Loader(Generic[FieldType], metaclass=ABCMeta): @abstractmethod def load( self, @@ -456,7 +67,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: ... + ) -> FieldType: ... @mypyc_attr(native_class=True) @@ -475,8 +86,8 @@ def load( @mypyc_attr(native_class=True) -class _PrimitiveLoader(_Loader[T]): - def __init__(self, tp: type[T]) -> None: +class _PrimitiveLoader(_Loader[FieldType]): + def __init__(self, tp: type[FieldType]) -> None: self.tp: Final = tp def load( @@ -486,7 +97,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -496,8 +107,8 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _ArrayLoader(_Loader[Sequence[T]]): - def __init__(self, items: _Loader[T]) -> None: +class _ArrayLoader(_Loader[Sequence[FieldType]]): + def __init__(self, items: _Loader[FieldType]) -> None: self.items: Final = items def load( @@ -507,7 +118,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> list[T]: + ) -> list[FieldType]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -518,7 +129,7 @@ def load( fields: Final[list[str]] = [] for i in range(0, len(doc)): try: - lf = load_field( + lf = _load_field( doc[i], _UnionLoader([self, self.items]), baseuri, loadingOptions, lc=lc ) flatten = loadingOptions.container != "@list" @@ -554,10 +165,10 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _MapLoader(_Loader[Mapping[str, T]]): +class _MapLoader(_Loader[Mapping[str, FieldType]]): def __init__( self, - values: _Loader[T], + values: _Loader[FieldType], name: str | None = None, container: str | None = None, no_link_check: bool | None = None, @@ -574,7 +185,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> dict[str, T]: + ) -> dict[str, FieldType]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -585,7 +196,7 @@ def load( errors: Final[list[SchemaSaladException]] = [] for k, v in doc.items(): try: - lf = load_field(v, self.values, baseuri, loadingOptions, lc) + lf = _load_field(v, self.values, baseuri, loadingOptions, lc) r[k] = lf except ValidationException as e: errors.append(e.with_sourceline(SourceLine(doc, k, str))) @@ -598,7 +209,7 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _EnumLoader(_Loader[E]): +class _EnumLoader(_Loader[EnumFieldType]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -610,9 +221,9 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> E: + ) -> EnumFieldType: if doc in self.symbols: - return cast(E, doc) + return cast(EnumFieldType, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -620,8 +231,8 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _SecondaryDSLLoader(_Loader[T]): - def __init__(self, inner: _Loader[T]) -> None: +class _SecondaryDSLLoader(_Loader[FieldType]): + def __init__(self, inner: _Loader[FieldType]) -> None: self.inner: Final = inner def load( @@ -631,7 +242,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: r: Final[list[dict[str, Any]]] = [] match doc: case MutableSequence() as dlist: @@ -694,10 +305,10 @@ def load( @mypyc_attr(native_class=True) -class _RecordLoader(_Loader[S]): +class _RecordLoader(_Loader[SaveableType]): def __init__( self, - classtype: type[S], + classtype: type[SaveableType], container: str | None = None, no_link_check: bool | None = None, ) -> None: @@ -712,7 +323,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> S: + ) -> SaveableType: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -751,12 +362,12 @@ def load( @mypyc_attr(native_class=True) -class _UnionLoader(_Loader[T]): - def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: +class _UnionLoader(_Loader[FieldType]): + def __init__(self, alternates: Sequence[_Loader[FieldType]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[FieldType]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -766,7 +377,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: errors: Final = [] if lc is None: @@ -842,10 +453,10 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _URILoader(_Loader[T]): +class _URILoader(_Loader[FieldType]): def __init__( self, - inner: _Loader[T], + inner: _Loader[FieldType], scoped_id: bool, vocab_term: bool, scoped_ref: int | None, @@ -864,7 +475,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check @@ -875,7 +486,7 @@ def load( for i in decl: if isinstance(i, str): newdoc.append( - expand_url( + _expand_url( i, baseuri, loadingOptions, @@ -888,7 +499,7 @@ def load( newdoc.append(i) doc = newdoc case str(decl): - doc = expand_url( + doc = _expand_url( decl, baseuri, loadingOptions, @@ -912,8 +523,13 @@ def load( @mypyc_attr(native_class=True) -class _TypeDSLLoader(_Loader[T]): - def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: +class _TypeDSLLoader(_Loader[FieldType]): + def __init__( + self, + inner: _Loader[FieldType], + refScope: int | None, + salad_version: str, + ) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -939,14 +555,35 @@ def resolve( # To show the error message with the original type return doc else: - items = expand_url(rest, baseuri, loadingOptions, False, True, self.refScope) + items = _expand_url( + rest, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) else: items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): - items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) + items = _expand_url( + items, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) expanded: dict[str, Any] | str = {"type": "array", "items": items} else: - expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) + expanded = _expand_url( + doc_, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) if optional: return ["null", expanded] @@ -960,7 +597,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -982,9 +619,10 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -@mypyc_attr(native_class=True) -class _IdMapLoader(_Loader[T]): - def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: +class _IdMapLoader(_Loader[FieldType]): + def __init__( + self, inner: _Loader[FieldType], mapSubject: str, mapPredicate: str | None + ) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -996,7 +634,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -1023,12 +661,12 @@ def load( def _document_load( - loader: _Loader[T], + loader: _Loader[FieldType], doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[T, LoadingOptions]: +) -> tuple[FieldType, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1093,11 +731,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader[T], + loader: _Loader[FieldType], url: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[T, LoadingOptions]: +) -> tuple[FieldType, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1123,79 +761,101 @@ def _document_load_by_url( return loadingOptions.idx[url] -def file_uri(path: str, split_frag: bool = False) -> str: - """Transform a file path into a URL with file scheme.""" - if path.startswith("file://"): - return path - if split_frag: - pathsp: Final = path.split("#", 2) - frag = "#" + quote(str(pathsp[1])) if len(pathsp) == 2 else "" - urlpath = pathname2url(str(pathsp[0])) - else: - urlpath = pathname2url(path) - frag = "" - if urlpath.startswith("//"): - return f"file:{urlpath}{frag}" - return f"file://{urlpath}{frag}" - - -def prefix_url(url: str, namespaces: dict[str, str]) -> str: - """Expand short forms into full URLs using the given namespace dictionary.""" - for k, v in namespaces.items(): - if url.startswith(v): - return k + ":" + url[len(v) :] - return url +def _expand_url( + url: str, + base_url: str, + loadingOptions: LoadingOptions, + scoped_id: bool = False, + vocab_term: bool = False, + scoped_ref: int | None = None, +) -> str: + if url in ("@id", "@type"): + return url + + vocab = _vocab | loadingOptions.vocab + if vocab_term and url in vocab: + return url + if bool(vocab) and ":" in url: + prefix: Final = url.split(":")[0] + if prefix in vocab: + url = vocab[prefix] + url[len(prefix) + 1 :] -def save_relative_uri( - uri: Any, - base_url: str, - scoped_id: bool, - ref_scope: int | None, - relative_uris: bool, -) -> Any: - """Convert any URI to a relative one, obeying the scoping rules.""" - if isinstance(uri, MutableSequence): - return [save_relative_uri(u, base_url, scoped_id, ref_scope, relative_uris) for u in uri] - elif isinstance(uri, str): - if not relative_uris or uri == base_url: - return uri - urisplit: Final = urlsplit(uri) - basesplit: Final = urlsplit(base_url) - if urisplit.scheme == basesplit.scheme and urisplit.netloc == basesplit.netloc: - if urisplit.path != basesplit.path: - p = os.path.relpath(urisplit.path, os.path.dirname(basesplit.path)) - if urisplit.fragment: - p = p + "#" + urisplit.fragment - return p - - basefrag = basesplit.fragment + "/" - if ref_scope: - sp = basefrag.split("/") - i = 0 - while i < ref_scope: - sp.pop() - i += 1 - basefrag = "/".join(sp) - - if urisplit.fragment.startswith(basefrag): - return urisplit.fragment[len(basefrag) :] - return urisplit.fragment - return uri + split1: Final = urlsplit(url) + + if ( + (bool(split1.scheme) and split1.scheme in loadingOptions.fetcher.supported_schemes()) + or url.startswith("$(") + or url.startswith("${") + ): + pass + elif scoped_id and not bool(split1.fragment): + splitbase1: Final = urlsplit(base_url) + frg: str + if bool(splitbase1.fragment): + frg = splitbase1.fragment + "/" + split1.path + else: + frg = split1.path + pt: Final = splitbase1.path if splitbase1.path != "" else "/" + url = urlunsplit((splitbase1.scheme, splitbase1.netloc, pt, splitbase1.query, frg)) + elif scoped_ref is not None and not bool(split1.fragment): + splitbase2: Final = urlsplit(base_url) + sp = splitbase2.fragment.split("/") + n = scoped_ref + while n > 0 and len(sp) > 0: + sp.pop() + n -= 1 + sp.append(url) + url = urlunsplit( + ( + splitbase2.scheme, + splitbase2.netloc, + splitbase2.path, + splitbase2.query, + "/".join(sp), + ) + ) else: - return save(uri, top=False, base_url=base_url, relative_uris=relative_uris) + url = loadingOptions.fetcher.urljoin(base_url, url) + + if vocab_term: + split2: Final = urlsplit(url) + if bool(split2.scheme): + if url in (rvocab := _rvocab | loadingOptions.rvocab): + return rvocab[url] + else: + raise ValidationException(f"Term {url!r} not in vocabulary") + return url -def shortname(inputid: str) -> str: - """ - Compute the shortname of a fully qualified identifier. - See https://w3id.org/cwl/v1.2/SchemaSalad.html#Short_names. - """ - parsed_id: Final = urlparse(inputid) - if parsed_id.fragment: - return parsed_id.fragment.split("/")[-1] - return parsed_id.path.split("/")[-1] +def _load_field( + val: Any | None, + fieldtype: _Loader[FieldType], + baseuri: str, + loadingOptions: LoadingOptions, + lc: Any | None = None, +) -> FieldType: + """Load field.""" + if isinstance(val, MutableMapping): + if "$import" in val: + if loadingOptions.fileuri is None: + raise SchemaSaladException("Cannot load $import without fileuri") + url1: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$import"]) + result, metadata = _document_load_by_url( + fieldtype, + url1, + loadingOptions, + ) + loadingOptions.imports.append(url1) + return result + if "$include" in val: + if loadingOptions.fileuri is None: + raise SchemaSaladException("Cannot load $import without fileuri") + url2: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$include"]) + val = loadingOptions.fetcher.fetch_text(url2) + loadingOptions.includes.append(url2) + return fieldtype.load(val, baseuri, loadingOptions, lc=lc) def parser_info() -> str: @@ -1203,15 +863,211 @@ def parser_info() -> str: @mypyc_attr(native_class=True) -class RecordField(Saveable): - """ - A field of a record. - """ +class CWLArraySchema(schema_salad.metaschema.ArraySchema): + def __eq__(self, other: Any) -> bool: + if isinstance(other, CWLArraySchema): + return bool(self.items == other.items and self.type_ == other.type_) + return False + + def __hash__(self) -> int: + return hash((self.items, self.type_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) + + items = _load_field( + _doc.get("items"), + uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `items`, `type`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + items=items, + type_=type_, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.items is not None: + u = save_relative_uri(self.items, base_url, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + items: CWLArraySchema | CWLRecordSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | PrimitiveType | schema_salad.metaschema.EnumSchema | str] | schema_salad.metaschema.EnumSchema | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordField(schema_salad.metaschema.RecordField): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, RecordField): + if isinstance(other, CWLRecordField): return bool( self.doc == other.doc and self.name == other.name @@ -1239,7 +1095,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_strtype_True_False_None_None, baseuri, @@ -1295,7 +1151,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -1343,9 +1199,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2, + typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -1395,7 +1251,7 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] @@ -1455,7 +1311,7 @@ def save( def __init__( self, name: str, - type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: CWLArraySchema | CWLRecordSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | PrimitiveType | schema_salad.metaschema.EnumSchema | str] | schema_salad.metaschema.EnumSchema | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1476,9 +1332,9 @@ def __init__( @mypyc_attr(native_class=True) -class RecordSchema(Saveable): +class CWLRecordSchema(schema_salad.metaschema.RecordSchema): def __eq__(self, other: Any) -> bool: - if isinstance(other, RecordSchema): + if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) return False @@ -1502,9 +1358,9 @@ def fromDoc( fields = None if "fields" in _doc: try: - fields = load_field( + fields = _load_field( _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader, + idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader, baseuri, loadingOptions, lc=_doc.get("fields") @@ -1550,7 +1406,7 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), typedsl_Record_nameLoader_2, baseuri, @@ -1602,7 +1458,7 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] @@ -1657,7 +1513,7 @@ def save( def __init__( self, type_: Record_name, - fields: None | Sequence[RecordField] = None, + fields: None | Sequence[CWLRecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -1676,25 +1532,69 @@ def __init__( @mypyc_attr(native_class=True) -class EnumSchema(Saveable): +class File(Saveable): """ - Define an enumerated type. + Represents a file (or group of files when ``secondaryFiles`` is provided) that will be accessible by tools using standard POSIX file system call API such as open(2) and read(2). - """ + Files are represented as objects with ``class`` of ``File``. File objects have a number of properties that provide metadata about the file. - name: str + The ``location`` property of a File is a URI that uniquely identifies the file. Implementations must support the file:// URI scheme and may support other schemes such as http://. The value of ``location`` may also be a relative reference, in which case it must be resolved relative to the URI of the document it appears in. Alternately to ``location``, implementations must also accept the ``path`` property on File, which must be a filesystem path available on the same host as the CWL runner (for inputs) or the runtime environment of a command line tool execution (for command line tool outputs). + + If no ``location`` or ``path`` is specified, a file object must specify ``contents`` with the UTF-8 text content of the file. This is a "file literal". File literals do not correspond to external resources, but are created on disk with ``contents`` with when needed for a executing a tool. Where appropriate, expressions can return file literals to define new files on a runtime. The maximum size of ``contents`` is 64 kilobytes. + + The ``basename`` property defines the filename on disk where the file is staged. This may differ from the resource name. If not provided, ``basename`` must be computed from the last path part of ``location`` and made available to expressions. + + The ``secondaryFiles`` property is a list of File or Directory objects that must be staged in the same directory as the primary file. It is an error for file names to be duplicated in ``secondaryFiles``. + + The ``size`` property is the size in bytes of the File. It must be computed from the resource and made available to expressions. The ``checksum`` field contains a cryptographic hash of the file content for use it verifying file contents. Implementations may, at user option, enable or disable computation of the ``checksum`` field for performance or other reasons. However, the ability to compute output checksums is required to pass the CWL conformance test suite. + + When executing a CommandLineTool, the files and secondary files may be staged to an arbitrary directory, but must use the value of ``basename`` for the filename. The ``path`` property must be file path in the context of the tool execution runtime (local to the compute node, or within the executing container). All computed properties should be available to expressions. File literals also must be staged and ``path`` must be set. + + When collecting CommandLineTool outputs, ``glob`` matching returns file paths (with the ``path`` property) and the derived properties. This can all be modified by ``outputEval``. Alternately, if the file ``cwl.output.json`` is present in the output, ``outputBinding`` is ignored. + + File objects in the output must provide either a ``location`` URI or a ``path`` property in the context of the tool execution runtime (local to the compute node, or within the executing container). + + When evaluating an ExpressionTool, file objects must be referenced via ``location`` (the expression tool does not have access to files on disk so ``path`` is meaningless) or as file literals. It is legal to return a file object with an existing ``location`` but a different ``basename``. The ``loadContents`` field of ExpressionTool inputs behaves the same as on CommandLineTool inputs, however it is not meaningful on the outputs. + + An ExpressionTool may forward file references from input to output by using the same value for ``location``. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, EnumSchema): + if isinstance(other, File): return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ + self.class_ == other.class_ + and self.location == other.location + and self.path == other.path + and self.basename == other.basename + and self.dirname == other.dirname + and self.nameroot == other.nameroot + and self.nameext == other.nameext + and self.checksum == other.checksum + and self.size == other.size + and self.secondaryFiles == other.secondaryFiles + and self.format == other.format + and self.contents == other.contents ) return False def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_)) + return hash( + ( + self.class_, + self.location, + self.path, + self.basename, + self.dirname, + self.nameroot, + self.nameext, + self.checksum, + self.size, + self.secondaryFiles, + self.format, + self.contents, + ) + ) @classmethod def fromDoc( @@ -1710,21 +1610,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_File_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + location = None + if "location" in _doc: + try: + location = _load_field( + _doc.get("location"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("location") + ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `location`": _errors__.append( ValidationException( str(e), @@ -1732,13 +1649,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("location") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -1750,340 +1667,499 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `location` field with value `{val}` " "is not valid because:", ) ) + path = None + if "path" in _doc: + try: + path = _load_field( + _doc.get("path"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("path") + ) - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `path`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("path") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [e], + detailed_message=f"the `path` field with value `{val}` " + "is not valid because:", + ) + ) + basename = None + if "basename" in _doc: + try: + basename = _load_field( + _doc.get("basename"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("basename") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `basename`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + val = _doc.get("basename") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [e], + detailed_message=f"the `basename` field with value `{val}` " + "is not valid because:", + ) + ) + dirname = None + if "dirname" in _doc: + try: + dirname = _load_field( + _doc.get("dirname"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("dirname") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `dirname`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("dirname") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `dirname` field is not valid because:", + SourceLine(_doc, "dirname", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `dirname` field is not valid because:", + SourceLine(_doc, "dirname", str), + [e], + detailed_message=f"the `dirname` field with value `{val}` " + "is not valid because:", + ) + ) + nameroot = None + if "nameroot" in _doc: + try: + nameroot = _load_field( + _doc.get("nameroot"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("nameroot") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `nameroot`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`".format( - k - ), - SourceLine(_doc, k, str), + val = _doc.get("nameroot") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `nameroot` field is not valid because:", + SourceLine(_doc, "nameroot", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) - - -@mypyc_attr(native_class=True) -class ArraySchema(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, ArraySchema): - return bool(self.items == other.items and self.type_ == other.type_) - return False - - def __hash__(self) -> int: - return hash((self.items, self.type_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) + else: + _errors__.append( + ValidationException( + "the `nameroot` field is not valid because:", + SourceLine(_doc, "nameroot", str), + [e], + detailed_message=f"the `nameroot` field with value `{val}` " + "is not valid because:", + ) + ) + nameext = None + if "nameext" in _doc: + try: + nameext = _load_field( + _doc.get("nameext"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("nameext") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `nameext`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", + val = _doc.get("nameext") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `nameext` field is not valid because:", + SourceLine(_doc, "nameext", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + _errors__.append( + ValidationException( + "the `nameext` field is not valid because:", + SourceLine(_doc, "nameext", str), + [e], + detailed_message=f"the `nameext` field with value `{val}` " + "is not valid because:", + ) + ) + checksum = None + if "checksum" in _doc: + try: + checksum = _load_field( + _doc.get("checksum"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("checksum") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `checksum`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: + val = _doc.get("checksum") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `checksum` field is not valid because:", + SourceLine(_doc, "checksum", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `checksum` field is not valid because:", + SourceLine(_doc, "checksum", str), + [e], + detailed_message=f"the `checksum` field with value `{val}` " + "is not valid because:", + ) + ) + size = None + if "size" in _doc: + try: + size = _load_field( + _doc.get("size"), + union_of_None_type_or_inttype_or_longtype, + baseuri, + loadingOptions, + lc=_doc.get("size") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `size`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("size") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `size` field is not valid because:", + SourceLine(_doc, "size", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `size` field is not valid because:", + SourceLine(_doc, "size", str), + [e], + detailed_message=f"the `size` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `secondaryFiles`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + contents = None + if "contents" in _doc: + try: + contents = _load_field( + _doc.get("contents"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("contents") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `contents`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("contents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `contents` field is not valid because:", + SourceLine(_doc, "contents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `contents` field is not valid because:", + SourceLine(_doc, "contents", str), + [e], + detailed_message=f"the `contents` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: if not k: _errors__.append( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`".format( + "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `dirname`, `nameroot`, `nameext`, `checksum`, `size`, `secondaryFiles`, `format`, `contents`".format( k ), SourceLine(_doc, k, str), @@ -2093,8 +2169,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - items=items, - type_=type_, + location=location, + path=path, + basename=basename, + dirname=dirname, + nameroot=nameroot, + nameext=nameext, + checksum=checksum, + size=size, + secondaryFiles=secondaryFiles, + format=format, + contents=contents, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2111,26 +2196,82 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.location is not None: + u = save_relative_uri(self.location, base_url, False, None, relative_uris) + r["location"] = u + if self.path is not None: + u = save_relative_uri(self.path, base_url, False, None, relative_uris) + r["path"] = u + if self.basename is not None: + r["basename"] = save( + self.basename, top=False, base_url=base_url, relative_uris=relative_uris ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - + if self.dirname is not None: + r["dirname"] = save( + self.dirname, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.nameroot is not None: + r["nameroot"] = save( + self.nameroot, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.nameext is not None: + r["nameext"] = save( + self.nameext, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.checksum is not None: + r["checksum"] = save( + self.checksum, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.size is not None: + r["size"] = save( + self.size, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.format is not None: + u = save_relative_uri(self.format, base_url, True, None, relative_uris) + r["format"] = u + if self.contents is not None: + r["contents"] = save( + self.contents, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + def __init__( self, - items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Array_name, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | i32 | i64 = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2142,21 +2283,77 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.class_: Final[str] = "File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents - attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "location", + "path", + "basename", + "dirname", + "nameroot", + "nameext", + "checksum", + "size", + "secondaryFiles", + "format", + "contents", + ] + ) @mypyc_attr(native_class=True) -class MapSchema(Saveable): +class Directory(Saveable): + """ + Represents a directory to present to a command line tool. + + Directories are represented as objects with ``class`` of ``Directory``. Directory objects have a number of properties that provide metadata about the directory. + + The ``location`` property of a Directory is a URI that uniquely identifies the directory. Implementations must support the file:// URI scheme and may support other schemes such as http://. Alternately to ``location``, implementations must also accept the ``path`` property on Directory, which must be a filesystem path available on the same host as the CWL runner (for inputs) or the runtime environment of a command line tool execution (for command line tool outputs). + + A Directory object may have a ``listing`` field. This is a list of File and Directory objects that are contained in the Directory. For each entry in ``listing``, the ``basename`` property defines the name of the File or Subdirectory when staged to disk. If ``listing`` is not provided, the implementation must have some way of fetching the Directory listing at runtime based on the ``location`` field. + + If a Directory does not have ``location``, it is a Directory literal. A Directory literal must provide ``listing``. Directory literals must be created on disk at runtime as needed. + + The resources in a Directory literal do not need to have any implied relationship in their ``location``. For example, a Directory listing may contain two files located on different hosts. It is the responsibility of the runtime to ensure that those files are staged to disk appropriately. Secondary files associated with files in ``listing`` must also be staged to the same Directory. + + When executing a CommandLineTool, Directories must be recursively staged first and have local values of ``path`` assigned. + + Directory objects in CommandLineTool output must provide either a ``location`` URI or a ``path`` property in the context of the tool execution runtime (local to the compute node, or within the executing container). + + An ExpressionTool may forward file references from input to output by using the same value for ``location``. + + Name conflicts (the same ``basename`` appearing multiple times in ``listing`` or in any entry in ``secondaryFiles`` in the listing) is a fatal error. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, MapSchema): - return bool(self.type_ == other.type_ and self.values == other.values) + if isinstance(other, Directory): + return bool( + self.class_ == other.class_ + and self.location == other.location + and self.path == other.path + and self.basename == other.basename + and self.listing == other.listing + ) return False def __hash__(self) -> int: - return hash((self.type_, self.values)) + return hash( + (self.class_, self.location, self.path, self.basename, self.listing) + ) @classmethod def fromDoc( @@ -2173,117 +2370,226 @@ def fromDoc( _doc.lc.filename = doc.lc.filename _errors__ = [] try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Map_nameLoader_2, + class_ = _load_field( + _doc.get("class"), + uri_Directory_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) + raise e + location = None + if "location" in _doc: + try: + location = _load_field( + _doc.get("location"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("location") ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `location`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + val = _doc.get("location") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("values") is None: - raise ValidationException("missing required field `values`", None, []) - - values = load_field( - _doc.get("values"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("values") - ) + else: + _errors__.append( + ValidationException( + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), + [e], + detailed_message=f"the `location` field with value `{val}` " + "is not valid because:", + ) + ) + path = None + if "path" in _doc: + try: + path = _load_field( + _doc.get("path"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("path") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `values`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("values") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `path`": _errors__.append( ValidationException( - "the `values` field is not valid because:", - SourceLine(_doc, "values", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `values` field is not valid because:", - SourceLine(_doc, "values", str), - [e], - detailed_message=f"the `values` field with value `{val}` " - "is not valid because:", + val = _doc.get("path") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `type`, `values`".format( + else: + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [e], + detailed_message=f"the `path` field with value `{val}` " + "is not valid because:", + ) + ) + basename = None + if "basename" in _doc: + try: + basename = _load_field( + _doc.get("basename"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("basename") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `basename`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("basename") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [e], + detailed_message=f"the `basename` field with value `{val}` " + "is not valid because:", + ) + ) + listing = None + if "listing" in _doc: + try: + listing = _load_field( + _doc.get("listing"), + union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, + baseuri, + loadingOptions, + lc=_doc.get("listing") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `listing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("listing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [e], + detailed_message=f"the `listing` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `listing`".format( k ), SourceLine(_doc, k, str), @@ -2293,8 +2599,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - type_=type_, - values=values, + location=location, + path=path, + basename=basename, + listing=listing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2311,13 +2619,30 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.location is not None: + u = save_relative_uri(self.location, base_url, False, None, relative_uris) + r["location"] = u + if self.path is not None: + u = save_relative_uri(self.path, base_url, False, None, relative_uris) + r["path"] = u + if self.basename is not None: + r["basename"] = save( + self.basename, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.listing is not None: + r["listing"] = save( + self.listing, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.values is not None: - u = save_relative_uri(self.values, base_url, False, 2, relative_uris) - r["values"] = u # top refers to the directory level if top: @@ -2329,8 +2654,10 @@ def save( def __init__( self, - type_: Map_name, - values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2342,21 +2669,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.class_: Final[str] = "Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing - attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) @mypyc_attr(native_class=True) -class UnionSchema(Saveable): +class InputRecordField(CWLRecordField): + name: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, UnionSchema): - return bool(self.names == other.names and self.type_ == other.type_) + if isinstance(other, InputRecordField): + return bool( + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.inputBinding == other.inputBinding + and self.label == other.label + ) return False def __hash__(self) -> int: - return hash((self.names, self.type_)) + return hash((self.doc, self.name, self.type_, self.inputBinding, self.label)) @classmethod def fromDoc( @@ -2372,76 +2712,131 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("names") is None: - raise ValidationException("missing required field `names`", None, []) - - names = load_field( - _doc.get("names"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("names") - ) + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `names`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("names") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `name`": _errors__.append( ValidationException( - "the `names` field is not valid because:", - SourceLine(_doc, "names", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `names` field is not valid because:", - SourceLine(_doc, "names", str), - [e], - detailed_message=f"the `names` field with value `{val}` " - "is not valid because:", + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Union_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) else: val = _doc.get("type") if error_message != str(e): @@ -2468,6 +2863,100 @@ def fromDoc( "is not valid because:", ) ) + inputBinding = None + if "inputBinding" in _doc: + try: + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [e], + detailed_message=f"the `inputBinding` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -2476,14 +2965,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `names`, `type`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `inputBinding`, `label`".format( k ), SourceLine(_doc, k, str), @@ -2493,11 +2982,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - names=names, + name=name, + doc=doc, type_=type_, + inputBinding=inputBinding, + label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -2511,12 +3004,27 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.names is not None: - u = save_relative_uri(self.names, base_url, False, 2, relative_uris) - r["names"] = u + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) if self.type_ is not None: r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -2529,8 +3037,11 @@ def save( def __init__( self, - names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Union_name, + name: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + label: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2542,21 +3053,33 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names + self.doc = doc + self.name = name self.type_ = type_ + self.inputBinding = inputBinding + self.label = label - attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "inputBinding", "label"] + ) @mypyc_attr(native_class=True) -class CWLArraySchema(ArraySchema): +class InputRecordSchema(CWLRecordSchema): + name: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLArraySchema): - return bool(self.items == other.items and self.type_ == other.type_) + if isinstance(other, InputRecordSchema): + return bool( + self.fields == other.fields + and self.type_ == other.type_ + and self.label == other.label + and self.name == other.name + ) return False def __hash__(self) -> int: - return hash((self.items, self.type_)) + return hash((self.fields, self.type_, self.label, self.name)) @classmethod def fromDoc( @@ -2572,61 +3095,115 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `name`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + fields = None + if "fields" in _doc: + try: + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader, + baseuri, + loadingOptions, + lc=_doc.get("fields") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `fields`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) + else: + val = _doc.get("fields") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [e], + detailed_message=f"the `fields` field with value `{val}` " + "is not valid because:", + ) + ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Array_nameLoader_2, + typedsl_Record_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -2668,6 +3245,53 @@ def fromDoc( "is not valid because:", ) ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -2676,14 +3300,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `name`".format( k ), SourceLine(_doc, k, str), @@ -2693,11 +3317,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - items=items, + name=name, + fields=fields, type_=type_, + label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -2711,12 +3338,20 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=self.name, relative_uris=relative_uris + ) if self.type_ is not None: r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -2729,8 +3364,10 @@ def save( def __init__( self, - items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, - type_: Array_name, + type_: Record_name, + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2742,27 +3379,33 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.fields = fields self.type_ = type_ + self.label = label + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @mypyc_attr(native_class=True) -class CWLRecordField(RecordField): +class InputEnumSchema(schema_salad.metaschema.EnumSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLRecordField): + if isinstance(other, InputEnumSchema): return bool( - self.doc == other.doc - and self.name == other.name + self.name == other.name + and self.symbols == other.symbols and self.type_ == other.type_ + and self.label == other.label + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash((self.doc, self.name, self.type_)) + return hash( + (self.name, self.symbols, self.type_, self.label, self.inputBinding) + ) @classmethod def fromDoc( @@ -2781,9 +3424,9 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), - uri_strtype_True_False_None_None, + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("name") @@ -2830,73 +3473,25 @@ def fromDoc( if docRoot is not None: name = docRoot else: - name = "" - _errors__.append(ValidationException("missing name")) + name = "_:" + str(_uuid__.uuid4()) else: baseuri = name - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2, + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("symbols") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `symbols`": _errors__.append( ValidationException( str(e), @@ -2904,13 +3499,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("symbols") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -2922,29 +3517,171 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `symbols` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Enum_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + inputBinding = None + if "inputBinding" in _doc: + try: + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [e], + detailed_message=f"the `inputBinding` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): if k not in cls.attrs: if not k: _errors__.append( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -2955,8 +3692,10 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - doc=doc, + symbols=symbols, type_=type_, + label=label, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2977,14 +3716,24 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) # top refers to the directory level if top: @@ -2996,9 +3745,11 @@ def save( def __init__( self, - name: str, - type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, - doc: None | Sequence[str] | str = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -3010,22 +3761,31 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ + self.label = label + self.inputBinding = inputBinding - attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "inputBinding"] + ) @mypyc_attr(native_class=True) -class CWLRecordSchema(RecordSchema): +class InputArraySchema(CWLArraySchema): def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLRecordSchema): - return bool(self.fields == other.fields and self.type_ == other.type_) + if isinstance(other, InputArraySchema): + return bool( + self.items == other.items + and self.type_ == other.type_ + and self.label == other.label + and self.inputBinding == other.inputBinding + ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_)) + return hash((self.items, self.type_, self.label, self.inputBinding)) @classmethod def fromDoc( @@ -3041,69 +3801,22 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - fields = None - if "fields" in _doc: - try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader, - baseuri, - loadingOptions, - lc=_doc.get("fields") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `fields`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("fields") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [e], - detailed_message=f"the `fields` field with value `{val}` " - "is not valid because:", - ) - ) try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("items") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `items`": _errors__.append( ValidationException( str(e), @@ -3111,13 +3824,61 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("items") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3136,6 +3897,100 @@ def fromDoc( "is not valid because:", ) ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + inputBinding = None + if "inputBinding" in _doc: + try: + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [e], + detailed_message=f"the `inputBinding` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -3144,14 +3999,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -3161,8 +4016,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - fields=fields, + items=items, type_=type_, + label=label, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -3179,14 +4036,24 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=base_url, relative_uris=relative_uris - ) + if self.items is not None: + u = save_relative_uri(self.items, base_url, False, 2, relative_uris) + r["items"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=base_url, relative_uris=relative_uris ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) # top refers to the directory level if top: @@ -3198,8 +4065,10 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[CWLRecordField] = None, + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -3211,119 +4080,32 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.items = items self.type_ = type_ + self.label = label + self.inputBinding = inputBinding - attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "inputBinding"] + ) @mypyc_attr(native_class=True) -class File(Saveable): - """ - Represents a file (or group of files when `secondaryFiles` is provided) that - will be accessible by tools using standard POSIX file system call API such as - open(2) and read(2). - - Files are represented as objects with `class` of `File`. File objects have - a number of properties that provide metadata about the file. - - The `location` property of a File is a URI that uniquely identifies the - file. Implementations must support the file:// URI scheme and may support - other schemes such as http://. The value of `location` may also be a - relative reference, in which case it must be resolved relative to the URI - of the document it appears in. Alternately to `location`, implementations - must also accept the `path` property on File, which must be a filesystem - path available on the same host as the CWL runner (for inputs) or the - runtime environment of a command line tool execution (for command line tool - outputs). - - If no `location` or `path` is specified, a file object must specify - `contents` with the UTF-8 text content of the file. This is a "file - literal". File literals do not correspond to external resources, but are - created on disk with `contents` with when needed for a executing a tool. - Where appropriate, expressions can return file literals to define new files - on a runtime. The maximum size of `contents` is 64 kilobytes. - - The `basename` property defines the filename on disk where the file is - staged. This may differ from the resource name. If not provided, - `basename` must be computed from the last path part of `location` and made - available to expressions. - - The `secondaryFiles` property is a list of File or Directory objects that - must be staged in the same directory as the primary file. It is an error - for file names to be duplicated in `secondaryFiles`. - - The `size` property is the size in bytes of the File. It must be computed - from the resource and made available to expressions. The `checksum` field - contains a cryptographic hash of the file content for use it verifying file - contents. Implementations may, at user option, enable or disable - computation of the `checksum` field for performance or other reasons. - However, the ability to compute output checksums is required to pass the - CWL conformance test suite. - - When executing a CommandLineTool, the files and secondary files may be - staged to an arbitrary directory, but must use the value of `basename` for - the filename. The `path` property must be file path in the context of the - tool execution runtime (local to the compute node, or within the executing - container). All computed properties should be available to expressions. - File literals also must be staged and `path` must be set. - - When collecting CommandLineTool outputs, `glob` matching returns file paths - (with the `path` property) and the derived properties. This can all be - modified by `outputEval`. Alternately, if the file `cwl.output.json` is - present in the output, `outputBinding` is ignored. - - File objects in the output must provide either a `location` URI or a `path` - property in the context of the tool execution runtime (local to the compute - node, or within the executing container). - - When evaluating an ExpressionTool, file objects must be referenced via - `location` (the expression tool does not have access to files on disk so - `path` is meaningless) or as file literals. It is legal to return a file - object with an existing `location` but a different `basename`. The - `loadContents` field of ExpressionTool inputs behaves the same as on - CommandLineTool inputs, however it is not meaningful on the outputs. - - An ExpressionTool may forward file references from input to output by using - the same value for `location`. - - """ +class OutputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, File): + if isinstance(other, OutputRecordField): return bool( - self.class_ == other.class_ - and self.location == other.location - and self.path == other.path - and self.basename == other.basename - and self.dirname == other.dirname - and self.nameroot == other.nameroot - and self.nameext == other.nameext - and self.checksum == other.checksum - and self.size == other.size - and self.secondaryFiles == other.secondaryFiles - and self.format == other.format - and self.contents == other.contents + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.outputBinding == other.outputBinding ) return False def __hash__(self) -> int: - return hash( - ( - self.class_, - self.location, - self.path, - self.basename, - self.dirname, - self.nameroot, - self.nameext, - self.checksum, - self.size, - self.secondaryFiles, - self.format, - self.contents, - ) - ) + return hash((self.doc, self.name, self.type_, self.outputBinding)) @classmethod def fromDoc( @@ -3339,37 +4121,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_File_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - location = None - if "location" in _doc: + name = None + if "name" in _doc: try: - location = load_field( - _doc.get("location"), - uri_union_of_None_type_or_strtype_False_False_None_None, + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("location") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `location`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -3377,13 +4143,13 @@ def fromDoc( ) ) else: - val = _doc.get("location") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3395,28 +4161,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `location` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - path = None - if "path" in _doc: + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: try: - path = load_field( - _doc.get("path"), - uri_union_of_None_type_or_strtype_False_False_None_None, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("path") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `path`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -3424,13 +4199,13 @@ def fromDoc( ) ) else: - val = _doc.get("path") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3442,28 +4217,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `path` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - basename = None - if "basename" in _doc: + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + outputBinding = None + if "outputBinding" in _doc: try: - basename = load_field( - _doc.get("basename"), - union_of_None_type_or_strtype, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("basename") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `basename`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -3471,13 +4294,13 @@ def fromDoc( ) ) else: - val = _doc.get("basename") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3489,28 +4312,156 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `basename` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) - dirname = None - if "dirname" in _doc: + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `outputBinding`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + name=name, + doc=doc, + type_=type_, + outputBinding=outputBinding, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + loadingOptions.idx[name] = (_constructed, loadingOptions) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + name: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "outputBinding"] + ) + + +@mypyc_attr(native_class=True) +class OutputRecordSchema(CWLRecordSchema): + def __eq__(self, other: Any) -> bool: + if isinstance(other, OutputRecordSchema): + return bool( + self.fields == other.fields + and self.type_ == other.type_ + and self.label == other.label + ) + return False + + def __hash__(self) -> int: + return hash((self.fields, self.type_, self.label)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + fields = None + if "fields" in _doc: try: - dirname = load_field( - _doc.get("dirname"), - union_of_None_type_or_strtype, + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader, baseuri, loadingOptions, - lc=_doc.get("dirname") + lc=_doc.get("fields") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dirname`": + if str(e) == "missing required field `fields`": _errors__.append( ValidationException( str(e), @@ -3518,13 +4469,13 @@ def fromDoc( ) ) else: - val = _doc.get("dirname") + val = _doc.get("fields") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dirname` field is not valid because:", - SourceLine(_doc, "dirname", str), + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3536,75 +4487,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dirname` field is not valid because:", - SourceLine(_doc, "dirname", str), + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), [e], - detailed_message=f"the `dirname` field with value `{val}` " + detailed_message=f"the `fields` field with value `{val}` " "is not valid because:", ) ) - nameroot = None - if "nameroot" in _doc: - try: - nameroot = load_field( - _doc.get("nameroot"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("nameroot") - ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + type_ = _load_field( + _doc.get("type"), + typedsl_Record_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) - if str(e) == "missing required field `nameroot`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("nameroot") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `nameroot` field is not valid because:", - SourceLine(_doc, "nameroot", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `nameroot` field is not valid because:", - SourceLine(_doc, "nameroot", str), - [e], - detailed_message=f"the `nameroot` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", ) - nameext = None - if "nameext" in _doc: + ) + label = None + if "label" in _doc: try: - nameext = load_field( - _doc.get("nameext"), + label = _load_field( + _doc.get("label"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("nameext") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `nameext`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -3612,13 +4564,13 @@ def fromDoc( ) ) else: - val = _doc.get("nameext") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `nameext` field is not valid because:", - SourceLine(_doc, "nameext", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3630,28 +4582,150 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `nameext` field is not valid because:", - SourceLine(_doc, "nameext", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `nameext` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - checksum = None - if "checksum" in _doc: + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `fields`, `type`, `label`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + fields=fields, + type_=type_, + label=label, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + type_: Record_name, + fields: None | Sequence[OutputRecordField] = None, + label: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.fields = fields + self.type_ = type_ + self.label = label + + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label"]) + + +@mypyc_attr(native_class=True) +class OutputEnumSchema(schema_salad.metaschema.EnumSchema): + name: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, OutputEnumSchema): + return bool( + self.name == other.name + and self.symbols == other.symbols + and self.type_ == other.type_ + and self.label == other.label + and self.outputBinding == other.outputBinding + ) + return False + + def __hash__(self) -> int: + return hash( + (self.name, self.symbols, self.type_, self.label, self.outputBinding) + ) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + name = None + if "name" in _doc: try: - checksum = load_field( - _doc.get("checksum"), - union_of_None_type_or_strtype, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("checksum") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `checksum`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -3659,13 +4733,13 @@ def fromDoc( ) ) else: - val = _doc.get("checksum") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `checksum` field is not valid because:", - SourceLine(_doc, "checksum", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3677,122 +4751,132 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `checksum` field is not valid because:", - SourceLine(_doc, "checksum", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `checksum` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - size = None - if "size" in _doc: - try: - size = load_field( - _doc.get("size"), - union_of_None_type_or_inttype_or_inttype, - baseuri, - loadingOptions, - lc=_doc.get("size") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `size`": - _errors__.append( - ValidationException( - str(e), - None + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + try: + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) + + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("symbols") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `symbols`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("symbols") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("size") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `size` field is not valid because:", - SourceLine(_doc, "size", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `size` field is not valid because:", - SourceLine(_doc, "size", str), - [e], - detailed_message=f"the `size` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [e], + detailed_message=f"the `symbols` field with value `{val}` " + "is not valid because:", ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + type_ = _load_field( + _doc.get("type"), + typedsl_Enum_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) - if str(e) == "missing required field `secondaryFiles`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", ) - format = None - if "format" in _doc: + ) + label = None + if "label" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_True_False_None_True, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -3800,13 +4884,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3818,28 +4902,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - contents = None - if "contents" in _doc: + outputBinding = None + if "outputBinding" in _doc: try: - contents = load_field( - _doc.get("contents"), - union_of_None_type_or_strtype, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("contents") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `contents`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -3847,13 +4931,13 @@ def fromDoc( ) ) else: - val = _doc.get("contents") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `contents` field is not valid because:", - SourceLine(_doc, "contents", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3865,10 +4949,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `contents` field is not valid because:", - SourceLine(_doc, "contents", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `contents` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -3880,14 +4964,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `dirname`, `nameroot`, `nameext`, `checksum`, `size`, `secondaryFiles`, `format`, `contents`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `outputBinding`".format( k ), SourceLine(_doc, k, str), @@ -3897,20 +4981,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - location=location, - path=path, - basename=basename, - dirname=dirname, - nameroot=nameroot, - nameext=nameext, - checksum=checksum, - size=size, - secondaryFiles=secondaryFiles, - format=format, - contents=contents, + name=name, + symbols=symbols, + type_=type_, + label=label, + outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -3924,58 +5003,27 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.location is not None: - u = save_relative_uri(self.location, base_url, False, None, relative_uris) - r["location"] = u - if self.path is not None: - u = save_relative_uri(self.path, base_url, False, None, relative_uris) - r["path"] = u - if self.basename is not None: - r["basename"] = save( - self.basename, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.dirname is not None: - r["dirname"] = save( - self.dirname, top=False, base_url=base_url, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.nameroot is not None: - r["nameroot"] = save( - self.nameroot, top=False, base_url=base_url, relative_uris=relative_uris + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.nameext is not None: - r["nameext"] = save( - self.nameext, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.checksum is not None: - r["checksum"] = save( - self.checksum, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.size is not None: - r["size"] = save( - self.size, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, top=False, - base_url=base_url, + base_url=self.name, relative_uris=relative_uris, ) - if self.format is not None: - u = save_relative_uri(self.format, base_url, True, None, relative_uris) - r["format"] = u - if self.contents is not None: - r["contents"] = save( - self.contents, top=False, base_url=base_url, relative_uris=relative_uris - ) # top refers to the directory level if top: @@ -3987,17 +5035,11 @@ def save( def __init__( self, - location: None | str = None, - path: None | str = None, - basename: None | str = None, - dirname: None | str = None, - nameroot: None | str = None, - nameext: None | str = None, - checksum: None | str = None, - size: None | i32 = None, - secondaryFiles: None | Sequence[Directory | File] = None, - format: None | str = None, - contents: None | str = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -4009,101 +5051,31 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "location", - "path", - "basename", - "dirname", - "nameroot", - "nameext", - "checksum", - "size", - "secondaryFiles", - "format", - "contents", - ] + ["name", "symbols", "type", "label", "outputBinding"] ) @mypyc_attr(native_class=True) -class Directory(Saveable): - """ - Represents a directory to present to a command line tool. - - Directories are represented as objects with `class` of `Directory`. Directory objects have - a number of properties that provide metadata about the directory. - - The `location` property of a Directory is a URI that uniquely identifies - the directory. Implementations must support the file:// URI scheme and may - support other schemes such as http://. Alternately to `location`, - implementations must also accept the `path` property on Directory, which - must be a filesystem path available on the same host as the CWL runner (for - inputs) or the runtime environment of a command line tool execution (for - command line tool outputs). - - A Directory object may have a `listing` field. This is a list of File and - Directory objects that are contained in the Directory. For each entry in - `listing`, the `basename` property defines the name of the File or - Subdirectory when staged to disk. If `listing` is not provided, the - implementation must have some way of fetching the Directory listing at - runtime based on the `location` field. - - If a Directory does not have `location`, it is a Directory literal. A - Directory literal must provide `listing`. Directory literals must be - created on disk at runtime as needed. - - The resources in a Directory literal do not need to have any implied - relationship in their `location`. For example, a Directory listing may - contain two files located on different hosts. It is the responsibility of - the runtime to ensure that those files are staged to disk appropriately. - Secondary files associated with files in `listing` must also be staged to - the same Directory. - - When executing a CommandLineTool, Directories must be recursively staged - first and have local values of `path` assigned. - - Directory objects in CommandLineTool output must provide either a - `location` URI or a `path` property in the context of the tool execution - runtime (local to the compute node, or within the executing container). - - An ExpressionTool may forward file references from input to output by using - the same value for `location`. - - Name conflicts (the same `basename` appearing multiple times in `listing` - or in any entry in `secondaryFiles` in the listing) is a fatal error. - - """ - +class OutputArraySchema(CWLArraySchema): def __eq__(self, other: Any) -> bool: - if isinstance(other, Directory): + if isinstance(other, OutputArraySchema): return bool( - self.class_ == other.class_ - and self.location == other.location - and self.path == other.path - and self.basename == other.basename - and self.listing == other.listing + self.items == other.items + and self.type_ == other.type_ + and self.label == other.label + and self.outputBinding == other.outputBinding ) return False def __hash__(self) -> int: - return hash( - (self.class_, self.location, self.path, self.basename, self.listing) - ) + return hash((self.items, self.type_, self.label, self.outputBinding)) @classmethod def fromDoc( @@ -4120,36 +5092,116 @@ def fromDoc( _doc.lc.filename = doc.lc.filename _errors__ = [] try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - class_ = load_field( - _doc.get("class"), - uri_Directory_classLoader_False_True_None_None, + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None, baseuri, loadingOptions, - lc=_doc.get("class") + lc=_doc.get("items") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - location = None - if "location" in _doc: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: try: - location = load_field( - _doc.get("location"), - uri_union_of_None_type_or_strtype_False_False_None_None, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("location") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `location`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -4157,13 +5209,13 @@ def fromDoc( ) ) else: - val = _doc.get("location") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4175,28 +5227,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `location` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - path = None - if "path" in _doc: + outputBinding = None + if "outputBinding" in _doc: try: - path = load_field( - _doc.get("path"), - uri_union_of_None_type_or_strtype_False_False_None_None, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("path") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `path`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -4204,13 +5256,13 @@ def fromDoc( ) ) else: - val = _doc.get("path") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4222,104 +5274,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `path` field with value `{val}` " - "is not valid because:", - ) - ) - basename = None - if "basename" in _doc: - try: - basename = load_field( - _doc.get("basename"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("basename") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `basename`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("basename") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), - [e], - detailed_message=f"the `basename` field with value `{val}` " - "is not valid because:", - ) - ) - listing = None - if "listing" in _doc: - try: - listing = load_field( - _doc.get("listing"), - union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, - baseuri, - loadingOptions, - lc=_doc.get("listing") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `listing`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("listing") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), - [e], - detailed_message=f"the `listing` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -4331,14 +5289,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `listing`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `outputBinding`".format( k ), SourceLine(_doc, k, str), @@ -4348,10 +5306,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - location=location, - path=path, - basename=basename, - listing=listing, + items=items, + type_=type_, + label=label, + outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -4368,27 +5326,23 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.location is not None: - u = save_relative_uri(self.location, base_url, False, None, relative_uris) - r["location"] = u - if self.path is not None: - u = save_relative_uri(self.path, base_url, False, None, relative_uris) - r["path"] = u - if self.basename is not None: - r["basename"] = save( - self.basename, top=False, base_url=base_url, relative_uris=relative_uris + if self.items is not None: + u = save_relative_uri(self.items, base_url, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.listing is not None: - r["listing"] = save( - self.listing, top=False, base_url=base_url, relative_uris=relative_uris + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -4401,10 +5355,10 @@ def save( def __init__( self, - location: None | str = None, - path: None | str = None, - basename: None | str = None, - listing: None | Sequence[Directory | File] = None, + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -4416,34 +5370,49 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing + self.items = items + self.type_ = type_ + self.label = label + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["class", "location", "path", "basename", "listing"] + ["items", "type", "label", "outputBinding"] ) @mypyc_attr(native_class=True) -class InputRecordField(CWLRecordField): - name: str +class InputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputRecordField): + if isinstance(other, InputParameter): return bool( - self.doc == other.doc - and self.name == other.name - and self.type_ == other.type_ + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format and self.inputBinding == other.inputBinding - and self.label == other.label + and self.default == other.default + and self.type_ == other.type_ ) return False def __hash__(self) -> int: - return hash((self.doc, self.name, self.type_, self.inputBinding, self.label)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.inputBinding, + self.default, + self.type_, + ) + ) @classmethod def fromDoc( @@ -4459,21 +5428,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + id = None + if "id" in _doc: try: - name = load_field( - _doc.get("name"), + id = _load_field( + _doc.get("id"), uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -4481,13 +5450,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4499,37 +5468,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - if name is None: + if id is None: if docRoot is not None: - name = docRoot + id = docRoot else: - name = "" - _errors__.append(ValidationException("missing name")) + id = "" + _errors__.append(ValidationException("missing id")) else: - baseuri = name - doc = None - if "doc" in _doc: + baseuri = id + label = None + if "label" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -4537,13 +5506,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4555,65 +5524,205 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None + if str(e) == "missing required field `secondaryFiles`": + _errors__.append( + ValidationException( + str(e), + None + ) ) + else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None ) ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) inputBinding = None if "inputBinding" in _doc: try: - inputBinding = load_field( + inputBinding = _load_field( _doc.get("inputBinding"), union_of_None_type_or_CommandLineBindingLoader, baseuri, @@ -4657,21 +5766,21 @@ def fromDoc( "is not valid because:", ) ) - label = None - if "label" in _doc: + default = None + if "default" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("default") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `default`": _errors__.append( ValidationException( str(e), @@ -4679,13 +5788,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("default") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4697,10 +5806,57 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `default` field with value `{val}` " + "is not valid because:", + ) + ) + type_ = None + if "type" in _doc: + try: + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) @@ -4712,14 +5868,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `inputBinding`, `label`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `inputBinding`, `default`, `type`".format( k ), SourceLine(_doc, k, str), @@ -4729,15 +5885,19 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - doc=doc, - type_=type_, - inputBinding=inputBinding, + id=id, label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + inputBinding=inputBinding, + default=default, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -4751,27 +5911,48 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) if self.doc is not None: r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris + self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u if self.inputBinding is not None: r["inputBinding"] = save( self.inputBinding, top=False, - base_url=self.name, + base_url=self.id, relative_uris=relative_uris, ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris ) # top refers to the directory level @@ -4784,11 +5965,15 @@ def save( def __init__( self, - name: str, - type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, inputBinding: CommandLineBinding | None = None, - label: None | str = None, + default: CWLObjectType | None = None, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | None | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -4800,33 +5985,60 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable self.doc = doc - self.name = name - self.type_ = type_ + self.id = id + self.format = format self.inputBinding = inputBinding - self.label = label + self.default = default + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( - ["doc", "name", "type", "inputBinding", "label"] + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "inputBinding", + "default", + "type", + ] ) @mypyc_attr(native_class=True) -class InputRecordSchema(CWLRecordSchema): - name: str +class OutputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputRecordSchema): + if isinstance(other, OutputParameter): return bool( - self.fields == other.fields - and self.type_ == other.type_ - and self.label == other.label - and self.name == other.name + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.outputBinding == other.outputBinding + and self.format == other.format ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.name)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.outputBinding, + self.format, + ) + ) @classmethod def fromDoc( @@ -4842,21 +6054,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + id = None + if "id" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -4864,13 +6076,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4882,36 +6094,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - if name is None: + if id is None: if docRoot is not None: - name = docRoot + id = docRoot else: - name = "_:" + str(_uuid__.uuid4()) + id = "" + _errors__.append(ValidationException("missing id")) else: - baseuri = name - fields = None - if "fields" in _doc: + baseuri = id + label = None + if "label" in _doc: try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("fields") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `fields`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -4919,13 +6132,13 @@ def fromDoc( ) ) else: - val = _doc.get("fields") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4937,76 +6150,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `fields` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -5014,13 +6179,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -5032,157 +6197,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `name`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - fields=fields, - type_=type_, - label=label, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - type_: Record_name, - fields: None | Sequence[InputRecordField] = None, - label: None | str = None, - name: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - - attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) - - -@mypyc_attr(native_class=True) -class InputEnumSchema(EnumSchema): - name: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, InputEnumSchema): - return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ - and self.label == other.label - and self.inputBinding == other.inputBinding - ) - return False - - def __hash__(self) -> int: - return hash( - (self.name, self.symbols, self.type_, self.label, self.inputBinding) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - name = None - if "name" in _doc: + streamable = None + if "streamable" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -5190,13 +6226,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -5208,132 +6244,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: + doc = None + if "doc" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -5341,13 +6273,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -5359,28 +6291,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: + outputBinding = None + if "outputBinding" in _doc: try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("inputBinding") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputBinding`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -5388,13 +6320,13 @@ def fromDoc( ) ) else: - val = _doc.get("inputBinding") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -5406,10 +6338,57 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `inputBinding` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) @@ -5421,14 +6400,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `inputBinding`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `outputBinding`, `format`".format( k ), SourceLine(_doc, k, str), @@ -5438,15 +6417,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - symbols=symbols, - type_=type_, + id=id, label=label, - inputBinding=inputBinding, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + outputBinding=outputBinding, + format=format, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -5460,27 +6441,41 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u if self.label is not None: r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, top=False, - base_url=self.name, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, + top=False, + base_url=self.id, relative_uris=relative_uris, ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u # top refers to the directory level if top: @@ -5492,11 +6487,13 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, + id: str, label: None | str = None, - inputBinding: CommandLineBinding | None = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5508,31 +6505,44 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ self.label = label - self.inputBinding = inputBinding + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "inputBinding"] + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "outputBinding", + "format", + ] ) @mypyc_attr(native_class=True) -class InputArraySchema(CWLArraySchema): +class InlineJavascriptRequirement(Saveable): + """ + Indicates that the workflow platform must support inline Javascript expressions. If this requirement is not present, the workflow platform must not perform expression interpolatation. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, InputArraySchema): + if isinstance(other, InlineJavascriptRequirement): return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.inputBinding == other.inputBinding + self.class_ == other.class_ + and self.expressionLib == other.expressionLib ) return False def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.inputBinding)) + return hash((self.class_, self.expressionLib)) @classmethod def fromDoc( @@ -5549,192 +6559,66 @@ def fromDoc( _doc.lc.filename = doc.lc.filename _errors__ = [] try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None, + class_ = _load_field( + _doc.get("class"), + uri_InlineJavascriptRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("items") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) + raise e + expressionLib = None + if "expressionLib" in _doc: + try: + expressionLib = _load_field( + _doc.get("expressionLib"), + union_of_None_type_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("expressionLib") ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `expressionLib`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + val = _doc.get("expressionLib") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `expressionLib` field is not valid because:", + SourceLine(_doc, "expressionLib", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) else: _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `expressionLib` field is not valid because:", + SourceLine(_doc, "expressionLib", str), [e], - detailed_message=f"the `inputBinding` field with value `{val}` " + detailed_message=f"the `expressionLib` field with value `{val}` " "is not valid because:", ) ) @@ -5746,14 +6630,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `inputBinding`".format( + "invalid field `{}`, expected one of: `class`, `expressionLib`".format( k ), SourceLine(_doc, k, str), @@ -5763,10 +6647,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - items=items, - type_=type_, - label=label, - inputBinding=inputBinding, + expressionLib=expressionLib, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5783,20 +6664,19 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.expressionLib is not None: + r["expressionLib"] = save( + self.expressionLib, top=False, base_url=base_url, relative_uris=relative_uris, @@ -5812,10 +6692,7 @@ def save( def __init__( self, - items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, - type_: Array_name, - label: None | str = None, - inputBinding: CommandLineBinding | None = None, + expressionLib: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5827,32 +6704,26 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding + self.class_: Final[str] = "InlineJavascriptRequirement" + self.expressionLib = expressionLib - attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "inputBinding"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @mypyc_attr(native_class=True) -class OutputRecordField(CWLRecordField): - name: str +class SchemaDefRequirement(Saveable): + """ + This field consists of an array of type definitions which must be used when interpreting the ``inputs`` and ``outputs`` fields. When a ``type`` field contain a IRI, the implementation must check if the type is defined in ``schemaDefs`` and use that definition. If the type is not found in ``schemaDefs``, it is an error. The entries in ``schemaDefs`` must be processed in the order listed such that later schema definitions may refer to earlier schema definitions. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputRecordField): - return bool( - self.doc == other.doc - and self.name == other.name - and self.type_ == other.type_ - and self.outputBinding == other.outputBinding - ) + if isinstance(other, SchemaDefRequirement): + return bool(self.class_ == other.class_ and self.types == other.types) return False def __hash__(self) -> int: - return hash((self.doc, self.name, self.type_, self.outputBinding)) + return hash((self.class_, self.types)) @classmethod def fromDoc( @@ -5868,204 +6739,71 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + class_ = _load_field( + _doc.get("class"), + uri_SchemaDefRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) - if str(e) == "missing required field `name`": + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("types") is None: + raise ValidationException("missing required field `types`", None, []) + + types = _load_field( + _doc.get("types"), + array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("types") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `types`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("types") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `types` field is not valid because:", + SourceLine(_doc, "types", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("name") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "" - _errors__.append(ValidationException("missing name")) - else: - baseuri = name - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `types` field is not valid because:", + SourceLine(_doc, "types", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `types` field with value `{val}` " "is not valid because:", ) ) - outputBinding = None - if "outputBinding" in _doc: - try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [e], - detailed_message=f"the `outputBinding` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -6074,14 +6812,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `outputBinding`".format( + "invalid field `{}`, expected one of: `class`, `types`".format( k ), SourceLine(_doc, k, str), @@ -6091,14 +6829,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - doc=doc, - type_=type_, - outputBinding=outputBinding, + types=types, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6112,23 +6846,19 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.types is not None: + r["types"] = save( + self.types, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -6141,10 +6871,7 @@ def save( def __init__( self, - name: str, - type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, - outputBinding: CommandOutputBinding | None = None, + types: Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema], extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -6156,29 +6883,28 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.outputBinding = outputBinding + self.class_: Final[str] = "SchemaDefRequirement" + self.types = types - attrs: ClassVar[Collection[str]] = frozenset( - ["doc", "name", "type", "outputBinding"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) @mypyc_attr(native_class=True) -class OutputRecordSchema(CWLRecordSchema): +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment by the workflow platform when executing the command line tool. May be the result of executing an expression, such as getting a parameter from input. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputRecordSchema): + if isinstance(other, EnvironmentDef): return bool( - self.fields == other.fields - and self.type_ == other.type_ - and self.label == other.label + self.envName == other.envName and self.envValue == other.envValue ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label)) + return hash((self.envName, self.envValue)) @classmethod def fromDoc( @@ -6194,69 +6920,22 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - fields = None - if "fields" in _doc: - try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader, - baseuri, - loadingOptions, - lc=_doc.get("fields") - ) + try: + if _doc.get("envName") is None: + raise ValidationException("missing required field `envName`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `fields`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("fields") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [e], - detailed_message=f"the `fields` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + envName = _load_field( + _doc.get("envName"), + strtype, + baseuri, + loadingOptions, + lc=_doc.get("envName") + ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `envName`": _errors__.append( ValidationException( str(e), @@ -6264,13 +6943,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("envName") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `envName` field is not valid because:", + SourceLine(_doc, "envName", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6282,60 +6961,61 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `envName` field is not valid because:", + SourceLine(_doc, "envName", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `envName` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) + try: + if _doc.get("envValue") is None: + raise ValidationException("missing required field `envValue`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + envValue = _load_field( + _doc.get("envValue"), + union_of_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("envValue") + ) - if str(e) == "missing required field `label`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `envValue`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("envValue") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `envValue` field is not valid because:", + SourceLine(_doc, "envValue", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `envValue` field is not valid because:", + SourceLine(_doc, "envValue", str), + [e], + detailed_message=f"the `envValue` field with value `{val}` " + "is not valid because:", ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -6344,14 +7024,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`".format( + "invalid field `{}`, expected one of: `envName`, `envValue`".format( k ), SourceLine(_doc, k, str), @@ -6361,9 +7041,8 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - fields=fields, - type_=type_, - label=label, + envName=envName, + envValue=envValue, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -6380,17 +7059,13 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.envName is not None: + r["envName"] = save( + self.envName, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=base_url, relative_uris=relative_uris + if self.envValue is not None: + r["envValue"] = save( + self.envValue, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -6403,9 +7078,8 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[OutputRecordField] = None, - label: None | str = None, + envName: str, + envValue: str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -6417,31 +7091,61 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label + self.envName = envName + self.envValue = envValue - attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label"]) + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @mypyc_attr(native_class=True) -class OutputEnumSchema(EnumSchema): - name: str +class CommandLineBinding(Saveable): + """ + When listed under ``inputBinding`` in the input schema, the term "value" refers to the the corresponding value in the input object. For binding objects listed in ``CommandLineTool.arguments``, the term "value" refers to the effective value after evaluating ``valueFrom``. + + The binding behavior when building the command line depends on the data type of the value. If there is a mismatch between the type described by the input schema and the effective value, such as resulting from an expression evaluation, an implementation must use the data type of the effective value. + + - **string**: Add ``prefix`` and the string to the command line. + + - **number**: Add ``prefix`` and decimal representation to command line. + + - **boolean**: If true, add ``prefix`` to the command line. If false, add nothing. + + - **File**: Add ``prefix`` and the value of ```File.path`` <#File>`__ to the command line. + + - **Directory**: Add ``prefix`` and the value of ```Directory.path`` <#Directory>`__ to the command line. + + - **array**: If ``itemSeparator`` is specified, add ``prefix`` and the join the array into a single string with ``itemSeparator`` separating the items. Otherwise first add ``prefix``, then recursively process individual elements. If the array is empty, it does not add anything to command line. + + - **object**: Add ``prefix`` only, and recursively add object fields for which ``inputBinding`` is specified. + + - **null**: Add nothing. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputEnumSchema): + if isinstance(other, CommandLineBinding): return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ - and self.label == other.label - and self.outputBinding == other.outputBinding + self.loadContents == other.loadContents + and self.position == other.position + and self.prefix == other.prefix + and self.separate == other.separate + and self.itemSeparator == other.itemSeparator + and self.valueFrom == other.valueFrom + and self.shellQuote == other.shellQuote ) return False def __hash__(self) -> int: return hash( - (self.name, self.symbols, self.type_, self.label, self.outputBinding) + ( + self.loadContents, + self.position, + self.prefix, + self.separate, + self.itemSeparator, + self.valueFrom, + self.shellQuote, + ) ) @classmethod @@ -6458,21 +7162,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + loadContents = None + if "loadContents" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("loadContents") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( str(e), @@ -6480,13 +7184,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("loadContents") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6498,132 +7202,216 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `loadContents` field with value `{val}` " "is not valid because:", ) ) + position = None + if "position" in _doc: + try: + position = _load_field( + _doc.get("position"), + union_of_None_type_or_inttype, + baseuri, + loadingOptions, + lc=_doc.get("position") + ) - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `position`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("position") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `position` field is not valid because:", + SourceLine(_doc, "position", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `position` field is not valid because:", + SourceLine(_doc, "position", str), + [e], + detailed_message=f"the `position` field with value `{val}` " + "is not valid because:", + ) + ) + prefix = None + if "prefix" in _doc: + try: + prefix = _load_field( + _doc.get("prefix"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("prefix") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `prefix`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + val = _doc.get("prefix") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `prefix` field is not valid because:", + SourceLine(_doc, "prefix", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `prefix` field is not valid because:", + SourceLine(_doc, "prefix", str), + [e], + detailed_message=f"the `prefix` field with value `{val}` " + "is not valid because:", + ) + ) + separate = None + if "separate" in _doc: + try: + separate = _load_field( + _doc.get("separate"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("separate") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `separate`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("separate") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `separate` field is not valid because:", + SourceLine(_doc, "separate", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `separate` field is not valid because:", + SourceLine(_doc, "separate", str), + [e], + detailed_message=f"the `separate` field with value `{val}` " + "is not valid because:", + ) + ) + itemSeparator = None + if "itemSeparator" in _doc: + try: + itemSeparator = _load_field( + _doc.get("itemSeparator"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("itemSeparator") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `itemSeparator`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - label = None - if "label" in _doc: + else: + val = _doc.get("itemSeparator") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `itemSeparator` field is not valid because:", + SourceLine(_doc, "itemSeparator", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `itemSeparator` field is not valid because:", + SourceLine(_doc, "itemSeparator", str), + [e], + detailed_message=f"the `itemSeparator` field with value `{val}` " + "is not valid because:", + ) + ) + valueFrom = None + if "valueFrom" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + valueFrom = _load_field( + _doc.get("valueFrom"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("valueFrom") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `valueFrom`": _errors__.append( ValidationException( str(e), @@ -6631,13 +7419,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("valueFrom") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6649,28 +7437,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `valueFrom` field with value `{val}` " "is not valid because:", ) ) - outputBinding = None - if "outputBinding" in _doc: + shellQuote = None + if "shellQuote" in _doc: try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, + shellQuote = _load_field( + _doc.get("shellQuote"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("outputBinding") + lc=_doc.get("shellQuote") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputBinding`": + if str(e) == "missing required field `shellQuote`": _errors__.append( ValidationException( str(e), @@ -6678,13 +7466,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputBinding") + val = _doc.get("shellQuote") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `shellQuote` field is not valid because:", + SourceLine(_doc, "shellQuote", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6696,10 +7484,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `shellQuote` field is not valid because:", + SourceLine(_doc, "shellQuote", str), [e], - detailed_message=f"the `outputBinding` field with value `{val}` " + detailed_message=f"the `shellQuote` field with value `{val}` " "is not valid because:", ) ) @@ -6711,14 +7499,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `outputBinding`".format( + "invalid field `{}`, expected one of: `loadContents`, `position`, `prefix`, `separate`, `itemSeparator`, `valueFrom`, `shellQuote`".format( k ), SourceLine(_doc, k, str), @@ -6728,15 +7516,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - label=label, - outputBinding=outputBinding, + loadContents=loadContents, + position=position, + prefix=prefix, + separate=separate, + itemSeparator=itemSeparator, + valueFrom=valueFrom, + shellQuote=shellQuote, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6750,25 +7539,44 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + if self.position is not None: + r["position"] = save( + self.position, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, + if self.prefix is not None: + r["prefix"] = save( + self.prefix, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.separate is not None: + r["separate"] = save( + self.separate, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.itemSeparator is not None: + r["itemSeparator"] = save( + self.itemSeparator, top=False, - base_url=self.name, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.valueFrom is not None: + r["valueFrom"] = save( + self.valueFrom, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.shellQuote is not None: + r["shellQuote"] = save( + self.shellQuote, + top=False, + base_url=base_url, relative_uris=relative_uris, ) @@ -6782,11 +7590,13 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - label: None | str = None, - outputBinding: CommandOutputBinding | None = None, + loadContents: None | bool = None, + position: None | i32 = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -6798,31 +7608,52 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "outputBinding"] + [ + "loadContents", + "position", + "prefix", + "separate", + "itemSeparator", + "valueFrom", + "shellQuote", + ] ) @mypyc_attr(native_class=True) -class OutputArraySchema(CWLArraySchema): +class CommandOutputBinding(Saveable): + """ + Describes how to generate an output parameter based on the files produced by a CommandLineTool. + + The output parameter value is generated by applying these operations in the following order: + + - glob + - loadContents + - outputEval + - secondaryFiles + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputArraySchema): + if isinstance(other, CommandOutputBinding): return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.outputBinding == other.outputBinding + self.glob == other.glob + and self.loadContents == other.loadContents + and self.outputEval == other.outputEval ) return False def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.outputBinding)) + return hash((self.glob, self.loadContents, self.outputEval)) @classmethod def fromDoc( @@ -6838,117 +7669,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: + glob = None + if "glob" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + glob = _load_field( + _doc.get("glob"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("glob") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `glob`": _errors__.append( ValidationException( str(e), @@ -6956,13 +7691,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("glob") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `glob` field is not valid because:", + SourceLine(_doc, "glob", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6974,28 +7709,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `glob` field is not valid because:", + SourceLine(_doc, "glob", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `glob` field with value `{val}` " "is not valid because:", ) ) - outputBinding = None - if "outputBinding" in _doc: + loadContents = None + if "loadContents" in _doc: try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("outputBinding") + lc=_doc.get("loadContents") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputBinding`": + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( str(e), @@ -7003,13 +7738,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputBinding") + val = _doc.get("loadContents") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7021,10 +7756,57 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [e], - detailed_message=f"the `outputBinding` field with value `{val}` " + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) + outputEval = None + if "outputEval" in _doc: + try: + outputEval = _load_field( + _doc.get("outputEval"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputEval") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputEval`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outputEval") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputEval` field is not valid because:", + SourceLine(_doc, "outputEval", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputEval` field is not valid because:", + SourceLine(_doc, "outputEval", str), + [e], + detailed_message=f"the `outputEval` field with value `{val}` " "is not valid because:", ) ) @@ -7036,14 +7818,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `outputBinding`".format( + "invalid field `{}`, expected one of: `glob`, `loadContents`, `outputEval`".format( k ), SourceLine(_doc, k, str), @@ -7053,10 +7835,9 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - items=items, - type_=type_, - label=label, - outputBinding=outputBinding, + glob=glob, + loadContents=loadContents, + outputEval=outputEval, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -7073,20 +7854,20 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.glob is not None: + r["glob"] = save( + self.glob, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=base_url, relative_uris=relative_uris + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, + if self.outputEval is not None: + r["outputEval"] = save( + self.outputEval, top=False, base_url=base_url, relative_uris=relative_uris, @@ -7102,10 +7883,9 @@ def save( def __init__( self, - items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - type_: Array_name, - label: None | str = None, - outputBinding: CommandOutputBinding | None = None, + glob: None | Sequence[str] | str = None, + loadContents: None | bool = None, + outputEval: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -7117,49 +7897,30 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.glob = glob + self.loadContents = loadContents + self.outputEval = outputEval - attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "outputBinding"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["glob", "loadContents", "outputEval"]) @mypyc_attr(native_class=True) -class InputParameter(Saveable): - id: str +class CommandInputRecordField(InputRecordField): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputParameter): + if isinstance(other, CommandInputRecordField): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.inputBinding == other.inputBinding - and self.default == other.default + self.doc == other.doc + and self.name == other.name and self.type_ == other.type_ + and self.inputBinding == other.inputBinding + and self.label == other.label ) return False def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.inputBinding, - self.default, - self.type_, - ) - ) + return hash((self.doc, self.name, self.type_, self.inputBinding, self.label)) @classmethod def fromDoc( @@ -7175,21 +7936,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: + name = None + if "name" in _doc: try: - id = load_field( - _doc.get("id"), + name = _load_field( + _doc.get("name"), uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("id") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -7197,13 +7958,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7215,37 +7976,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - if id is None: + if name is None: if docRoot is not None: - id = docRoot + name = docRoot else: - id = "" - _errors__.append(ValidationException("missing id")) + name = "" + _errors__.append(ValidationException("missing name")) else: - baseuri = id - label = None - if "label" in _doc: + baseuri = name + doc = None + if "doc" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -7253,13 +8014,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7271,28 +8032,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + inputBinding = None + if "inputBinding" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -7300,13 +8109,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7318,28 +8127,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: + label = None + if "label" in _doc: try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("streamable") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `streamable`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -7347,13 +8156,13 @@ def fromDoc( ) ) else: - val = _doc.get("streamable") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7365,28 +8174,166 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `streamable` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `inputBinding`, `label`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + name=name, + doc=doc, + type_=type_, + inputBinding=inputBinding, + label=label, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + loadingOptions.idx[name] = (_constructed, loadingOptions) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + name: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + label: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.doc = doc + self.name = name + self.type_ = type_ + self.inputBinding = inputBinding + self.label = label + + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "inputBinding", "label"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputRecordSchema(InputRecordSchema): + name: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, CommandInputRecordSchema): + return bool( + self.fields == other.fields + and self.type_ == other.type_ + and self.label == other.label + and self.name == other.name + ) + return False + + def __hash__(self) -> int: + return hash((self.fields, self.type_, self.label, self.name)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + name = None + if "name" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -7394,13 +8341,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7412,28 +8359,36 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + fields = None + if "fields" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("fields") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `fields`": _errors__.append( ValidationException( str(e), @@ -7441,13 +8396,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("fields") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7459,122 +8414,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `fields` field with value `{val}` " "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + type_ = _load_field( + _doc.get("type"), + typedsl_Record_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - default = None - if "default" in _doc: - try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, - baseuri, - loadingOptions, - lc=_doc.get("default") ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `default`": + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("default") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [e], - detailed_message=f"the `default` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", ) - type_ = None - if "type" in _doc: + ) + label = None + if "label" in _doc: try: - type_ = load_field( - _doc.get("type"), - typedsl_union_of_None_type_or_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -7582,13 +8491,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7600,10 +8509,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) @@ -7615,14 +8524,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `inputBinding`, `default`, `type`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `name`".format( k ), SourceLine(_doc, k, str), @@ -7632,19 +8541,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - inputBinding=inputBinding, - default=default, + name=name, + fields=fields, type_=type_, + label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7658,48 +8562,20 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=self.name, relative_uris=relative_uris ) if self.type_ is not None: r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -7712,15 +8588,10 @@ def save( def __init__( self, - id: str, + type_: Record_name, + fields: None | Sequence[CommandInputRecordField] = None, label: None | str = None, - secondaryFiles: None | Sequence[str] | str = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | Sequence[str] | str = None, - inputBinding: CommandLineBinding | None = None, - default: CWLObjectType | None = None, - type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | None | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -7732,59 +8603,32 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.inputBinding = inputBinding - self.default = default + self.fields = fields self.type_ = type_ + self.label = label + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "inputBinding", - "default", - "type", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @mypyc_attr(native_class=True) -class OutputParameter(Saveable): - id: str +class CommandInputEnumSchema(InputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputParameter): + if isinstance(other, CommandInputEnumSchema): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.outputBinding == other.outputBinding - and self.format == other.format + self.name == other.name + and self.symbols == other.symbols + and self.type_ == other.type_ + and self.label == other.label + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.outputBinding, - self.format, - ) + (self.name, self.symbols, self.type_, self.label, self.inputBinding) ) @classmethod @@ -7801,21 +8645,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: + name = None + if "name" in _doc: try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("id") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -7823,13 +8667,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7841,26 +8685,121 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - if id is None: + if name is None: if docRoot is not None: - id = docRoot + name = docRoot else: - id = "" - _errors__.append(ValidationException("missing id")) + name = "_:" + str(_uuid__.uuid4()) else: - baseuri = id + baseuri = name + try: + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) + + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("symbols") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `symbols`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("symbols") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [e], + detailed_message=f"the `symbols` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Enum_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -7904,21 +8843,21 @@ def fromDoc( "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -7926,13 +8865,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7944,122 +8883,259 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - str(e), - None + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `inputBinding`".format( + k + ), + SourceLine(_doc, k, str), ) ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: - try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputBinding") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + name=name, + symbols=symbols, + type_=type_, + label=label, + inputBinding=inputBinding, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + loadingOptions.idx[name] = (_constructed, loadingOptions) + return _constructed - if str(e) == "missing required field `outputBinding`": + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.inputBinding = inputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "inputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputArraySchema(InputArraySchema): + def __eq__(self, other: Any) -> bool: + if isinstance(other, CommandInputArraySchema): + return bool( + self.items == other.items + and self.type_ == other.type_ + and self.label == other.label + and self.inputBinding == other.inputBinding + ) + return False + + def __hash__(self) -> int: + return hash((self.items, self.type_, self.label, self.inputBinding)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) + + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -8067,13 +9143,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputBinding") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8085,28 +9161,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `outputBinding` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -8114,13 +9190,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8132,10 +9208,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -8147,14 +9223,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `outputBinding`, `format`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -8164,17 +9240,13 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, + items=items, + type_=type_, label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - outputBinding=outputBinding, - format=format, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -8188,41 +9260,24 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u + if self.items is not None: + u = save_relative_uri(self.items, base_url, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=base_url, relative_uris=relative_uris + ) if self.label is not None: r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris + self.label, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, top=False, - base_url=self.id, + base_url=base_url, relative_uris=relative_uris, ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u # top refers to the directory level if top: @@ -8234,13 +9289,10 @@ def save( def __init__( self, - id: str, + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, - secondaryFiles: None | Sequence[str] | str = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - outputBinding: CommandOutputBinding | None = None, - format: None | str = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8252,46 +9304,32 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.outputBinding = outputBinding - self.format = format + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "outputBinding", - "format", - ] + ["items", "type", "label", "inputBinding"] ) @mypyc_attr(native_class=True) -class InlineJavascriptRequirement(Saveable): - """ - Indicates that the workflow platform must support inline Javascript expressions. - If this requirement is not present, the workflow platform must not perform expression - interpolatation. - - """ +class CommandOutputRecordField(OutputRecordField): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InlineJavascriptRequirement): + if isinstance(other, CommandOutputRecordField): return bool( - self.class_ == other.class_ - and self.expressionLib == other.expressionLib + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.outputBinding == other.outputBinding ) return False def __hash__(self) -> int: - return hash((self.class_, self.expressionLib)) + return hash((self.doc, self.name, self.type_, self.outputBinding)) @classmethod def fromDoc( @@ -8307,37 +9345,172 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `name`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - class_ = load_field( - _doc.get("class"), - uri_InlineJavascriptRequirement_classLoader_False_True_None_None, + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, - lc=_doc.get("class") + lc=_doc.get("type") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - expressionLib = None - if "expressionLib" in _doc: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + outputBinding = None + if "outputBinding" in _doc: try: - expressionLib = load_field( - _doc.get("expressionLib"), - union_of_None_type_or_array_of_strtype, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("expressionLib") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `expressionLib`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -8345,13 +9518,13 @@ def fromDoc( ) ) else: - val = _doc.get("expressionLib") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `expressionLib` field is not valid because:", - SourceLine(_doc, "expressionLib", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8363,10 +9536,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `expressionLib` field is not valid because:", - SourceLine(_doc, "expressionLib", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `expressionLib` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -8378,14 +9551,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `expressionLib`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `outputBinding`".format( k ), SourceLine(_doc, k, str), @@ -8395,10 +9568,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - expressionLib=expressionLib, + name=name, + doc=doc, + type_=type_, + outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -8412,19 +9589,22 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.expressionLib is not None: - r["expressionLib"] = save( - self.expressionLib, + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, top=False, - base_url=base_url, + base_url=self.name, relative_uris=relative_uris, ) @@ -8438,7 +9618,10 @@ def save( def __init__( self, - expressionLib: None | Sequence[str] = None, + name: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8450,32 +9633,32 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.doc = doc + self.name = name + self.type_ = type_ + self.outputBinding = outputBinding - attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "outputBinding"] + ) @mypyc_attr(native_class=True) -class SchemaDefRequirement(Saveable): - """ - This field consists of an array of type definitions which must be used when - interpreting the `inputs` and `outputs` fields. When a `type` field - contain a IRI, the implementation must check if the type is defined in - `schemaDefs` and use that definition. If the type is not found in - `schemaDefs`, it is an error. The entries in `schemaDefs` must be - processed in the order listed such that later schema definitions may refer - to earlier schema definitions. - - """ +class CommandOutputRecordSchema(OutputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, SchemaDefRequirement): - return bool(self.class_ == other.class_ and self.types == other.types) + if isinstance(other, CommandOutputRecordSchema): + return bool( + self.fields == other.fields + and self.type_ == other.type_ + and self.label == other.label + and self.name == other.name + ) return False def __hash__(self) -> int: - return hash((self.class_, self.types)) + return hash((self.fields, self.type_, self.label, self.name)) @classmethod def fromDoc( @@ -8491,38 +9674,124 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) - class_ = load_field( - _doc.get("class"), - uri_SchemaDefRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + if str(e) == "missing required field `name`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + fields = None + if "fields" in _doc: + try: + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, + baseuri, + loadingOptions, + lc=_doc.get("fields") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `fields`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("fields") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [e], + detailed_message=f"the `fields` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("types") is None: - raise ValidationException("missing required field `types`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - types = load_field( - _doc.get("types"), - array_of_union_of_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader, + type_ = _load_field( + _doc.get("type"), + typedsl_Record_nameLoader_2, baseuri, loadingOptions, - lc=_doc.get("types") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `types`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -8530,13 +9799,13 @@ def fromDoc( ) ) else: - val = _doc.get("types") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `types` field is not valid because:", - SourceLine(_doc, "types", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8548,13 +9817,60 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `types` field is not valid because:", - SourceLine(_doc, "types", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `types` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -8563,14 +9879,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `types`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `name`".format( k ), SourceLine(_doc, k, str), @@ -8580,10 +9896,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - types=types, + name=name, + fields=fields, + type_=type_, + label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -8597,17 +9917,20 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.types is not None: - r["types"] = save( - self.types, top=False, base_url=base_url, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -8620,7 +9943,10 @@ def save( def __init__( self, - types: Sequence[InputArraySchema | InputEnumSchema | InputRecordSchema], + type_: Record_name, + fields: None | Sequence[CommandOutputRecordField] = None, + label: None | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8632,30 +9958,33 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SchemaDefRequirement" - self.types = types + self.fields = fields + self.type_ = type_ + self.label = label + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) @mypyc_attr(native_class=True) -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ +class CommandOutputEnumSchema(OutputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, EnvironmentDef): + if isinstance(other, CommandOutputEnumSchema): return bool( - self.envName == other.envName and self.envValue == other.envValue + self.name == other.name + and self.symbols == other.symbols + and self.type_ == other.type_ + and self.label == other.label + and self.outputBinding == other.outputBinding ) return False def __hash__(self) -> int: - return hash((self.envName, self.envValue)) + return hash( + (self.name, self.symbols, self.type_, self.label, self.outputBinding) + ) @classmethod def fromDoc( @@ -8671,22 +10000,77 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `name`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name try: - if _doc.get("envName") is None: - raise ValidationException("missing required field `envName`", None, []) + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) - envName = load_field( - _doc.get("envName"), - strtype, + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("envName") + lc=_doc.get("symbols") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `envName`": + if str(e) == "missing required field `symbols`": _errors__.append( ValidationException( str(e), @@ -8694,13 +10078,13 @@ def fromDoc( ) ) else: - val = _doc.get("envName") + val = _doc.get("symbols") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `envName` field is not valid because:", - SourceLine(_doc, "envName", str), + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8712,29 +10096,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `envName` field is not valid because:", - SourceLine(_doc, "envName", str), + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), [e], - detailed_message=f"the `envName` field with value `{val}` " + detailed_message=f"the `symbols` field with value `{val}` " "is not valid because:", ) ) try: - if _doc.get("envValue") is None: - raise ValidationException("missing required field `envValue`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - envValue = load_field( - _doc.get("envValue"), - union_of_strtype_or_ExpressionLoader, + type_ = _load_field( + _doc.get("type"), + typedsl_Enum_nameLoader_2, baseuri, loadingOptions, - lc=_doc.get("envValue") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `envValue`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -8742,13 +10126,13 @@ def fromDoc( ) ) else: - val = _doc.get("envValue") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `envValue` field is not valid because:", - SourceLine(_doc, "envValue", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8760,13 +10144,107 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `envValue` field is not valid because:", - SourceLine(_doc, "envValue", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `envValue` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + outputBinding = None + if "outputBinding" in _doc: + try: + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), + [e], + detailed_message=f"the `outputBinding` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -8775,14 +10253,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `envName`, `envValue`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `outputBinding`".format( k ), SourceLine(_doc, k, str), @@ -8792,11 +10270,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - envName=envName, - envValue=envValue, + name=name, + symbols=symbols, + type_=type_, + label=label, + outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -8810,13 +10292,26 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.envName is not None: - r["envName"] = save( - self.envName, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.envValue is not None: - r["envValue"] = save( - self.envValue, top=False, base_url=base_url, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, + top=False, + base_url=self.name, + relative_uris=relative_uris, ) # top refers to the directory level @@ -8829,8 +10324,11 @@ def save( def __init__( self, - envName: str, - envValue: str, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8842,78 +10340,31 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.outputBinding = outputBinding - attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "outputBinding"] + ) @mypyc_attr(native_class=True) -class CommandLineBinding(Saveable): - """ - - When listed under `inputBinding` in the input schema, the term - "value" refers to the the corresponding value in the input object. For - binding objects listed in `CommandLineTool.arguments`, the term "value" - refers to the effective value after evaluating `valueFrom`. - - The binding behavior when building the command line depends on the data - type of the value. If there is a mismatch between the type described by - the input schema and the effective value, such as resulting from an - expression evaluation, an implementation must use the data type of the - effective value. - - - **string**: Add `prefix` and the string to the command line. - - - **number**: Add `prefix` and decimal representation to command line. - - - **boolean**: If true, add `prefix` to the command line. If false, add - nothing. - - - **File**: Add `prefix` and the value of - [`File.path`](#File) to the command line. - - - **Directory**: Add `prefix` and the value of - [`Directory.path`](#Directory) to the command line. - - - **array**: If `itemSeparator` is specified, add `prefix` and the join - the array into a single string with `itemSeparator` separating the - items. Otherwise first add `prefix`, then recursively process - individual elements. - If the array is empty, it does not add anything to command line. - - - **object**: Add `prefix` only, and recursively add object fields for - which `inputBinding` is specified. - - - **null**: Add nothing. - - """ - +class CommandOutputArraySchema(OutputArraySchema): def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandLineBinding): + if isinstance(other, CommandOutputArraySchema): return bool( - self.loadContents == other.loadContents - and self.position == other.position - and self.prefix == other.prefix - and self.separate == other.separate - and self.itemSeparator == other.itemSeparator - and self.valueFrom == other.valueFrom - and self.shellQuote == other.shellQuote + self.items == other.items + and self.type_ == other.type_ + and self.label == other.label + and self.outputBinding == other.outputBinding ) return False def __hash__(self) -> int: - return hash( - ( - self.loadContents, - self.position, - self.prefix, - self.separate, - self.itemSeparator, - self.valueFrom, - self.shellQuote, - ) - ) + return hash((self.items, self.type_, self.label, self.outputBinding)) @classmethod def fromDoc( @@ -8929,68 +10380,117 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) - if str(e) == "missing required field `loadContents`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("loadContents") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", ) - else: - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [e], - detailed_message=f"the `loadContents` field with value `{val}` " - "is not valid because:", - ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) - position = None - if "position" in _doc: + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: try: - position = load_field( - _doc.get("position"), - union_of_None_type_or_inttype, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("position") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `position`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -8998,13 +10498,13 @@ def fromDoc( ) ) else: - val = _doc.get("position") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `position` field is not valid because:", - SourceLine(_doc, "position", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9016,28 +10516,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `position` field is not valid because:", - SourceLine(_doc, "position", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `position` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - prefix = None - if "prefix" in _doc: + outputBinding = None + if "outputBinding" in _doc: try: - prefix = load_field( - _doc.get("prefix"), - union_of_None_type_or_strtype, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("prefix") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `prefix`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -9045,13 +10545,13 @@ def fromDoc( ) ) else: - val = _doc.get("prefix") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `prefix` field is not valid because:", - SourceLine(_doc, "prefix", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9063,28 +10563,180 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `prefix` field is not valid because:", - SourceLine(_doc, "prefix", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `prefix` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) - separate = None - if "separate" in _doc: - try: - separate = load_field( - _doc.get("separate"), - union_of_None_type_or_booltype, + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `outputBinding`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + items=items, + type_=type_, + label=label, + outputBinding=outputBinding, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.items is not None: + u = save_relative_uri(self.items, base_url, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + outputBinding: CommandOutputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ + self.label = label + self.outputBinding = outputBinding + + attrs: ClassVar[Collection[str]] = frozenset( + ["items", "type", "label", "outputBinding"] + ) + + +@mypyc_attr(native_class=True) +class CommandInputParameter(InputParameter): + """ + An input parameter for a CommandLineTool. + + """ + + id: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, CommandInputParameter): + return bool( + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format + and self.inputBinding == other.inputBinding + and self.default == other.default + and self.type_ == other.type_ + ) + return False + + def __hash__(self) -> int: + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.inputBinding, + self.default, + self.type_, + ) + ) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("separate") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `separate`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -9092,13 +10744,13 @@ def fromDoc( ) ) else: - val = _doc.get("separate") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `separate` field is not valid because:", - SourceLine(_doc, "separate", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9110,28 +10762,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `separate` field is not valid because:", - SourceLine(_doc, "separate", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `separate` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - itemSeparator = None - if "itemSeparator" in _doc: + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: try: - itemSeparator = load_field( - _doc.get("itemSeparator"), + label = _load_field( + _doc.get("label"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("itemSeparator") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `itemSeparator`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -9139,13 +10800,13 @@ def fromDoc( ) ) else: - val = _doc.get("itemSeparator") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `itemSeparator` field is not valid because:", - SourceLine(_doc, "itemSeparator", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9157,28 +10818,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `itemSeparator` field is not valid because:", - SourceLine(_doc, "itemSeparator", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `itemSeparator` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - valueFrom = None - if "valueFrom" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - valueFrom = load_field( - _doc.get("valueFrom"), - union_of_None_type_or_strtype_or_ExpressionLoader, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("valueFrom") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `valueFrom`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -9186,13 +10847,13 @@ def fromDoc( ) ) else: - val = _doc.get("valueFrom") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9204,28 +10865,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `valueFrom` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - shellQuote = None - if "shellQuote" in _doc: + streamable = None + if "streamable" in _doc: try: - shellQuote = load_field( - _doc.get("shellQuote"), + streamable = _load_field( + _doc.get("streamable"), union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("shellQuote") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `shellQuote`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -9233,13 +10894,13 @@ def fromDoc( ) ) else: - val = _doc.get("shellQuote") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `shellQuote` field is not valid because:", - SourceLine(_doc, "shellQuote", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9251,208 +10912,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `shellQuote` field is not valid because:", - SourceLine(_doc, "shellQuote", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `shellQuote` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `loadContents`, `position`, `prefix`, `separate`, `itemSeparator`, `valueFrom`, `shellQuote`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - loadContents=loadContents, - position=position, - prefix=prefix, - separate=separate, - itemSeparator=itemSeparator, - valueFrom=valueFrom, - shellQuote=shellQuote, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.position is not None: - r["position"] = save( - self.position, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.prefix is not None: - r["prefix"] = save( - self.prefix, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.separate is not None: - r["separate"] = save( - self.separate, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.itemSeparator is not None: - r["itemSeparator"] = save( - self.itemSeparator, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.valueFrom is not None: - r["valueFrom"] = save( - self.valueFrom, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.shellQuote is not None: - r["shellQuote"] = save( - self.shellQuote, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - loadContents: None | bool = None, - position: None | i32 = None, - prefix: None | str = None, - separate: None | bool = None, - itemSeparator: None | str = None, - valueFrom: None | str = None, - shellQuote: None | bool = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "loadContents", - "position", - "prefix", - "separate", - "itemSeparator", - "valueFrom", - "shellQuote", - ] - ) - - -@mypyc_attr(native_class=True) -class CommandOutputBinding(Saveable): - """ - Describes how to generate an output parameter based on the files produced - by a CommandLineTool. - - The output parameter value is generated by applying these operations in the - following order: - - - glob - - loadContents - - outputEval - - secondaryFiles - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputBinding): - return bool( - self.glob == other.glob - and self.loadContents == other.loadContents - and self.outputEval == other.outputEval - ) - return False - - def __hash__(self) -> int: - return hash((self.glob, self.loadContents, self.outputEval)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - glob = None - if "glob" in _doc: + doc = None + if "doc" in _doc: try: - glob = load_field( - _doc.get("glob"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("glob") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `glob`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -9460,13 +10941,13 @@ def fromDoc( ) ) else: - val = _doc.get("glob") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `glob` field is not valid because:", - SourceLine(_doc, "glob", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9478,28 +10959,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `glob` field is not valid because:", - SourceLine(_doc, "glob", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `glob` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - loadContents = None - if "loadContents" in _doc: + format = None + if "format" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("format") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `format`": _errors__.append( ValidationException( str(e), @@ -9507,13 +10988,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9525,28 +11006,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) - outputEval = None - if "outputEval" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - outputEval = load_field( - _doc.get("outputEval"), - union_of_None_type_or_strtype_or_ExpressionLoader, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("outputEval") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputEval`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -9554,13 +11035,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputEval") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputEval` field is not valid because:", - SourceLine(_doc, "outputEval", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9572,29 +11053,123 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputEval` field is not valid because:", - SourceLine(_doc, "outputEval", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `outputEval` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + default = None + if "default" in _doc: + try: + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, + baseuri, + loadingOptions, + lc=_doc.get("default") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `default`": _errors__.append( - ValidationException("mapping with implicit null key") - ) + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("default") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [e], + detailed_message=f"the `default` field with value `{val}` " + "is not valid because:", + ) + ) + type_ = None + if "type" in _doc: + try: + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `glob`, `loadContents`, `outputEval`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `inputBinding`, `default`, `type`".format( k ), SourceLine(_doc, k, str), @@ -9604,12 +11179,19 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - glob=glob, - loadContents=loadContents, - outputEval=outputEval, + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + inputBinding=inputBinding, + default=default, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -9623,24 +11205,49 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.glob is not None: - r["glob"] = save( - self.glob, top=False, base_url=base_url, relative_uris=relative_uris + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.outputEval is not None: - r["outputEval"] = save( - self.outputEval, + if self.streamable is not None: + r["streamable"] = save( + self.streamable, top=False, - base_url=base_url, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.id, relative_uris=relative_uris, ) + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -9652,9 +11259,15 @@ def save( def __init__( self, - glob: None | Sequence[str] | str = None, - loadContents: None | bool = None, - outputEval: None | str = None, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, + default: CWLObjectType | None = None, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | None | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -9666,30 +11279,67 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.glob = glob - self.loadContents = loadContents - self.outputEval = outputEval + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.inputBinding = inputBinding + self.default = default + self.type_ = type_ - attrs: ClassVar[Collection[str]] = frozenset(["glob", "loadContents", "outputEval"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "inputBinding", + "default", + "type", + ] + ) @mypyc_attr(native_class=True) -class CommandInputRecordField(InputRecordField): - name: str +class CommandOutputParameter(OutputParameter): + """ + An output parameter for a CommandLineTool. + + """ + + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputRecordField): + if isinstance(other, CommandOutputParameter): return bool( - self.doc == other.doc - and self.name == other.name + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.outputBinding == other.outputBinding + and self.format == other.format and self.type_ == other.type_ - and self.inputBinding == other.inputBinding - and self.label == other.label ) return False def __hash__(self) -> int: - return hash((self.doc, self.name, self.type_, self.inputBinding, self.label)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.outputBinding, + self.format, + self.type_, + ) + ) @classmethod def fromDoc( @@ -9705,21 +11355,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + id = None + if "id" in _doc: try: - name = load_field( - _doc.get("name"), + id = _load_field( + _doc.get("id"), uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -9727,13 +11377,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9745,37 +11395,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - if name is None: + if id is None: if docRoot is not None: - name = docRoot + id = docRoot else: - name = "" - _errors__.append(ValidationException("missing name")) + id = "" + _errors__.append(ValidationException("missing id")) else: - baseuri = name - doc = None - if "doc" in _doc: + baseuri = id + label = None + if "label" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -9783,13 +11433,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9801,76 +11451,122 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - inputBinding = None - if "inputBinding" in _doc: + else: + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("inputBinding") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputBinding`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -9878,13 +11574,13 @@ def fromDoc( ) ) else: - val = _doc.get("inputBinding") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9896,28 +11592,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `inputBinding` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: + outputBinding = None + if "outputBinding" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -9925,13 +11621,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9943,47 +11639,144 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + type_ = None + if "type" in _doc: + try: + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `inputBinding`, `label`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `outputBinding`, `format`, `type`".format( + k + ), + SourceLine(_doc, k, str), ) ) if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, doc=doc, + outputBinding=outputBinding, + format=format, type_=type_, - inputBinding=inputBinding, - label=label, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -9997,27 +11790,44 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) if self.doc is not None: r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris + self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, top=False, - base_url=self.name, + base_url=self.id, relative_uris=relative_uris, ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris ) # top refers to the directory level @@ -10030,11 +11840,14 @@ def save( def __init__( self, - name: str, - type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, - inputBinding: CommandLineBinding | None = None, + id: str, label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | None | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -10046,33 +11859,83 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable self.doc = doc - self.name = name + self.id = id + self.outputBinding = outputBinding + self.format = format self.type_ = type_ - self.inputBinding = inputBinding - self.label = label attrs: ClassVar[Collection[str]] = frozenset( - ["doc", "name", "type", "inputBinding", "label"] + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "outputBinding", + "format", + "type", + ] ) @mypyc_attr(native_class=True) -class CommandInputRecordSchema(InputRecordSchema): - name: str +class CommandLineTool(Saveable): + """ + This defines the schema of the CWL Command Line Tool Description document. + + """ + + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputRecordSchema): + if isinstance(other, CommandLineTool): return bool( - self.fields == other.fields - and self.type_ == other.type_ + self.id == other.id + and self.inputs == other.inputs + and self.outputs == other.outputs + and self.requirements == other.requirements + and self.hints == other.hints and self.label == other.label - and self.name == other.name + and self.doc == other.doc + and self.cwlVersion == other.cwlVersion + and self.class_ == other.class_ + and self.baseCommand == other.baseCommand + and self.arguments == other.arguments + and self.stdin == other.stdin + and self.stderr == other.stderr + and self.stdout == other.stdout + and self.successCodes == other.successCodes + and self.temporaryFailCodes == other.temporaryFailCodes + and self.permanentFailCodes == other.permanentFailCodes ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.name)) + return hash( + ( + self.id, + self.inputs, + self.outputs, + self.requirements, + self.hints, + self.label, + self.doc, + self.cwlVersion, + self.class_, + self.baseCommand, + self.arguments, + self.stdin, + self.stderr, + self.stdout, + self.successCodes, + self.temporaryFailCodes, + self.permanentFailCodes, + ) + ) @classmethod def fromDoc( @@ -10088,21 +11951,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + id = None + if "id" in _doc: try: - name = load_field( - _doc.get("name"), + id = _load_field( + _doc.get("id"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -10110,13 +11973,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10128,84 +11991,102 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - if name is None: + if id is None: if docRoot is not None: - name = docRoot + id = docRoot else: - name = "_:" + str(_uuid__.uuid4()) + id = "_:" + str(_uuid__.uuid4()) else: - baseuri = name - fields = None - if "fields" in _doc: - try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader, - baseuri, - loadingOptions, - lc=_doc.get("fields") - ) + baseuri = id + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + class_ = _load_field( + _doc.get("class"), + uri_CommandLineTool_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) - if str(e) == "missing required field `fields`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("fields") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("inputs") is None: + raise ValidationException("missing required field `inputs`", None, []) + + inputs = _load_field( + _doc.get("inputs"), + idmap_inputs_array_of_CommandInputParameterLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputs") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputs`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputs") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) - else: - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [e], - detailed_message=f"the `fields` field with value `{val}` " - "is not valid because:", - ) + ) + else: + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [e], + detailed_message=f"the `inputs` field with value `{val}` " + "is not valid because:", ) + ) try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("outputs") is None: + raise ValidationException("missing required field `outputs`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, + outputs = _load_field( + _doc.get("outputs"), + idmap_outputs_array_of_CommandOutputParameterLoader, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("outputs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `outputs`": _errors__.append( ValidationException( str(e), @@ -10213,13 +12094,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("outputs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10231,28 +12112,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `outputs` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: + requirements = None + if "requirements" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("requirements") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `requirements`": _errors__.append( ValidationException( str(e), @@ -10260,13 +12141,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("requirements") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10278,157 +12159,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `requirements` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `name`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - fields=fields, - type_=type_, - label=label, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - type_: Record_name, - fields: None | Sequence[CommandInputRecordField] = None, - label: None | str = None, - name: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - - attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) - - -@mypyc_attr(native_class=True) -class CommandInputEnumSchema(InputEnumSchema): - name: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputEnumSchema): - return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ - and self.label == other.label - and self.inputBinding == other.inputBinding - ) - return False - - def __hash__(self) -> int: - return hash( - (self.name, self.symbols, self.type_, self.label, self.inputBinding) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - name = None - if "name" in _doc: + hints = None + if "hints" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("hints") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `hints`": _errors__.append( ValidationException( str(e), @@ -10436,13 +12188,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("hints") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10454,121 +12206,17 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `hints` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -10612,21 +12260,21 @@ def fromDoc( "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: + doc = None + if "doc" in _doc: try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("inputBinding") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputBinding`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -10634,13 +12282,13 @@ def fromDoc( ) ) else: - val = _doc.get("inputBinding") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10652,259 +12300,169 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `inputBinding` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + cwlVersion = None + if "cwlVersion" in _doc: + try: + cwlVersion = _load_field( + _doc.get("cwlVersion"), + uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("cwlVersion") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `cwlVersion`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("cwlVersion") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), + [e], + detailed_message=f"the `cwlVersion` field with value `{val}` " + "is not valid because:", + ) + ) + baseCommand = None + if "baseCommand" in _doc: + try: + baseCommand = _load_field( + _doc.get("baseCommand"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("baseCommand") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `baseCommand`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `inputBinding`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) + else: + val = _doc.get("baseCommand") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `baseCommand` field is not valid because:", + SourceLine(_doc, "baseCommand", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `baseCommand` field is not valid because:", + SourceLine(_doc, "baseCommand", str), + [e], + detailed_message=f"the `baseCommand` field with value `{val}` " + "is not valid because:", + ) + ) + arguments = None + if "arguments" in _doc: + try: + arguments = _load_field( + _doc.get("arguments"), + union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("arguments") + ) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - label=label, - inputBinding=inputBinding, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - label: None | str = None, - inputBinding: CommandLineBinding | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding - - attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "inputBinding"] - ) - - -@mypyc_attr(native_class=True) -class CommandInputArraySchema(InputArraySchema): - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputArraySchema): - return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.inputBinding == other.inputBinding - ) - return False - - def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.inputBinding)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `arguments`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + val = _doc.get("arguments") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `arguments` field is not valid because:", + SourceLine(_doc, "arguments", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + else: + _errors__.append( + ValidationException( + "the `arguments` field is not valid because:", + SourceLine(_doc, "arguments", str), + [e], + detailed_message=f"the `arguments` field with value `{val}` " + "is not valid because:", + ) ) - ) - label = None - if "label" in _doc: + stdin = None + if "stdin" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + stdin = _load_field( + _doc.get("stdin"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("stdin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `stdin`": _errors__.append( ValidationException( str(e), @@ -10912,13 +12470,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("stdin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `stdin` field is not valid because:", + SourceLine(_doc, "stdin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10930,28 +12488,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `stdin` field is not valid because:", + SourceLine(_doc, "stdin", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `stdin` field with value `{val}` " "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: + stderr = None + if "stderr" in _doc: try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, + stderr = _load_field( + _doc.get("stderr"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("inputBinding") + lc=_doc.get("stderr") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputBinding`": + if str(e) == "missing required field `stderr`": _errors__.append( ValidationException( str(e), @@ -10959,13 +12517,13 @@ def fromDoc( ) ) else: - val = _doc.get("inputBinding") + val = _doc.get("stderr") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `stderr` field is not valid because:", + SourceLine(_doc, "stderr", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10977,158 +12535,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `stderr` field is not valid because:", + SourceLine(_doc, "stderr", str), [e], - detailed_message=f"the `inputBinding` field with value `{val}` " + detailed_message=f"the `stderr` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `inputBinding`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - items=items, - type_=type_, - label=label, - inputBinding=inputBinding, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, - type_: Array_name, - label: None | str = None, - inputBinding: CommandLineBinding | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.inputBinding = inputBinding - - attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "inputBinding"] - ) - - -@mypyc_attr(native_class=True) -class CommandOutputRecordField(OutputRecordField): - name: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputRecordField): - return bool( - self.doc == other.doc - and self.name == other.name - and self.type_ == other.type_ - and self.outputBinding == other.outputBinding - ) - return False - - def __hash__(self) -> int: - return hash((self.doc, self.name, self.type_, self.outputBinding)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - name = None - if "name" in _doc: + stdout = None + if "stdout" in _doc: try: - name = load_field( - _doc.get("name"), - uri_strtype_True_False_None_None, + stdout = _load_field( + _doc.get("stdout"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("stdout") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `stdout`": _errors__.append( ValidationException( str(e), @@ -11136,13 +12564,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("stdout") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `stdout` field is not valid because:", + SourceLine(_doc, "stdout", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11154,37 +12582,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `stdout` field is not valid because:", + SourceLine(_doc, "stdout", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `stdout` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "" - _errors__.append(ValidationException("missing name")) - else: - baseuri = name - doc = None - if "doc" in _doc: + successCodes = None + if "successCodes" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + successCodes = _load_field( + _doc.get("successCodes"), + union_of_None_type_or_array_of_inttype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("successCodes") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `successCodes`": _errors__.append( ValidationException( str(e), @@ -11192,13 +12611,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("successCodes") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `successCodes` field is not valid because:", + SourceLine(_doc, "successCodes", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11210,76 +12629,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `successCodes` field is not valid because:", + SourceLine(_doc, "successCodes", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `successCodes` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: + temporaryFailCodes = None + if "temporaryFailCodes" in _doc: try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, + temporaryFailCodes = _load_field( + _doc.get("temporaryFailCodes"), + union_of_None_type_or_array_of_inttype, baseuri, loadingOptions, - lc=_doc.get("outputBinding") + lc=_doc.get("temporaryFailCodes") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputBinding`": + if str(e) == "missing required field `temporaryFailCodes`": _errors__.append( ValidationException( str(e), @@ -11287,13 +12658,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputBinding") + val = _doc.get("temporaryFailCodes") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `temporaryFailCodes` field is not valid because:", + SourceLine(_doc, "temporaryFailCodes", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11305,29 +12676,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `temporaryFailCodes` field is not valid because:", + SourceLine(_doc, "temporaryFailCodes", str), [e], - detailed_message=f"the `outputBinding` field with value `{val}` " + detailed_message=f"the `temporaryFailCodes` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: + permanentFailCodes = None + if "permanentFailCodes" in _doc: + try: + permanentFailCodes = _load_field( + _doc.get("permanentFailCodes"), + union_of_None_type_or_array_of_inttype, + baseuri, + loadingOptions, + lc=_doc.get("permanentFailCodes") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `permanentFailCodes`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("permanentFailCodes") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `permanentFailCodes` field is not valid because:", + SourceLine(_doc, "permanentFailCodes", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `permanentFailCodes` field is not valid because:", + SourceLine(_doc, "permanentFailCodes", str), + [e], + detailed_message=f"the `permanentFailCodes` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: if not k: _errors__.append( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `outputBinding`".format( + "invalid field `{}`, expected one of: `id`, `inputs`, `outputs`, `requirements`, `hints`, `label`, `doc`, `cwlVersion`, `class`, `baseCommand`, `arguments`, `stdin`, `stderr`, `stdout`, `successCodes`, `temporaryFailCodes`, `permanentFailCodes`".format( k ), SourceLine(_doc, k, str), @@ -11337,14 +12755,26 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, + id=id, + inputs=inputs, + outputs=outputs, + requirements=requirements, + hints=hints, + label=label, doc=doc, - type_=type_, - outputBinding=outputBinding, + cwlVersion=cwlVersion, + baseCommand=baseCommand, + arguments=arguments, + stdin=stdin, + stderr=stderr, + stdout=stdout, + successCodes=successCodes, + temporaryFailCodes=temporaryFailCodes, + permanentFailCodes=permanentFailCodes, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -11358,22 +12788,91 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, self.id, False, None, relative_uris) + r["class"] = u + if self.inputs is not None: + r["inputs"] = save( + self.inputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputs is not None: + r["outputs"] = save( + self.outputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.requirements is not None: + r["requirements"] = save( + self.requirements, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) if self.doc is not None: r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris + if self.cwlVersion is not None: + u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) + r["cwlVersion"] = u + if self.baseCommand is not None: + r["baseCommand"] = save( + self.baseCommand, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, + if self.arguments is not None: + r["arguments"] = save( + self.arguments, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.stdin is not None: + r["stdin"] = save( + self.stdin, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.stderr is not None: + r["stderr"] = save( + self.stderr, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.stdout is not None: + r["stdout"] = save( + self.stdout, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.successCodes is not None: + r["successCodes"] = save( + self.successCodes, top=False, - base_url=self.name, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.temporaryFailCodes is not None: + r["temporaryFailCodes"] = save( + self.temporaryFailCodes, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.permanentFailCodes is not None: + r["permanentFailCodes"] = save( + self.permanentFailCodes, + top=False, + base_url=self.id, relative_uris=relative_uris, ) @@ -11387,10 +12886,22 @@ def save( def __init__( self, - name: str, - type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, - outputBinding: CommandOutputBinding | None = None, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | MultipleInputFeatureRequirement | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | MultipleInputFeatureRequirement | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: CWLVersion | None = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -11402,32 +12913,94 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label self.doc = doc - self.name = name - self.type_ = type_ - self.outputBinding = outputBinding + self.cwlVersion = cwlVersion + self.class_: Final[str] = "CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( - ["doc", "name", "type", "outputBinding"] + [ + "id", + "inputs", + "outputs", + "requirements", + "hints", + "label", + "doc", + "cwlVersion", + "class", + "baseCommand", + "arguments", + "stdin", + "stderr", + "stdout", + "successCodes", + "temporaryFailCodes", + "permanentFailCodes", + ] ) @mypyc_attr(native_class=True) -class CommandOutputRecordSchema(OutputRecordSchema): - name: str +class DockerRequirement(Saveable): + """ + Indicates that a workflow component should be run in a `Docker `__ container, and specifies how to fetch or build the image. + + If a CommandLineTool lists ``DockerRequirement`` under ``hints`` (or ``requirements``), it may (or must) be run in the specified Docker container. + + The platform must first acquire or install the correct Docker image as specified by ``dockerPull``, ``dockerImport``, ``dockerLoad`` or ``dockerFile``. + + The platform must execute the tool in the container using ``docker run`` with the appropriate Docker image and tool command line. + + The workflow platform may provide input files and the designated output directory through the use of volume bind mounts. The platform should rewrite file paths in the input object to correspond to the Docker bind mounted locations. That is, the platform should rewrite values in the parameter context such as ``runtime.outdir``, ``runtime.tmpdir`` and others to be valid paths within the container. + + When running a tool contained in Docker, the workflow platform must not assume anything about the contents of the Docker container, such as the presence or absence of specific software, except to assume that the generated command line represents a valid command within the runtime environment of the container. + + Interaction with other requirements + ----------------------------------- + + If `EnvVarRequirement <#EnvVarRequirement>`__ is specified alongside a DockerRequirement, the environment variables must be provided to Docker using ``--env`` or ``--env-file`` and interact with the container's preexisting environment as defined by Docker. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputRecordSchema): + if isinstance(other, DockerRequirement): return bool( - self.fields == other.fields - and self.type_ == other.type_ - and self.label == other.label - and self.name == other.name + self.class_ == other.class_ + and self.dockerPull == other.dockerPull + and self.dockerLoad == other.dockerLoad + and self.dockerFile == other.dockerFile + and self.dockerImport == other.dockerImport + and self.dockerImageId == other.dockerImageId + and self.dockerOutputDirectory == other.dockerOutputDirectory ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.name)) + return hash( + ( + self.class_, + self.dockerPull, + self.dockerLoad, + self.dockerFile, + self.dockerImport, + self.dockerImageId, + self.dockerOutputDirectory, + ) + ) @classmethod def fromDoc( @@ -11443,21 +13016,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_DockerRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + dockerPull = None + if "dockerPull" in _doc: + try: + dockerPull = _load_field( + _doc.get("dockerPull"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("dockerPull") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `dockerPull`": _errors__.append( ValidationException( str(e), @@ -11465,13 +13055,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("dockerPull") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `dockerPull` field is not valid because:", + SourceLine(_doc, "dockerPull", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11483,36 +13073,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `dockerPull` field is not valid because:", + SourceLine(_doc, "dockerPull", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `dockerPull` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - fields = None - if "fields" in _doc: + dockerLoad = None + if "dockerLoad" in _doc: try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, + dockerLoad = _load_field( + _doc.get("dockerLoad"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("fields") + lc=_doc.get("dockerLoad") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `fields`": + if str(e) == "missing required field `dockerLoad`": _errors__.append( ValidationException( str(e), @@ -11520,13 +13102,13 @@ def fromDoc( ) ) else: - val = _doc.get("fields") + val = _doc.get("dockerLoad") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `dockerLoad` field is not valid because:", + SourceLine(_doc, "dockerLoad", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11538,76 +13120,169 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `dockerLoad` field is not valid because:", + SourceLine(_doc, "dockerLoad", str), [e], - detailed_message=f"the `fields` field with value `{val}` " + detailed_message=f"the `dockerLoad` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + dockerFile = None + if "dockerFile" in _doc: + try: + dockerFile = _load_field( + _doc.get("dockerFile"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("dockerFile") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None + if str(e) == "missing required field `dockerFile`": + _errors__.append( + ValidationException( + str(e), + None + ) ) + else: + val = _doc.get("dockerFile") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `dockerFile` field is not valid because:", + SourceLine(_doc, "dockerFile", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `dockerFile` field is not valid because:", + SourceLine(_doc, "dockerFile", str), + [e], + detailed_message=f"the `dockerFile` field with value `{val}` " + "is not valid because:", + ) + ) + dockerImport = None + if "dockerImport" in _doc: + try: + dockerImport = _load_field( + _doc.get("dockerImport"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("dockerImport") ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `dockerImport`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("dockerImport") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `dockerImport` field is not valid because:", + SourceLine(_doc, "dockerImport", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `dockerImport` field is not valid because:", + SourceLine(_doc, "dockerImport", str), + [e], + detailed_message=f"the `dockerImport` field with value `{val}` " + "is not valid because:", + ) + ) + dockerImageId = None + if "dockerImageId" in _doc: + try: + dockerImageId = _load_field( + _doc.get("dockerImageId"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("dockerImageId") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `dockerImageId`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - label = None - if "label" in _doc: + else: + val = _doc.get("dockerImageId") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `dockerImageId` field is not valid because:", + SourceLine(_doc, "dockerImageId", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `dockerImageId` field is not valid because:", + SourceLine(_doc, "dockerImageId", str), + [e], + detailed_message=f"the `dockerImageId` field with value `{val}` " + "is not valid because:", + ) + ) + dockerOutputDirectory = None + if "dockerOutputDirectory" in _doc: try: - label = load_field( - _doc.get("label"), + dockerOutputDirectory = _load_field( + _doc.get("dockerOutputDirectory"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("dockerOutputDirectory") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `dockerOutputDirectory`": _errors__.append( ValidationException( str(e), @@ -11615,13 +13290,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("dockerOutputDirectory") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `dockerOutputDirectory` field is not valid because:", + SourceLine(_doc, "dockerOutputDirectory", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11633,10 +13308,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `dockerOutputDirectory` field is not valid because:", + SourceLine(_doc, "dockerOutputDirectory", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `dockerOutputDirectory` field with value `{val}` " "is not valid because:", ) ) @@ -11648,14 +13323,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `name`".format( + "invalid field `{}`, expected one of: `class`, `dockerPull`, `dockerLoad`, `dockerFile`, `dockerImport`, `dockerImageId`, `dockerOutputDirectory`".format( k ), SourceLine(_doc, k, str), @@ -11665,14 +13340,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - fields=fields, - type_=type_, - label=label, - extension_fields=extension_fields, - loadingOptions=loadingOptions, + dockerPull=dockerPull, + dockerLoad=dockerLoad, + dockerFile=dockerFile, + dockerImport=dockerImport, + dockerImageId=dockerImageId, + dockerOutputDirectory=dockerOutputDirectory, + extension_fields=extension_fields, + loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -11686,20 +13362,57 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.dockerPull is not None: + r["dockerPull"] = save( + self.dockerPull, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris + if self.dockerLoad is not None: + r["dockerLoad"] = save( + self.dockerLoad, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + if self.dockerFile is not None: + r["dockerFile"] = save( + self.dockerFile, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.dockerImport is not None: + r["dockerImport"] = save( + self.dockerImport, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.dockerImageId is not None: + r["dockerImageId"] = save( + self.dockerImageId, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.dockerOutputDirectory is not None: + r["dockerOutputDirectory"] = save( + self.dockerOutputDirectory, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -11712,10 +13425,12 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[CommandOutputRecordField] = None, - label: None | str = None, - name: None | str = None, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -11727,33 +13442,41 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.class_: Final[str] = "DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory - attrs: ClassVar[Collection[str]] = frozenset(["fields", "type", "label", "name"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "dockerPull", + "dockerLoad", + "dockerFile", + "dockerImport", + "dockerImageId", + "dockerOutputDirectory", + ] + ) @mypyc_attr(native_class=True) -class CommandOutputEnumSchema(OutputEnumSchema): - name: str +class SoftwareRequirement(Saveable): + """ + A list of software packages that should be configured in the environment of the defined process. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputEnumSchema): - return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ - and self.label == other.label - and self.outputBinding == other.outputBinding - ) + if isinstance(other, SoftwareRequirement): + return bool(self.class_ == other.class_ and self.packages == other.packages) return False def __hash__(self) -> int: - return hash( - (self.name, self.symbols, self.type_, self.label, self.outputBinding) - ) + return hash((self.class_, self.packages)) @classmethod def fromDoc( @@ -11769,125 +13492,39 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("name") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, + class_ = _load_field( + _doc.get("class"), + uri_SoftwareRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("symbols") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", - ) - ) + raise e try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("packages") is None: + raise ValidationException("missing required field `packages`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, + packages = _load_field( + _doc.get("packages"), + idmap_packages_array_of_SoftwarePackageLoader, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("packages") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `packages`": _errors__.append( ValidationException( str(e), @@ -11895,13 +13532,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("packages") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `packages` field is not valid because:", + SourceLine(_doc, "packages", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11913,107 +13550,13 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `packages` field is not valid because:", + SourceLine(_doc, "packages", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `packages` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: - try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [e], - detailed_message=f"the `outputBinding` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -12022,14 +13565,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `outputBinding`".format( + "invalid field `{}`, expected one of: `class`, `packages`".format( k ), SourceLine(_doc, k, str), @@ -12039,15 +13582,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - label=label, - outputBinding=outputBinding, + packages=packages, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -12061,26 +13599,19 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.packages is not None: + r["packages"] = save( + self.packages, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -12093,11 +13624,7 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - label: None | str = None, - outputBinding: CommandOutputBinding | None = None, + packages: Sequence[SoftwarePackage], extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -12109,31 +13636,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.class_: Final[str] = "SoftwareRequirement" + self.packages = packages - attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "outputBinding"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) @mypyc_attr(native_class=True) -class CommandOutputArraySchema(OutputArraySchema): +class SoftwarePackage(Saveable): def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputArraySchema): + if isinstance(other, SoftwarePackage): return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.outputBinding == other.outputBinding + self.package == other.package + and self.version == other.version + and self.specs == other.specs ) return False def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.outputBinding)) + return hash((self.package, self.version, self.specs)) @classmethod def fromDoc( @@ -12150,69 +13671,21 @@ def fromDoc( _doc.lc.filename = doc.lc.filename _errors__ = [] try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("package") is None: + raise ValidationException("missing required field `package`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, + package = _load_field( + _doc.get("package"), + strtype, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("package") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `package`": _errors__.append( ValidationException( str(e), @@ -12220,13 +13693,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("package") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `package` field is not valid because:", + SourceLine(_doc, "package", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12238,28 +13711,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `package` field is not valid because:", + SourceLine(_doc, "package", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `package` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: + version = None + if "version" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + version = _load_field( + _doc.get("version"), + union_of_None_type_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("version") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `version`": _errors__.append( ValidationException( str(e), @@ -12267,13 +13740,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("version") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `version` field is not valid because:", + SourceLine(_doc, "version", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12285,28 +13758,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `version` field is not valid because:", + SourceLine(_doc, "version", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `version` field with value `{val}` " "is not valid because:", ) ) - outputBinding = None - if "outputBinding" in _doc: + specs = None + if "specs" in _doc: try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, + specs = _load_field( + _doc.get("specs"), + uri_union_of_None_type_or_array_of_strtype_False_False_None_True, baseuri, loadingOptions, - lc=_doc.get("outputBinding") + lc=_doc.get("specs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputBinding`": + if str(e) == "missing required field `specs`": _errors__.append( ValidationException( str(e), @@ -12314,13 +13787,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputBinding") + val = _doc.get("specs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `specs` field is not valid because:", + SourceLine(_doc, "specs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12332,10 +13805,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `specs` field is not valid because:", + SourceLine(_doc, "specs", str), [e], - detailed_message=f"the `outputBinding` field with value `{val}` " + detailed_message=f"the `specs` field with value `{val}` " "is not valid because:", ) ) @@ -12347,14 +13820,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `outputBinding`".format( + "invalid field `{}`, expected one of: `package`, `version`, `specs`".format( k ), SourceLine(_doc, k, str), @@ -12364,10 +13837,9 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - items=items, - type_=type_, - label=label, - outputBinding=outputBinding, + package=package, + version=version, + specs=specs, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -12384,24 +13856,17 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=base_url, relative_uris=relative_uris + if self.package is not None: + r["package"] = save( + self.package, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.version is not None: + r["version"] = save( + self.version, top=False, base_url=base_url, relative_uris=relative_uris ) + if self.specs is not None: + u = save_relative_uri(self.specs, base_url, False, None, relative_uris) + r["specs"] = u # top refers to the directory level if top: @@ -12413,10 +13878,9 @@ def save( def __init__( self, - items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, - type_: Array_name, - label: None | str = None, - outputBinding: CommandOutputBinding | None = None, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -12428,53 +13892,31 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.outputBinding = outputBinding + self.package = package + self.version = version + self.specs = specs - attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "outputBinding"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) @mypyc_attr(native_class=True) -class CommandInputParameter(InputParameter): - """ - An input parameter for a CommandLineTool. +class Dirent(Saveable): """ + Define a file or subdirectory that must be placed in the designated output directory prior to executing the command line tool. May be the result of executing an expression, such as building a configuration file from a template. - id: str + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputParameter): + if isinstance(other, Dirent): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.inputBinding == other.inputBinding - and self.default == other.default - and self.type_ == other.type_ + self.entryname == other.entryname + and self.entry == other.entry + and self.writable == other.writable ) return False def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.inputBinding, - self.default, - self.type_, - ) - ) + return hash((self.entryname, self.entry, self.writable)) @classmethod def fromDoc( @@ -12490,21 +13932,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: + entryname = None + if "entryname" in _doc: try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, + entryname = _load_field( + _doc.get("entryname"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("id") + lc=_doc.get("entryname") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `entryname`": _errors__.append( ValidationException( str(e), @@ -12512,13 +13954,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("entryname") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `entryname` field is not valid because:", + SourceLine(_doc, "entryname", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12530,84 +13972,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `entryname` field is not valid because:", + SourceLine(_doc, "entryname", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `entryname` field with value `{val}` " "is not valid because:", ) ) + try: + if _doc.get("entry") is None: + raise ValidationException("missing required field `entry`", None, []) - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) + entry = _load_field( + _doc.get("entry"), + union_of_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("entry") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `entry`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("entry") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `entry` field is not valid because:", + SourceLine(_doc, "entry", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `entry` field is not valid because:", + SourceLine(_doc, "entry", str), + [e], + detailed_message=f"the `entry` field with value `{val}` " + "is not valid because:", ) - secondaryFiles = None - if "secondaryFiles" in _doc: + ) + writable = None + if "writable" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, + writable = _load_field( + _doc.get("writable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("writable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `writable`": _errors__.append( ValidationException( str(e), @@ -12615,13 +14049,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("writable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `writable` field is not valid because:", + SourceLine(_doc, "writable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12633,311 +14067,214 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `writable` field is not valid because:", + SourceLine(_doc, "writable", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `writable` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `entryname`, `entry`, `writable`".format( + k + ), + SourceLine(_doc, k, str), ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + entryname=entryname, + entry=entry, + writable=writable, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `doc`": + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.entryname is not None: + r["entryname"] = save( + self.entryname, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.entry is not None: + r["entry"] = save( + self.entry, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.writable is not None: + r["writable"] = save( + self.writable, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + entry: str, + entryname: None | str = None, + writable: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.entryname = entryname + self.entry = entry + self.writable = writable + + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + + +@mypyc_attr(native_class=True) +class InitialWorkDirRequirement(Saveable): + """ + Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, InitialWorkDirRequirement): + return bool(self.class_ == other.class_ and self.listing == other.listing) + return False + + def __hash__(self) -> int: + return hash((self.class_, self.listing)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_InitialWorkDirRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("listing") is None: + raise ValidationException("missing required field `listing`", None, []) + + listing = _load_field( + _doc.get("listing"), + union_of_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("listing") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `listing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("listing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": _errors__.append( ValidationException( - str(e), - None + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [e], + detailed_message=f"the `listing` field with value `{val}` " + "is not valid because:", ) ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - default = None - if "default" in _doc: - try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, - baseuri, - loadingOptions, - lc=_doc.get("default") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `default`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("default") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [e], - detailed_message=f"the `default` field with value `{val}` " - "is not valid because:", - ) - ) - type_ = None - if "type" in _doc: - try: - type_ = load_field( - _doc.get("type"), - typedsl_union_of_None_type_or_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `inputBinding`, `default`, `type`".format( + "invalid field `{}`, expected one of: `class`, `listing`".format( k ), SourceLine(_doc, k, str), @@ -12947,19 +14284,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - inputBinding=inputBinding, - default=default, - type_=type_, + listing=listing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -12973,48 +14301,19 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.listing is not None: + r["listing"] = save( + self.listing, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -13027,15 +14326,7 @@ def save( def __init__( self, - id: str, - label: None | str = None, - secondaryFiles: None | Sequence[str] | str = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | Sequence[str] | str = None, - inputBinding: CommandLineBinding | None = None, - default: CWLObjectType | None = None, - type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | None | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str = None, + listing: Sequence[Directory | Dirent | File | str] | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -13047,66 +14338,26 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.inputBinding = inputBinding - self.default = default - self.type_ = type_ + self.class_: Final[str] = "InitialWorkDirRequirement" + self.listing = listing - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "inputBinding", - "default", - "type", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @mypyc_attr(native_class=True) -class CommandOutputParameter(OutputParameter): - """ - An output parameter for a CommandLineTool. +class EnvVarRequirement(Saveable): """ + Define a list of environment variables which will be set in the execution environment of the tool. See ``EnvironmentDef`` for details. - id: str + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputParameter): - return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.outputBinding == other.outputBinding - and self.format == other.format - and self.type_ == other.type_ - ) + if isinstance(other, EnvVarRequirement): + return bool(self.class_ == other.class_ and self.envDef == other.envDef) return False def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.outputBinding, - self.format, - self.type_, - ) - ) + return hash((self.class_, self.envDef)) @classmethod def fromDoc( @@ -13122,428 +14373,100 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + class_ = _load_field( + _doc.get("class"), + uri_EnvVarRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("envDef") is None: + raise ValidationException("missing required field `envDef`", None, []) - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) + envDef = _load_field( + _doc.get("envDef"), + idmap_envDef_array_of_EnvironmentDefLoader, + baseuri, + loadingOptions, + lc=_doc.get("envDef") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `envDef`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("envDef") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `envDef` field is not valid because:", + SourceLine(_doc, "envDef", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - str(e), - None + "the `envDef` field is not valid because:", + SourceLine(_doc, "envDef", str), + [e], + detailed_message=f"the `envDef` field with value `{val}` " + "is not valid because:", ) ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: - try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [e], - detailed_message=f"the `outputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - type_ = None - if "type" in _doc: - try: - type_ = load_field( - _doc.get("type"), - typedsl_union_of_None_type_or_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `outputBinding`, `format`, `type`".format( - k - ), - SourceLine(_doc, k, str), + "invalid field `{}`, expected one of: `class`, `envDef`".format( + k + ), + SourceLine(_doc, k, str), ) ) if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - outputBinding=outputBinding, - format=format, - type_=type_, + envDef=envDef, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -13557,44 +14480,19 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.envDef is not None: + r["envDef"] = save( + self.envDef, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -13607,14 +14505,7 @@ def save( def __init__( self, - id: str, - label: None | str = None, - secondaryFiles: None | Sequence[str] | str = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - outputBinding: CommandOutputBinding | None = None, - format: None | str = None, - type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | None | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str = None, + envDef: Sequence[EnvironmentDef], extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -13626,81 +14517,180 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.outputBinding = outputBinding - self.format = format - self.type_ = type_ + self.class_: Final[str] = "EnvVarRequirement" + self.envDef = envDef - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "outputBinding", - "format", - "type", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @mypyc_attr(native_class=True) -class CommandLineTool(Saveable): +class ShellCommandRequirement(Saveable): """ - This defines the schema of the CWL Command Line Tool Description document. + Modify the behavior of CommandLineTool to generate a single string containing a shell command line. Each item in the argument list must be joined into a string separated by single spaces and quoted to prevent interpretation by the shell, unless ``CommandLineBinding`` for that argument contains ``shellQuote: false``. If ``shellQuote: false`` is specified, the argument is joined into the command string without quoting, which allows the use of shell metacharacters such as ``|`` for pipes. """ - id: str + def __eq__(self, other: Any) -> bool: + if isinstance(other, ShellCommandRequirement): + return bool(self.class_ == other.class_) + return False + + def __hash__(self) -> int: + return hash((self.class_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_ShellCommandRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`".format(k), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ShellCommandRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class ResourceRequirement(Saveable): + """ + Specify basic hardware resource requirements. + + "min" is the minimum amount of a resource that must be reserved to schedule a job. If "min" cannot be satisfied, the job should not be run. + + "max" is the maximum amount of a resource that the job shall be permitted to use. If a node has sufficient resources, multiple jobs may be scheduled on a single node provided each job's "max" resource requirements are met. If a job attempts to exceed its "max" resource allocation, an implementation may deny additional resources, which may result in job failure. + + If "min" is specified but "max" is not, then "max" == "min" If "max" is specified by "min" is not, then "min" == "max". + + It is an error if max < min. + + It is an error if the value of any of these fields is negative. + + If neither "min" nor "max" is specified for a resource, an implementation may provide a default. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandLineTool): + if isinstance(other, ResourceRequirement): return bool( - self.id == other.id - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.label == other.label - and self.doc == other.doc - and self.cwlVersion == other.cwlVersion - and self.class_ == other.class_ - and self.baseCommand == other.baseCommand - and self.arguments == other.arguments - and self.stdin == other.stdin - and self.stderr == other.stderr - and self.stdout == other.stdout - and self.successCodes == other.successCodes - and self.temporaryFailCodes == other.temporaryFailCodes - and self.permanentFailCodes == other.permanentFailCodes + self.class_ == other.class_ + and self.coresMin == other.coresMin + and self.coresMax == other.coresMax + and self.ramMin == other.ramMin + and self.ramMax == other.ramMax + and self.tmpdirMin == other.tmpdirMin + and self.tmpdirMax == other.tmpdirMax + and self.outdirMin == other.outdirMin + and self.outdirMax == other.outdirMax ) return False def __hash__(self) -> int: return hash( ( - self.id, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.label, - self.doc, - self.cwlVersion, self.class_, - self.baseCommand, - self.arguments, - self.stdin, - self.stderr, - self.stdout, - self.successCodes, - self.temporaryFailCodes, - self.permanentFailCodes, + self.coresMin, + self.coresMax, + self.ramMin, + self.ramMax, + self.tmpdirMin, + self.tmpdirMax, + self.outdirMin, + self.outdirMax, ) ) @@ -13718,21 +14708,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_ResourceRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + coresMin = None + if "coresMin" in _doc: try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, + coresMin = _load_field( + _doc.get("coresMin"), + union_of_None_type_or_inttype_or_longtype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("id") + lc=_doc.get("coresMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `coresMin`": _errors__.append( ValidationException( str(e), @@ -13740,13 +14747,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("coresMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `coresMin` field is not valid because:", + SourceLine(_doc, "coresMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13758,148 +14765,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `coresMin` field is not valid because:", + SourceLine(_doc, "coresMin", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `coresMin` field with value `{val}` " "is not valid because:", ) ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_CommandLineTool_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_CommandInputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) - - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_CommandOutputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [e], - detailed_message=f"the `outputs` field with value `{val}` " - "is not valid because:", - ) - ) - requirements = None - if "requirements" in _doc: + coresMax = None + if "coresMax" in _doc: try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + coresMax = _load_field( + _doc.get("coresMax"), + union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("requirements") + lc=_doc.get("coresMax") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `requirements`": + if str(e) == "missing required field `coresMax`": _errors__.append( ValidationException( str(e), @@ -13907,13 +14794,13 @@ def fromDoc( ) ) else: - val = _doc.get("requirements") + val = _doc.get("coresMax") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), + "the `coresMax` field is not valid because:", + SourceLine(_doc, "coresMax", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13925,28 +14812,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), + "the `coresMax` field is not valid because:", + SourceLine(_doc, "coresMax", str), [e], - detailed_message=f"the `requirements` field with value `{val}` " + detailed_message=f"the `coresMax` field with value `{val}` " "is not valid because:", ) ) - hints = None - if "hints" in _doc: + ramMin = None + if "ramMin" in _doc: try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + ramMin = _load_field( + _doc.get("ramMin"), + union_of_None_type_or_inttype_or_longtype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("hints") + lc=_doc.get("ramMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `hints`": + if str(e) == "missing required field `ramMin`": _errors__.append( ValidationException( str(e), @@ -13954,13 +14841,13 @@ def fromDoc( ) ) else: - val = _doc.get("hints") + val = _doc.get("ramMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), + "the `ramMin` field is not valid because:", + SourceLine(_doc, "ramMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13972,28 +14859,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), + "the `ramMin` field is not valid because:", + SourceLine(_doc, "ramMin", str), [e], - detailed_message=f"the `hints` field with value `{val}` " + detailed_message=f"the `ramMin` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: + ramMax = None + if "ramMax" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + ramMax = _load_field( + _doc.get("ramMax"), + union_of_None_type_or_inttype_or_longtype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("ramMax") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `ramMax`": _errors__.append( ValidationException( str(e), @@ -14001,13 +14888,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("ramMax") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `ramMax` field is not valid because:", + SourceLine(_doc, "ramMax", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14019,28 +14906,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `ramMax` field is not valid because:", + SourceLine(_doc, "ramMax", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `ramMax` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + tmpdirMin = None + if "tmpdirMin" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype, + tmpdirMin = _load_field( + _doc.get("tmpdirMin"), + union_of_None_type_or_longtype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("tmpdirMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `tmpdirMin`": _errors__.append( ValidationException( str(e), @@ -14048,13 +14935,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("tmpdirMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `tmpdirMin` field is not valid because:", + SourceLine(_doc, "tmpdirMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14066,28 +14953,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `tmpdirMin` field is not valid because:", + SourceLine(_doc, "tmpdirMin", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `tmpdirMin` field with value `{val}` " "is not valid because:", ) ) - cwlVersion = None - if "cwlVersion" in _doc: + tmpdirMax = None + if "tmpdirMax" in _doc: try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, + tmpdirMax = _load_field( + _doc.get("tmpdirMax"), + union_of_None_type_or_inttype_or_longtype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("cwlVersion") + lc=_doc.get("tmpdirMax") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `cwlVersion`": + if str(e) == "missing required field `tmpdirMax`": _errors__.append( ValidationException( str(e), @@ -14095,13 +14982,13 @@ def fromDoc( ) ) else: - val = _doc.get("cwlVersion") + val = _doc.get("tmpdirMax") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), + "the `tmpdirMax` field is not valid because:", + SourceLine(_doc, "tmpdirMax", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14113,28 +15000,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), + "the `tmpdirMax` field is not valid because:", + SourceLine(_doc, "tmpdirMax", str), [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " + detailed_message=f"the `tmpdirMax` field with value `{val}` " "is not valid because:", ) ) - baseCommand = None - if "baseCommand" in _doc: + outdirMin = None + if "outdirMin" in _doc: try: - baseCommand = load_field( - _doc.get("baseCommand"), - union_of_None_type_or_strtype_or_array_of_strtype, + outdirMin = _load_field( + _doc.get("outdirMin"), + union_of_None_type_or_inttype_or_longtype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("baseCommand") + lc=_doc.get("outdirMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `baseCommand`": + if str(e) == "missing required field `outdirMin`": _errors__.append( ValidationException( str(e), @@ -14142,13 +15029,13 @@ def fromDoc( ) ) else: - val = _doc.get("baseCommand") + val = _doc.get("outdirMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `baseCommand` field is not valid because:", - SourceLine(_doc, "baseCommand", str), + "the `outdirMin` field is not valid because:", + SourceLine(_doc, "outdirMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14160,28 +15047,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `baseCommand` field is not valid because:", - SourceLine(_doc, "baseCommand", str), + "the `outdirMin` field is not valid because:", + SourceLine(_doc, "outdirMin", str), [e], - detailed_message=f"the `baseCommand` field with value `{val}` " + detailed_message=f"the `outdirMin` field with value `{val}` " "is not valid because:", ) ) - arguments = None - if "arguments" in _doc: + outdirMax = None + if "outdirMax" in _doc: try: - arguments = load_field( - _doc.get("arguments"), - union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, + outdirMax = _load_field( + _doc.get("outdirMax"), + union_of_None_type_or_inttype_or_longtype_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("arguments") + lc=_doc.get("outdirMax") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `arguments`": + if str(e) == "missing required field `outdirMax`": _errors__.append( ValidationException( str(e), @@ -14189,13 +15076,13 @@ def fromDoc( ) ) else: - val = _doc.get("arguments") + val = _doc.get("outdirMax") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `arguments` field is not valid because:", - SourceLine(_doc, "arguments", str), + "the `outdirMax` field is not valid because:", + SourceLine(_doc, "outdirMax", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14207,28 +15094,232 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `arguments` field is not valid because:", - SourceLine(_doc, "arguments", str), + "the `outdirMax` field is not valid because:", + SourceLine(_doc, "outdirMax", str), [e], - detailed_message=f"the `arguments` field with value `{val}` " + detailed_message=f"the `outdirMax` field with value `{val}` " "is not valid because:", ) ) - stdin = None - if "stdin" in _doc: + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `coresMin`, `coresMax`, `ramMin`, `ramMax`, `tmpdirMin`, `tmpdirMax`, `outdirMin`, `outdirMax`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + coresMin=coresMin, + coresMax=coresMax, + ramMin=ramMin, + ramMax=ramMax, + tmpdirMin=tmpdirMin, + tmpdirMax=tmpdirMax, + outdirMin=outdirMin, + outdirMax=outdirMax, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.coresMin is not None: + r["coresMin"] = save( + self.coresMin, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.coresMax is not None: + r["coresMax"] = save( + self.coresMax, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.ramMin is not None: + r["ramMin"] = save( + self.ramMin, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.ramMax is not None: + r["ramMax"] = save( + self.ramMax, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.tmpdirMin is not None: + r["tmpdirMin"] = save( + self.tmpdirMin, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.tmpdirMax is not None: + r["tmpdirMax"] = save( + self.tmpdirMax, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.outdirMin is not None: + r["outdirMin"] = save( + self.outdirMin, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.outdirMax is not None: + r["outdirMax"] = save( + self.outdirMax, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + coresMin: None | i32 | i64 | str = None, + coresMax: None | i32 | str = None, + ramMin: None | i32 | i64 | str = None, + ramMax: None | i32 | i64 | str = None, + tmpdirMin: None | i64 | str = None, + tmpdirMax: None | i32 | i64 | str = None, + outdirMin: None | i32 | i64 | str = None, + outdirMax: None | i32 | i64 | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "coresMin", + "coresMax", + "ramMin", + "ramMax", + "tmpdirMin", + "tmpdirMax", + "outdirMin", + "outdirMax", + ] + ) + + +@mypyc_attr(native_class=True) +class ExpressionToolOutputParameter(OutputParameter): + id: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, ExpressionToolOutputParameter): + return bool( + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.outputBinding == other.outputBinding + and self.format == other.format + and self.type_ == other.type_ + ) + return False + + def __hash__(self) -> int: + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.outputBinding, + self.format, + self.type_, + ) + ) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + id = None + if "id" in _doc: try: - stdin = load_field( - _doc.get("stdin"), - union_of_None_type_or_strtype_or_ExpressionLoader, + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("stdin") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `stdin`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -14236,13 +15327,13 @@ def fromDoc( ) ) else: - val = _doc.get("stdin") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `stdin` field is not valid because:", - SourceLine(_doc, "stdin", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14254,42 +15345,51 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `stdin` field is not valid because:", - SourceLine(_doc, "stdin", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `stdin` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - stderr = None - if "stderr" in _doc: - try: - stderr = load_field( - _doc.get("stderr"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("stderr") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `stderr`": - _errors__.append( - ValidationException( - str(e), + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), None ) ) else: - val = _doc.get("stderr") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `stderr` field is not valid because:", - SourceLine(_doc, "stderr", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14301,28 +15401,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `stderr` field is not valid because:", - SourceLine(_doc, "stderr", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `stderr` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - stdout = None - if "stdout" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - stdout = load_field( - _doc.get("stdout"), - union_of_None_type_or_strtype_or_ExpressionLoader, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("stdout") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `stdout`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -14330,13 +15430,13 @@ def fromDoc( ) ) else: - val = _doc.get("stdout") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `stdout` field is not valid because:", - SourceLine(_doc, "stdout", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14348,28 +15448,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `stdout` field is not valid because:", - SourceLine(_doc, "stdout", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `stdout` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - successCodes = None - if "successCodes" in _doc: + streamable = None + if "streamable" in _doc: try: - successCodes = load_field( - _doc.get("successCodes"), - union_of_None_type_or_array_of_inttype, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("successCodes") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `successCodes`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -14377,13 +15477,13 @@ def fromDoc( ) ) else: - val = _doc.get("successCodes") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `successCodes` field is not valid because:", - SourceLine(_doc, "successCodes", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14395,28 +15495,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `successCodes` field is not valid because:", - SourceLine(_doc, "successCodes", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `successCodes` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - temporaryFailCodes = None - if "temporaryFailCodes" in _doc: + doc = None + if "doc" in _doc: try: - temporaryFailCodes = load_field( - _doc.get("temporaryFailCodes"), - union_of_None_type_or_array_of_inttype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("temporaryFailCodes") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `temporaryFailCodes`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -14424,13 +15524,13 @@ def fromDoc( ) ) else: - val = _doc.get("temporaryFailCodes") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `temporaryFailCodes` field is not valid because:", - SourceLine(_doc, "temporaryFailCodes", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14442,28 +15542,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `temporaryFailCodes` field is not valid because:", - SourceLine(_doc, "temporaryFailCodes", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `temporaryFailCodes` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - permanentFailCodes = None - if "permanentFailCodes" in _doc: + outputBinding = None + if "outputBinding" in _doc: try: - permanentFailCodes = load_field( - _doc.get("permanentFailCodes"), - union_of_None_type_or_array_of_inttype, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("permanentFailCodes") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `permanentFailCodes`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -14471,13 +15571,13 @@ def fromDoc( ) ) else: - val = _doc.get("permanentFailCodes") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `permanentFailCodes` field is not valid because:", - SourceLine(_doc, "permanentFailCodes", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14489,10 +15589,104 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `permanentFailCodes` field is not valid because:", - SourceLine(_doc, "permanentFailCodes", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `permanentFailCodes` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + type_ = None + if "type" in _doc: + try: + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) @@ -14504,14 +15698,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `inputs`, `outputs`, `requirements`, `hints`, `label`, `doc`, `cwlVersion`, `class`, `baseCommand`, `arguments`, `stdin`, `stderr`, `stdout`, `successCodes`, `temporaryFailCodes`, `permanentFailCodes`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `outputBinding`, `format`, `type`".format( k ), SourceLine(_doc, k, str), @@ -14522,21 +15716,13 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( id=id, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, doc=doc, - cwlVersion=cwlVersion, - baseCommand=baseCommand, - arguments=arguments, - stdin=stdin, - stderr=stderr, - stdout=stdout, - successCodes=successCodes, - temporaryFailCodes=temporaryFailCodes, - permanentFailCodes=permanentFailCodes, + outputBinding=outputBinding, + format=format, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -14557,88 +15743,42 @@ def save( if self.id is not None: u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) - r["class"] = u - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) if self.label is not None: r["label"] = save( self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.baseCommand is not None: - r["baseCommand"] = save( - self.baseCommand, + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.arguments is not None: - r["arguments"] = save( - self.arguments, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.stdin is not None: - r["stdin"] = save( - self.stdin, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.stderr is not None: - r["stderr"] = save( - self.stderr, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.stdout is not None: - r["stdout"] = save( - self.stdout, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.successCodes is not None: - r["successCodes"] = save( - self.successCodes, + if self.streamable is not None: + r["streamable"] = save( + self.streamable, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.temporaryFailCodes is not None: - r["temporaryFailCodes"] = save( - self.temporaryFailCodes, - top=False, - base_url=self.id, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.permanentFailCodes is not None: - r["permanentFailCodes"] = save( - self.permanentFailCodes, + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, top=False, base_url=self.id, relative_uris=relative_uris, ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -14650,22 +15790,14 @@ def save( def __init__( self, - inputs: Sequence[CommandInputParameter], - outputs: Sequence[CommandOutputParameter], - id: None | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + id: str, label: None | str = None, - doc: None | str = None, - cwlVersion: CWLVersion | None = None, - baseCommand: None | Sequence[str] | str = None, - arguments: None | Sequence[CommandLineBinding | str] = None, - stdin: None | str = None, - stderr: None | str = None, - stdout: None | str = None, - successCodes: None | Sequence[i32] = None, - temporaryFailCodes: None | Sequence[i32] = None, - permanentFailCodes: None | Sequence[i32] = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + type_: CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -14677,109 +15809,67 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable self.doc = doc - self.cwlVersion = cwlVersion - self.class_: Final[str] = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes + self.id = id + self.outputBinding = outputBinding + self.format = format + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ - "id", - "inputs", - "outputs", - "requirements", - "hints", "label", + "secondaryFiles", + "streamable", "doc", - "cwlVersion", - "class", - "baseCommand", - "arguments", - "stdin", - "stderr", - "stdout", - "successCodes", - "temporaryFailCodes", - "permanentFailCodes", + "id", + "outputBinding", + "format", + "type", ] ) @mypyc_attr(native_class=True) -class DockerRequirement(Saveable): +class ExpressionTool(Saveable): """ - Indicates that a workflow component should be run in a - [Docker](http://docker.com) container, and specifies how to fetch or build - the image. - - If a CommandLineTool lists `DockerRequirement` under - `hints` (or `requirements`), it may (or must) be run in the specified Docker - container. - - The platform must first acquire or install the correct Docker image as - specified by `dockerPull`, `dockerImport`, `dockerLoad` or `dockerFile`. - - The platform must execute the tool in the container using `docker run` with - the appropriate Docker image and tool command line. - - The workflow platform may provide input files and the designated output - directory through the use of volume bind mounts. The platform should rewrite - file paths in the input object to correspond to the Docker bind mounted - locations. That is, the platform should rewrite values in the parameter context - such as `runtime.outdir`, `runtime.tmpdir` and others to be valid paths - within the container. - - When running a tool contained in Docker, the workflow platform must not - assume anything about the contents of the Docker container, such as the - presence or absence of specific software, except to assume that the - generated command line represents a valid command within the runtime - environment of the container. - - ## Interaction with other requirements - - If [EnvVarRequirement](#EnvVarRequirement) is specified alongside a - DockerRequirement, the environment variables must be provided to Docker - using `--env` or `--env-file` and interact with the container's preexisting - environment as defined by Docker. + Execute an expression as a Workflow step. """ + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, DockerRequirement): + if isinstance(other, ExpressionTool): return bool( - self.class_ == other.class_ - and self.dockerPull == other.dockerPull - and self.dockerLoad == other.dockerLoad - and self.dockerFile == other.dockerFile - and self.dockerImport == other.dockerImport - and self.dockerImageId == other.dockerImageId - and self.dockerOutputDirectory == other.dockerOutputDirectory + self.id == other.id + and self.inputs == other.inputs + and self.outputs == other.outputs + and self.requirements == other.requirements + and self.hints == other.hints + and self.label == other.label + and self.doc == other.doc + and self.cwlVersion == other.cwlVersion + and self.class_ == other.class_ + and self.expression == other.expression ) return False def __hash__(self) -> int: return hash( ( + self.id, + self.inputs, + self.outputs, + self.requirements, + self.hints, + self.label, + self.doc, + self.cwlVersion, self.class_, - self.dockerPull, - self.dockerLoad, - self.dockerFile, - self.dockerImport, - self.dockerImageId, - self.dockerOutputDirectory, + self.expression, ) ) @@ -14797,37 +15887,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_DockerRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - dockerPull = None - if "dockerPull" in _doc: + id = None + if "id" in _doc: try: - dockerPull = load_field( - _doc.get("dockerPull"), - union_of_None_type_or_strtype, + id = _load_field( + _doc.get("id"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("dockerPull") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerPull`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -14835,13 +15909,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerPull") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerPull` field is not valid because:", - SourceLine(_doc, "dockerPull", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14853,75 +15927,196 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerPull` field is not valid because:", - SourceLine(_doc, "dockerPull", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `dockerPull` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - dockerLoad = None - if "dockerLoad" in _doc: - try: - dockerLoad = load_field( - _doc.get("dockerLoad"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dockerLoad") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "_:" + str(_uuid__.uuid4()) + else: + baseuri = id + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - if str(e) == "missing required field `dockerLoad`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("dockerLoad") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dockerLoad` field is not valid because:", - SourceLine(_doc, "dockerLoad", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " + class_ = _load_field( + _doc.get("class"), + uri_ExpressionTool_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("inputs") is None: + raise ValidationException("missing required field `inputs`", None, []) + + inputs = _load_field( + _doc.get("inputs"), + idmap_inputs_array_of_InputParameterLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputs") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputs`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputs") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [e], + detailed_message=f"the `inputs` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("outputs") is None: + raise ValidationException("missing required field `outputs`", None, []) + + outputs = _load_field( + _doc.get("outputs"), + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputs") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputs`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outputs") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), + [e], + detailed_message=f"the `outputs` field with value `{val}` " + "is not valid because:", + ) + ) + requirements = None + if "requirements" in _doc: + try: + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, + baseuri, + loadingOptions, + lc=_doc.get("requirements") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `requirements`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("requirements") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " f"{verb_tensage} {error_message}")], ) ) else: _errors__.append( ValidationException( - "the `dockerLoad` field is not valid because:", - SourceLine(_doc, "dockerLoad", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [e], - detailed_message=f"the `dockerLoad` field with value `{val}` " + detailed_message=f"the `requirements` field with value `{val}` " "is not valid because:", ) ) - dockerFile = None - if "dockerFile" in _doc: + hints = None + if "hints" in _doc: try: - dockerFile = load_field( - _doc.get("dockerFile"), - union_of_None_type_or_strtype, + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, baseuri, loadingOptions, - lc=_doc.get("dockerFile") + lc=_doc.get("hints") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerFile`": + if str(e) == "missing required field `hints`": _errors__.append( ValidationException( str(e), @@ -14929,13 +16124,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerFile") + val = _doc.get("hints") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerFile` field is not valid because:", - SourceLine(_doc, "dockerFile", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14947,28 +16142,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerFile` field is not valid because:", - SourceLine(_doc, "dockerFile", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [e], - detailed_message=f"the `dockerFile` field with value `{val}` " + detailed_message=f"the `hints` field with value `{val}` " "is not valid because:", ) ) - dockerImport = None - if "dockerImport" in _doc: + label = None + if "label" in _doc: try: - dockerImport = load_field( - _doc.get("dockerImport"), + label = _load_field( + _doc.get("label"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("dockerImport") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerImport`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -14976,13 +16171,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerImport") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerImport` field is not valid because:", - SourceLine(_doc, "dockerImport", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14994,28 +16189,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerImport` field is not valid because:", - SourceLine(_doc, "dockerImport", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `dockerImport` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - dockerImageId = None - if "dockerImageId" in _doc: + doc = None + if "doc" in _doc: try: - dockerImageId = load_field( - _doc.get("dockerImageId"), + doc = _load_field( + _doc.get("doc"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("dockerImageId") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerImageId`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -15023,13 +16218,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerImageId") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerImageId` field is not valid because:", - SourceLine(_doc, "dockerImageId", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15041,28 +16236,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerImageId` field is not valid because:", - SourceLine(_doc, "dockerImageId", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `dockerImageId` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - dockerOutputDirectory = None - if "dockerOutputDirectory" in _doc: + cwlVersion = None + if "cwlVersion" in _doc: try: - dockerOutputDirectory = load_field( - _doc.get("dockerOutputDirectory"), - union_of_None_type_or_strtype, + cwlVersion = _load_field( + _doc.get("cwlVersion"), + uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("dockerOutputDirectory") + lc=_doc.get("cwlVersion") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerOutputDirectory`": + if str(e) == "missing required field `cwlVersion`": _errors__.append( ValidationException( str(e), @@ -15070,13 +16265,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerOutputDirectory") + val = _doc.get("cwlVersion") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerOutputDirectory` field is not valid because:", - SourceLine(_doc, "dockerOutputDirectory", str), + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15088,221 +16283,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerOutputDirectory` field is not valid because:", - SourceLine(_doc, "dockerOutputDirectory", str), + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), [e], - detailed_message=f"the `dockerOutputDirectory` field with value `{val}` " + detailed_message=f"the `cwlVersion` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `dockerPull`, `dockerLoad`, `dockerFile`, `dockerImport`, `dockerImageId`, `dockerOutputDirectory`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) + try: + if _doc.get("expression") is None: + raise ValidationException("missing required field `expression`", None, []) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - dockerPull=dockerPull, - dockerLoad=dockerLoad, - dockerFile=dockerFile, - dockerImport=dockerImport, - dockerImageId=dockerImageId, - dockerOutputDirectory=dockerOutputDirectory, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.dockerPull is not None: - r["dockerPull"] = save( - self.dockerPull, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerLoad is not None: - r["dockerLoad"] = save( - self.dockerLoad, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerFile is not None: - r["dockerFile"] = save( - self.dockerFile, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerImport is not None: - r["dockerImport"] = save( - self.dockerImport, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerImageId is not None: - r["dockerImageId"] = save( - self.dockerImageId, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerOutputDirectory is not None: - r["dockerOutputDirectory"] = save( - self.dockerOutputDirectory, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - dockerPull: None | str = None, - dockerLoad: None | str = None, - dockerFile: None | str = None, - dockerImport: None | str = None, - dockerImageId: None | str = None, - dockerOutputDirectory: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "dockerPull", - "dockerLoad", - "dockerFile", - "dockerImport", - "dockerImageId", - "dockerOutputDirectory", - ] - ) - - -@mypyc_attr(native_class=True) -class SoftwareRequirement(Saveable): - """ - A list of software packages that should be configured in the environment of - the defined process. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, SoftwareRequirement): - return bool(self.class_ == other.class_ and self.packages == other.packages) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.packages)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_SoftwareRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("packages") is None: - raise ValidationException("missing required field `packages`", None, []) - - packages = load_field( - _doc.get("packages"), - idmap_packages_array_of_SoftwarePackageLoader, + expression = _load_field( + _doc.get("expression"), + union_of_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("packages") + lc=_doc.get("expression") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `packages`": + if str(e) == "missing required field `expression`": _errors__.append( ValidationException( str(e), @@ -15310,13 +16313,13 @@ def fromDoc( ) ) else: - val = _doc.get("packages") + val = _doc.get("expression") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `packages` field is not valid because:", - SourceLine(_doc, "packages", str), + "the `expression` field is not valid because:", + SourceLine(_doc, "expression", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15328,10 +16331,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `packages` field is not valid because:", - SourceLine(_doc, "packages", str), + "the `expression` field is not valid because:", + SourceLine(_doc, "expression", str), [e], - detailed_message=f"the `packages` field with value `{val}` " + detailed_message=f"the `expression` field with value `{val}` " "is not valid because:", ) ) @@ -15343,14 +16346,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `packages`".format( + "invalid field `{}`, expected one of: `id`, `inputs`, `outputs`, `requirements`, `hints`, `label`, `doc`, `cwlVersion`, `class`, `expression`".format( k ), SourceLine(_doc, k, str), @@ -15360,10 +16363,19 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - packages=packages, + id=id, + inputs=inputs, + outputs=outputs, + requirements=requirements, + hints=hints, + label=label, + doc=doc, + cwlVersion=cwlVersion, + expression=expression, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -15377,17 +16389,55 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) + u = save_relative_uri(uri, self.id, False, None, relative_uris) r["class"] = u - if self.packages is not None: - r["packages"] = save( - self.packages, top=False, base_url=base_url, relative_uris=relative_uris + if self.inputs is not None: + r["inputs"] = save( + self.inputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputs is not None: + r["outputs"] = save( + self.outputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.requirements is not None: + r["requirements"] = save( + self.requirements, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.cwlVersion is not None: + u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) + r["cwlVersion"] = u + if self.expression is not None: + r["expression"] = save( + self.expression, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) # top refers to the directory level @@ -15400,7 +16450,15 @@ def save( def __init__( self, - packages: Sequence[SoftwarePackage], + inputs: Sequence[InputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | MultipleInputFeatureRequirement | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | MultipleInputFeatureRequirement | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement] = None, + label: None | str = None, + doc: None | str = None, + cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -15412,25 +16470,73 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages - - attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) - - -@mypyc_attr(native_class=True) -class SoftwarePackage(Saveable): + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.cwlVersion = cwlVersion + self.class_: Final[str] = "ExpressionTool" + self.expression = expression + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "inputs", + "outputs", + "requirements", + "hints", + "label", + "doc", + "cwlVersion", + "class", + "expression", + ] + ) + + +@mypyc_attr(native_class=True) +class WorkflowOutputParameter(OutputParameter): + """ + Describe an output parameter of a workflow. The parameter must be connected to one or more parameters defined in the workflow that will provide the value of the output parameter. + + """ + + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, SoftwarePackage): + if isinstance(other, WorkflowOutputParameter): return bool( - self.package == other.package - and self.version == other.version - and self.specs == other.specs + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.outputBinding == other.outputBinding + and self.format == other.format + and self.outputSource == other.outputSource + and self.linkMerge == other.linkMerge + and self.type_ == other.type_ ) return False def __hash__(self) -> int: - return hash((self.package, self.version, self.specs)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.outputBinding, + self.format, + self.outputSource, + self.linkMerge, + self.type_, + ) + ) @classmethod def fromDoc( @@ -15446,69 +16552,77 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("package") is None: - raise ValidationException("missing required field `package`", None, []) - - package = load_field( - _doc.get("package"), - strtype, - baseuri, - loadingOptions, - lc=_doc.get("package") - ) + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `package`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("package") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `id`": _errors__.append( ValidationException( - "the `package` field is not valid because:", - SourceLine(_doc, "package", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `package` field is not valid because:", - SourceLine(_doc, "package", str), - [e], - detailed_message=f"the `package` field with value `{val}` " - "is not valid because:", + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - version = None - if "version" in _doc: + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: try: - version = load_field( - _doc.get("version"), - union_of_None_type_or_array_of_strtype, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("version") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `version`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -15516,13 +16630,13 @@ def fromDoc( ) ) else: - val = _doc.get("version") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `version` field is not valid because:", - SourceLine(_doc, "version", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15534,28 +16648,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `version` field is not valid because:", - SourceLine(_doc, "version", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `version` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - specs = None - if "specs" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - specs = load_field( - _doc.get("specs"), - uri_union_of_None_type_or_array_of_strtype_False_False_None_True, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("specs") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `specs`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -15563,13 +16677,13 @@ def fromDoc( ) ) else: - val = _doc.get("specs") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `specs` field is not valid because:", - SourceLine(_doc, "specs", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15581,151 +16695,75 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `specs` field is not valid because:", - SourceLine(_doc, "specs", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `specs` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `package`, `version`, `specs`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - package=package, - version=version, - specs=specs, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.package is not None: - r["package"] = save( - self.package, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.version is not None: - r["version"] = save( - self.version, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.specs is not None: - u = save_relative_uri(self.specs, base_url, False, None, relative_uris) - r["specs"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - package: str, - version: None | Sequence[str] = None, - specs: None | Sequence[str] = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs - - attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) - - -@mypyc_attr(native_class=True) -class Dirent(Saveable): - """ - Define a file or subdirectory that must be placed in the designated output - directory prior to executing the command line tool. May be the result of - executing an expression, such as building a configuration file from a - template. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, Dirent): - return bool( - self.entryname == other.entryname - and self.entry == other.entry - and self.writable == other.writable - ) - return False - - def __hash__(self) -> int: - return hash((self.entryname, self.entry, self.writable)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - entryname = None - if "entryname" in _doc: + else: + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: try: - entryname = load_field( - _doc.get("entryname"), - union_of_None_type_or_strtype_or_ExpressionLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("entryname") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `entryname`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -15733,13 +16771,13 @@ def fromDoc( ) ) else: - val = _doc.get("entryname") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `entryname` field is not valid because:", - SourceLine(_doc, "entryname", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15751,76 +16789,75 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `entryname` field is not valid because:", - SourceLine(_doc, "entryname", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `entryname` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("entry") is None: - raise ValidationException("missing required field `entry`", None, []) - - entry = load_field( - _doc.get("entry"), - union_of_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("entry") - ) + outputBinding = None + if "outputBinding" in _doc: + try: + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputBinding") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `entry`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("entry") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( - "the `entry` field is not valid because:", - SourceLine(_doc, "entry", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `entry` field is not valid because:", - SourceLine(_doc, "entry", str), - [e], - detailed_message=f"the `entry` field with value `{val}` " - "is not valid because:", + val = _doc.get("outputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - writable = None - if "writable" in _doc: + else: + _errors__.append( + ValidationException( + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), + [e], + detailed_message=f"the `outputBinding` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: try: - writable = load_field( - _doc.get("writable"), - union_of_None_type_or_booltype, + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, - lc=_doc.get("writable") + lc=_doc.get("format") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `writable`": + if str(e) == "missing required field `format`": _errors__.append( ValidationException( str(e), @@ -15828,13 +16865,13 @@ def fromDoc( ) ) else: - val = _doc.get("writable") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `writable` field is not valid because:", - SourceLine(_doc, "writable", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15846,5905 +16883,154 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `writable` field is not valid because:", - SourceLine(_doc, "writable", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `writable` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `entryname`, `entry`, `writable`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - entryname=entryname, - entry=entry, - writable=writable, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.entryname is not None: - r["entryname"] = save( - self.entryname, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.entry is not None: - r["entry"] = save( - self.entry, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.writable is not None: - r["writable"] = save( - self.writable, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - entry: str, - entryname: None | str = None, - writable: None | bool = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable - - attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) - - -@mypyc_attr(native_class=True) -class InitialWorkDirRequirement(Saveable): - """ - Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, InitialWorkDirRequirement): - return bool(self.class_ == other.class_ and self.listing == other.listing) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.listing)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_InitialWorkDirRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("listing") is None: - raise ValidationException("missing required field `listing`", None, []) - - listing = load_field( - _doc.get("listing"), - union_of_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirentLoader_or_strtype_or_ExpressionLoader_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("listing") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `listing`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("listing") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), - [e], - detailed_message=f"the `listing` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `listing`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - listing=listing, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.listing is not None: - r["listing"] = save( - self.listing, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - listing: Sequence[Directory | Dirent | File | str] | str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing - - attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) - - -@mypyc_attr(native_class=True) -class EnvVarRequirement(Saveable): - """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, EnvVarRequirement): - return bool(self.class_ == other.class_ and self.envDef == other.envDef) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.envDef)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_EnvVarRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("envDef") is None: - raise ValidationException("missing required field `envDef`", None, []) - - envDef = load_field( - _doc.get("envDef"), - idmap_envDef_array_of_EnvironmentDefLoader, - baseuri, - loadingOptions, - lc=_doc.get("envDef") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `envDef`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("envDef") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `envDef` field is not valid because:", - SourceLine(_doc, "envDef", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `envDef` field is not valid because:", - SourceLine(_doc, "envDef", str), - [e], - detailed_message=f"the `envDef` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `envDef`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - envDef=envDef, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.envDef is not None: - r["envDef"] = save( - self.envDef, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - envDef: Sequence[EnvironmentDef], - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef - - attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) - - -@mypyc_attr(native_class=True) -class ShellCommandRequirement(Saveable): - """ - Modify the behavior of CommandLineTool to generate a single string - containing a shell command line. Each item in the argument list must be - joined into a string separated by single spaces and quoted to prevent - interpretation by the shell, unless `CommandLineBinding` for that argument - contains `shellQuote: false`. If `shellQuote: false` is specified, the - argument is joined into the command string without quoting, which allows - the use of shell metacharacters such as `|` for pipes. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ShellCommandRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ShellCommandRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ShellCommandRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class ResourceRequirement(Saveable): - """ - Specify basic hardware resource requirements. - - "min" is the minimum amount of a resource that must be reserved to schedule - a job. If "min" cannot be satisfied, the job should not be run. - - "max" is the maximum amount of a resource that the job shall be permitted - to use. If a node has sufficient resources, multiple jobs may be scheduled - on a single node provided each job's "max" resource requirements are - met. If a job attempts to exceed its "max" resource allocation, an - implementation may deny additional resources, which may result in job - failure. - - If "min" is specified but "max" is not, then "max" == "min" - If "max" is specified by "min" is not, then "min" == "max". - - It is an error if max < min. - - It is an error if the value of any of these fields is negative. - - If neither "min" nor "max" is specified for a resource, an implementation may provide a default. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ResourceRequirement): - return bool( - self.class_ == other.class_ - and self.coresMin == other.coresMin - and self.coresMax == other.coresMax - and self.ramMin == other.ramMin - and self.ramMax == other.ramMax - and self.tmpdirMin == other.tmpdirMin - and self.tmpdirMax == other.tmpdirMax - and self.outdirMin == other.outdirMin - and self.outdirMax == other.outdirMax - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.class_, - self.coresMin, - self.coresMax, - self.ramMin, - self.ramMax, - self.tmpdirMin, - self.tmpdirMax, - self.outdirMin, - self.outdirMax, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ResourceRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - coresMin = None - if "coresMin" in _doc: - try: - coresMin = load_field( - _doc.get("coresMin"), - union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("coresMin") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `coresMin`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("coresMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `coresMin` field is not valid because:", - SourceLine(_doc, "coresMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `coresMin` field is not valid because:", - SourceLine(_doc, "coresMin", str), - [e], - detailed_message=f"the `coresMin` field with value `{val}` " - "is not valid because:", - ) - ) - coresMax = None - if "coresMax" in _doc: - try: - coresMax = load_field( - _doc.get("coresMax"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("coresMax") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `coresMax`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("coresMax") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `coresMax` field is not valid because:", - SourceLine(_doc, "coresMax", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `coresMax` field is not valid because:", - SourceLine(_doc, "coresMax", str), - [e], - detailed_message=f"the `coresMax` field with value `{val}` " - "is not valid because:", - ) - ) - ramMin = None - if "ramMin" in _doc: - try: - ramMin = load_field( - _doc.get("ramMin"), - union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("ramMin") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `ramMin`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("ramMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `ramMin` field is not valid because:", - SourceLine(_doc, "ramMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `ramMin` field is not valid because:", - SourceLine(_doc, "ramMin", str), - [e], - detailed_message=f"the `ramMin` field with value `{val}` " - "is not valid because:", - ) - ) - ramMax = None - if "ramMax" in _doc: - try: - ramMax = load_field( - _doc.get("ramMax"), - union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("ramMax") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `ramMax`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("ramMax") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `ramMax` field is not valid because:", - SourceLine(_doc, "ramMax", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `ramMax` field is not valid because:", - SourceLine(_doc, "ramMax", str), - [e], - detailed_message=f"the `ramMax` field with value `{val}` " - "is not valid because:", - ) - ) - tmpdirMin = None - if "tmpdirMin" in _doc: - try: - tmpdirMin = load_field( - _doc.get("tmpdirMin"), - union_of_None_type_or_inttype_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("tmpdirMin") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `tmpdirMin`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("tmpdirMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `tmpdirMin` field is not valid because:", - SourceLine(_doc, "tmpdirMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `tmpdirMin` field is not valid because:", - SourceLine(_doc, "tmpdirMin", str), - [e], - detailed_message=f"the `tmpdirMin` field with value `{val}` " - "is not valid because:", - ) - ) - tmpdirMax = None - if "tmpdirMax" in _doc: - try: - tmpdirMax = load_field( - _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("tmpdirMax") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `tmpdirMax`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("tmpdirMax") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `tmpdirMax` field is not valid because:", - SourceLine(_doc, "tmpdirMax", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `tmpdirMax` field is not valid because:", - SourceLine(_doc, "tmpdirMax", str), - [e], - detailed_message=f"the `tmpdirMax` field with value `{val}` " - "is not valid because:", - ) - ) - outdirMin = None - if "outdirMin" in _doc: - try: - outdirMin = load_field( - _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("outdirMin") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outdirMin`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outdirMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outdirMin` field is not valid because:", - SourceLine(_doc, "outdirMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outdirMin` field is not valid because:", - SourceLine(_doc, "outdirMin", str), - [e], - detailed_message=f"the `outdirMin` field with value `{val}` " - "is not valid because:", - ) - ) - outdirMax = None - if "outdirMax" in _doc: - try: - outdirMax = load_field( - _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("outdirMax") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outdirMax`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outdirMax") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outdirMax` field is not valid because:", - SourceLine(_doc, "outdirMax", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outdirMax` field is not valid because:", - SourceLine(_doc, "outdirMax", str), - [e], - detailed_message=f"the `outdirMax` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `coresMin`, `coresMax`, `ramMin`, `ramMax`, `tmpdirMin`, `tmpdirMax`, `outdirMin`, `outdirMax`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - coresMin=coresMin, - coresMax=coresMax, - ramMin=ramMin, - ramMax=ramMax, - tmpdirMin=tmpdirMin, - tmpdirMax=tmpdirMax, - outdirMin=outdirMin, - outdirMax=outdirMax, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.coresMin is not None: - r["coresMin"] = save( - self.coresMin, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.coresMax is not None: - r["coresMax"] = save( - self.coresMax, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.ramMin is not None: - r["ramMin"] = save( - self.ramMin, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.ramMax is not None: - r["ramMax"] = save( - self.ramMax, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.tmpdirMin is not None: - r["tmpdirMin"] = save( - self.tmpdirMin, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.tmpdirMax is not None: - r["tmpdirMax"] = save( - self.tmpdirMax, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.outdirMin is not None: - r["outdirMin"] = save( - self.outdirMin, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.outdirMax is not None: - r["outdirMax"] = save( - self.outdirMax, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - coresMin: None | i32 | str = None, - coresMax: None | i32 | str = None, - ramMin: None | i32 | str = None, - ramMax: None | i32 | str = None, - tmpdirMin: None | i32 | str = None, - tmpdirMax: None | i32 | str = None, - outdirMin: None | i32 | str = None, - outdirMax: None | i32 | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "coresMin", - "coresMax", - "ramMin", - "ramMax", - "tmpdirMin", - "tmpdirMax", - "outdirMin", - "outdirMax", - ] - ) - - -@mypyc_attr(native_class=True) -class ExpressionToolOutputParameter(OutputParameter): - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ExpressionToolOutputParameter): - return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.outputBinding == other.outputBinding - and self.format == other.format - and self.type_ == other.type_ - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.outputBinding, - self.format, - self.type_, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: - try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [e], - detailed_message=f"the `outputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - type_ = None - if "type" in _doc: - try: - type_ = load_field( - _doc.get("type"), - typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `outputBinding`, `format`, `type`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - outputBinding=outputBinding, - format=format, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - label: None | str = None, - secondaryFiles: None | Sequence[str] | str = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - outputBinding: CommandOutputBinding | None = None, - format: None | str = None, - type_: CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.outputBinding = outputBinding - self.format = format - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "outputBinding", - "format", - "type", - ] - ) - - -@mypyc_attr(native_class=True) -class ExpressionTool(Saveable): - """ - Execute an expression as a Workflow step. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ExpressionTool): - return bool( - self.id == other.id - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.label == other.label - and self.doc == other.doc - and self.cwlVersion == other.cwlVersion - and self.class_ == other.class_ - and self.expression == other.expression - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.label, - self.doc, - self.cwlVersion, - self.class_, - self.expression, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ExpressionTool_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_InputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) - - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_ExpressionToolOutputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [e], - detailed_message=f"the `outputs` field with value `{val}` " - "is not valid because:", - ) - ) - requirements = None - if "requirements" in _doc: - try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, - baseuri, - loadingOptions, - lc=_doc.get("requirements") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `requirements`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("requirements") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [e], - detailed_message=f"the `requirements` field with value `{val}` " - "is not valid because:", - ) - ) - hints = None - if "hints" in _doc: - try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("hints") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `hints`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("hints") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [e], - detailed_message=f"the `hints` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - cwlVersion = None - if "cwlVersion" in _doc: - try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("cwlVersion") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cwlVersion`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cwlVersion") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("expression") is None: - raise ValidationException("missing required field `expression`", None, []) - - expression = load_field( - _doc.get("expression"), - union_of_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("expression") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `expression`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("expression") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `expression` field is not valid because:", - SourceLine(_doc, "expression", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `expression` field is not valid because:", - SourceLine(_doc, "expression", str), - [e], - detailed_message=f"the `expression` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `inputs`, `outputs`, `requirements`, `hints`, `label`, `doc`, `cwlVersion`, `class`, `expression`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - label=label, - doc=doc, - cwlVersion=cwlVersion, - expression=expression, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) - r["class"] = u - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.expression is not None: - r["expression"] = save( - self.expression, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - inputs: Sequence[InputParameter], - outputs: Sequence[ExpressionToolOutputParameter], - expression: str, - id: None | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, - label: None | str = None, - doc: None | str = None, - cwlVersion: CWLVersion | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_: Final[str] = "ExpressionTool" - self.expression = expression - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "inputs", - "outputs", - "requirements", - "hints", - "label", - "doc", - "cwlVersion", - "class", - "expression", - ] - ) - - -@mypyc_attr(native_class=True) -class WorkflowOutputParameter(OutputParameter): - """ - Describe an output parameter of a workflow. The parameter must be - connected to one or more parameters defined in the workflow that will - provide the value of the output parameter. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowOutputParameter): - return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.outputBinding == other.outputBinding - and self.format == other.format - and self.outputSource == other.outputSource - and self.linkMerge == other.linkMerge - and self.type_ == other.type_ - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.outputBinding, - self.format, - self.outputSource, - self.linkMerge, - self.type_, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_union_of_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: - try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [e], - detailed_message=f"the `outputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - outputSource = None - if "outputSource" in _doc: - try: - outputSource = load_field( - _doc.get("outputSource"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None, - baseuri, - loadingOptions, - lc=_doc.get("outputSource") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputSource`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputSource") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputSource` field is not valid because:", - SourceLine(_doc, "outputSource", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputSource` field is not valid because:", - SourceLine(_doc, "outputSource", str), - [e], - detailed_message=f"the `outputSource` field with value `{val}` " - "is not valid because:", - ) - ) - linkMerge = None - if "linkMerge" in _doc: - try: - linkMerge = load_field( - _doc.get("linkMerge"), - union_of_None_type_or_LinkMergeMethodLoader, - baseuri, - loadingOptions, - lc=_doc.get("linkMerge") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `linkMerge`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("linkMerge") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [e], - detailed_message=f"the `linkMerge` field with value `{val}` " - "is not valid because:", - ) - ) - type_ = None - if "type" in _doc: - try: - type_ = load_field( - _doc.get("type"), - typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `outputBinding`, `format`, `outputSource`, `linkMerge`, `type`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - outputBinding=outputBinding, - format=format, - outputSource=outputSource, - linkMerge=linkMerge, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.outputSource is not None: - u = save_relative_uri(self.outputSource, self.id, False, 1, relative_uris) - r["outputSource"] = u - if self.linkMerge is not None: - r["linkMerge"] = save( - self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - label: None | str = None, - secondaryFiles: None | Sequence[str] | str = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - outputBinding: CommandOutputBinding | None = None, - format: None | str = None, - outputSource: None | Sequence[str] | str = None, - linkMerge: LinkMergeMethod | None = None, - type_: CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.outputBinding = outputBinding - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "outputBinding", - "format", - "outputSource", - "linkMerge", - "type", - ] - ) - - -@mypyc_attr(native_class=True) -class WorkflowStepInput(Saveable): - """ - The input of a workflow step connects an upstream parameter (from the - workflow inputs, or the outputs of other workflows steps) with the input - parameters of the underlying step. - - ## Input object - - A WorkflowStepInput object must contain an `id` field in the form - `#fieldname` or `#prefix/fieldname`. When the `id` field contains a slash - `/` the field name consists of the characters following the final slash - (the prefix portion may contain one or more slashes to indicate scope). - This defines a field of the workflow step input object with the value of - the `source` parameter(s). - - ## Merging - - To merge multiple inbound data links, - [MultipleInputFeatureRequirement](#MultipleInputFeatureRequirement) must be specified - in the workflow or workflow step requirements. - - If the sink parameter is an array, or named in a [workflow - scatter](#WorkflowStep) operation, there may be multiple inbound data links - listed in the `source` field. The values from the input links are merged - depending on the method specified in the `linkMerge` field. If not - specified, the default method is "merge_nested". - - * **merge_nested** - - The input must be an array consisting of exactly one entry for each - input link. If "merge_nested" is specified with a single link, the value - from the link must be wrapped in a single-item list. - - * **merge_flattened** - - 1. The source and sink parameters must be compatible types, or the source - type must be compatible with single element from the "items" type of - the destination array parameter. - 2. Source parameters which are arrays are concatenated. - Source parameters which are single element types are appended as - single elements. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStepInput): - return bool( - self.source == other.source - and self.linkMerge == other.linkMerge - and self.id == other.id - and self.default == other.default - and self.valueFrom == other.valueFrom - ) - return False - - def __hash__(self) -> int: - return hash( - (self.source, self.linkMerge, self.id, self.default, self.valueFrom) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - source = None - if "source" in _doc: - try: - source = load_field( - _doc.get("source"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None, - baseuri, - loadingOptions, - lc=_doc.get("source") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `source`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("source") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `source` field is not valid because:", - SourceLine(_doc, "source", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `source` field is not valid because:", - SourceLine(_doc, "source", str), - [e], - detailed_message=f"the `source` field with value `{val}` " - "is not valid because:", - ) - ) - linkMerge = None - if "linkMerge" in _doc: - try: - linkMerge = load_field( - _doc.get("linkMerge"), - union_of_None_type_or_LinkMergeMethodLoader, - baseuri, - loadingOptions, - lc=_doc.get("linkMerge") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `linkMerge`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("linkMerge") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [e], - detailed_message=f"the `linkMerge` field with value `{val}` " - "is not valid because:", - ) - ) - default = None - if "default" in _doc: - try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, - baseuri, - loadingOptions, - lc=_doc.get("default") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `default`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("default") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [e], - detailed_message=f"the `default` field with value `{val}` " - "is not valid because:", - ) - ) - valueFrom = None - if "valueFrom" in _doc: - try: - valueFrom = load_field( - _doc.get("valueFrom"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("valueFrom") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `valueFrom`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("valueFrom") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), - [e], - detailed_message=f"the `valueFrom` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `source`, `linkMerge`, `id`, `default`, `valueFrom`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - source=source, - linkMerge=linkMerge, - default=default, - valueFrom=valueFrom, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.source is not None: - u = save_relative_uri(self.source, self.id, False, 2, relative_uris) - r["source"] = u - if self.linkMerge is not None: - r["linkMerge"] = save( - self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.valueFrom is not None: - r["valueFrom"] = save( - self.valueFrom, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - source: None | Sequence[str] | str = None, - linkMerge: LinkMergeMethod | None = None, - default: CWLObjectType | None = None, - valueFrom: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.source = source - self.linkMerge = linkMerge - self.id = id - self.default = default - self.valueFrom = valueFrom - - attrs: ClassVar[Collection[str]] = frozenset( - ["source", "linkMerge", "id", "default", "valueFrom"] - ) - - -@mypyc_attr(native_class=True) -class WorkflowStepOutput(Saveable): - """ - Associate an output parameter of the underlying process with a workflow - parameter. The workflow parameter (given in the `id` field) be may be used - as a `source` to connect with input parameters of other workflow steps, or - with an output parameter of the process. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStepOutput): - return bool(self.id == other.id) - return False - - def __hash__(self) -> int: - return hash((self.id)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id - - attrs: ClassVar[Collection[str]] = frozenset(["id"]) - - -@mypyc_attr(native_class=True) -class WorkflowStep(Saveable): - """ - A workflow step is an executable element of a workflow. It specifies the - underlying process implementation (such as `CommandLineTool` or another - `Workflow`) in the `run` field and connects the input and output parameters - of the underlying process to workflow parameters. - - # Scatter/gather - - To use scatter/gather, - [ScatterFeatureRequirement](#ScatterFeatureRequirement) must be specified - in the workflow or workflow step requirements. - - A "scatter" operation specifies that the associated workflow step or - subworkflow should execute separately over a list of input elements. Each - job making up a scatter operation is independent and may be executed - concurrently. - - The `scatter` field specifies one or more input parameters which will be - scattered. An input parameter may be listed more than once. The declared - type of each input parameter is implicitly becomes an array of items of the - input parameter type. If a parameter is listed more than once, it becomes - a nested array. As a result, upstream parameters which are connected to - scattered parameters must be arrays. - - All output parameter types are also implicitly wrapped in arrays. Each job - in the scatter results in an entry in the output array. - - If any scattered parameter runtime value is an empty array, all outputs are - set to empty arrays and no work is done for the step, according to - applicable scattering rules. - - If `scatter` declares more than one input parameter, `scatterMethod` - describes how to decompose the input into a discrete set of jobs. - - * **dotproduct** specifies that each of the input arrays are aligned and one - element taken from each array to construct each job. It is an error - if all input arrays are not the same length. - - * **nested_crossproduct** specifies the Cartesian product of the inputs, - producing a job for every combination of the scattered inputs. The - output must be nested arrays for each level of scattering, in the - order that the input arrays are listed in the `scatter` field. - - * **flat_crossproduct** specifies the Cartesian product of the inputs, - producing a job for every combination of the scattered inputs. The - output arrays must be flattened to a single level, but otherwise listed in the - order that the input arrays are listed in the `scatter` field. - - # Subworkflows - - To specify a nested workflow as part of a workflow step, - [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be - specified in the workflow or workflow step requirements. - - It is a fatal error if a workflow directly or indirectly invokes itself as - a subworkflow (recursive workflows are not allowed). - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStep): - return bool( - self.id == other.id - and self.in_ == other.in_ - and self.out == other.out - and self.requirements == other.requirements - and self.hints == other.hints - and self.label == other.label - and self.doc == other.doc - and self.run == other.run - and self.scatter == other.scatter - and self.scatterMethod == other.scatterMethod - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.in_, - self.out, - self.requirements, - self.hints, - self.label, - self.doc, - self.run, - self.scatter, - self.scatterMethod, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - try: - if _doc.get("in") is None: - raise ValidationException("missing required field `in`", None, []) - - in_ = load_field( - _doc.get("in"), - idmap_in__array_of_WorkflowStepInputLoader, - baseuri, - loadingOptions, - lc=_doc.get("in") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `in`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("in") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `in` field is not valid because:", - SourceLine(_doc, "in", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `in` field is not valid because:", - SourceLine(_doc, "in", str), - [e], - detailed_message=f"the `in` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("out") is None: - raise ValidationException("missing required field `out`", None, []) - - out = load_field( - _doc.get("out"), - uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("out") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `out`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("out") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `out` field is not valid because:", - SourceLine(_doc, "out", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `out` field is not valid because:", - SourceLine(_doc, "out", str), - [e], - detailed_message=f"the `out` field with value `{val}` " - "is not valid because:", - ) - ) - requirements = None - if "requirements" in _doc: - try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, - baseuri, - loadingOptions, - lc=_doc.get("requirements") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `requirements`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("requirements") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [e], - detailed_message=f"the `requirements` field with value `{val}` " - "is not valid because:", - ) - ) - hints = None - if "hints" in _doc: - try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("hints") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `hints`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("hints") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [e], - detailed_message=f"the `hints` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("run") is None: - raise ValidationException("missing required field `run`", None, []) - - run = load_field( - _doc.get("run"), - uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("run") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `run`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("run") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), - [e], - detailed_message=f"the `run` field with value `{val}` " - "is not valid because:", - ) - ) - scatter = None - if "scatter" in _doc: - try: - scatter = load_field( - _doc.get("scatter"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None, - baseuri, - loadingOptions, - lc=_doc.get("scatter") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `scatter`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("scatter") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `scatter` field is not valid because:", - SourceLine(_doc, "scatter", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `scatter` field is not valid because:", - SourceLine(_doc, "scatter", str), - [e], - detailed_message=f"the `scatter` field with value `{val}` " - "is not valid because:", - ) - ) - scatterMethod = None - if "scatterMethod" in _doc: - try: - scatterMethod = load_field( - _doc.get("scatterMethod"), - uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("scatterMethod") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `scatterMethod`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("scatterMethod") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `scatterMethod` field is not valid because:", - SourceLine(_doc, "scatterMethod", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `scatterMethod` field is not valid because:", - SourceLine(_doc, "scatterMethod", str), - [e], - detailed_message=f"the `scatterMethod` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `in`, `out`, `requirements`, `hints`, `label`, `doc`, `run`, `scatter`, `scatterMethod`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - in_=in_, - out=out, - requirements=requirements, - hints=hints, - label=label, - doc=doc, - run=run, - scatter=scatter, - scatterMethod=scatterMethod, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.in_ is not None: - r["in"] = save( - self.in_, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.out is not None: - u = save_relative_uri(self.out, self.id, True, None, relative_uris) - r["out"] = u - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.run is not None: - u = save_relative_uri(self.run, self.id, False, None, relative_uris) - r["run"] = u - if self.scatter is not None: - u = save_relative_uri(self.scatter, self.id, False, 0, relative_uris) - r["scatter"] = u - if self.scatterMethod is not None: - u = save_relative_uri( - self.scatterMethod, self.id, False, None, relative_uris - ) - r["scatterMethod"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - in_: Sequence[WorkflowStepInput], - out: Sequence[WorkflowStepOutput | str], - run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, - hints: None | Sequence[Any] = None, - label: None | str = None, - doc: None | str = None, - scatter: None | Sequence[str] | str = None, - scatterMethod: None | ScatterMethod = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.run = run - self.scatter = scatter - self.scatterMethod = scatterMethod - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "in", - "out", - "requirements", - "hints", - "label", - "doc", - "run", - "scatter", - "scatterMethod", - ] - ) - - -@mypyc_attr(native_class=True) -class Workflow(Saveable): - """ - A workflow describes a set of **steps** and the **dependencies** between - those steps. When a step produces output that will be consumed by a - second step, the first step is a dependency of the second step. - - When there is a dependency, the workflow engine must execute the preceding - step and wait for it to successfully produce output before executing the - dependent step. If two steps are defined in the workflow graph that - are not directly or indirectly dependent, these steps are **independent**, - and may execute in any order or execute concurrently. A workflow is - complete when all steps have been executed. - - Dependencies between parameters are expressed using the `source` field on - [workflow step input parameters](#WorkflowStepInput) and [workflow output - parameters](#WorkflowOutputParameter). - - The `source` field expresses the dependency of one parameter on another - such that when a value is associated with the parameter specified by - `source`, that value is propagated to the destination parameter. When all - data links inbound to a given step are fulfilled, the step is ready to - execute. - - ## Workflow success and failure - - A completed step must result in one of `success`, `temporaryFailure` or - `permanentFailure` states. An implementation may choose to retry a step - execution which resulted in `temporaryFailure`. An implementation may - choose to either continue running other steps of a workflow, or terminate - immediately upon `permanentFailure`. - - * If any step of a workflow execution results in `permanentFailure`, then - the workflow status is `permanentFailure`. - - * If one or more steps result in `temporaryFailure` and all other steps - complete `success` or are not executed, then the workflow status is - `temporaryFailure`. - - * If all workflow steps are executed and complete with `success`, then the - workflow status is `success`. - - # Extensions - - [ScatterFeatureRequirement](#ScatterFeatureRequirement) and - [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) are - available as standard [extensions](#Extensions_and_Metadata) to core - workflow semantics. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, Workflow): - return bool( - self.id == other.id - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.label == other.label - and self.doc == other.doc - and self.cwlVersion == other.cwlVersion - and self.class_ == other.class_ - and self.steps == other.steps - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.label, - self.doc, - self.cwlVersion, - self.class_, - self.steps, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_Workflow_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_InputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) - - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_WorkflowOutputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [e], - detailed_message=f"the `outputs` field with value `{val}` " - "is not valid because:", - ) - ) - requirements = None - if "requirements" in _doc: - try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, - baseuri, - loadingOptions, - lc=_doc.get("requirements") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `requirements`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("requirements") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [e], - detailed_message=f"the `requirements` field with value `{val}` " - "is not valid because:", - ) - ) - hints = None - if "hints" in _doc: - try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("hints") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `hints`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("hints") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [e], - detailed_message=f"the `hints` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - cwlVersion = None - if "cwlVersion" in _doc: - try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("cwlVersion") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cwlVersion`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cwlVersion") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("steps") is None: - raise ValidationException("missing required field `steps`", None, []) - - steps = load_field( - _doc.get("steps"), - idmap_steps_union_of_array_of_WorkflowStepLoader, - baseuri, - loadingOptions, - lc=_doc.get("steps") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `steps`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("steps") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `steps` field is not valid because:", - SourceLine(_doc, "steps", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `steps` field is not valid because:", - SourceLine(_doc, "steps", str), - [e], - detailed_message=f"the `steps` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `inputs`, `outputs`, `requirements`, `hints`, `label`, `doc`, `cwlVersion`, `class`, `steps`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - label=label, - doc=doc, - cwlVersion=cwlVersion, - steps=steps, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) - r["class"] = u - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.steps is not None: - r["steps"] = save( - self.steps, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - inputs: Sequence[InputParameter], - outputs: Sequence[WorkflowOutputParameter], - steps: Sequence[WorkflowStep], - id: None | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, - label: None | str = None, - doc: None | str = None, - cwlVersion: CWLVersion | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.label = label - self.doc = doc - self.cwlVersion = cwlVersion - self.class_: Final[str] = "Workflow" - self.steps = steps - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "inputs", - "outputs", - "requirements", - "hints", - "label", - "doc", - "cwlVersion", - "class", - "steps", - ] - ) - - -@mypyc_attr(native_class=True) -class SubworkflowFeatureRequirement(Saveable): - """ - Indicates that the workflow platform must support nested workflows in - the `run` field of [WorkflowStep](#WorkflowStep). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, SubworkflowFeatureRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SubworkflowFeatureRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class ScatterFeatureRequirement(Saveable): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ScatterFeatureRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ScatterFeatureRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ScatterFeatureRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class MultipleInputFeatureRequirement(Saveable): - """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, MultipleInputFeatureRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "MultipleInputFeatureRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class StepInputExpressionRequirement(Saveable): - """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, StepInputExpressionRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_StepInputExpressionRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "StepInputExpressionRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class LoadListingRequirement(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, LoadListingRequirement): - return bool( - self.class_ == other.class_ and self.loadListing == other.loadListing - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.loadListing)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("loadListing") is None: - raise ValidationException("missing required field `loadListing`", None, []) - - loadListing = load_field( - _doc.get("loadListing"), - union_of_LoadListingEnumLoader, - baseuri, - loadingOptions, - lc=_doc.get("loadListing") - ) + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + outputSource = None + if "outputSource" in _doc: + try: + outputSource = _load_field( + _doc.get("outputSource"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None, + baseuri, + loadingOptions, + lc=_doc.get("outputSource") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadListing") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `outputSource`": _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("outputSource") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputSource` field is not valid because:", + SourceLine(_doc, "outputSource", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputSource` field is not valid because:", + SourceLine(_doc, "outputSource", str), + [e], + detailed_message=f"the `outputSource` field with value `{val}` " + "is not valid because:", + ) + ) + linkMerge = None + if "linkMerge" in _doc: + try: + linkMerge = _load_field( + _doc.get("linkMerge"), + union_of_None_type_or_LinkMergeMethodLoader, + baseuri, + loadingOptions, + lc=_doc.get("linkMerge") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `linkMerge`": _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [e], - detailed_message=f"the `loadListing` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `loadListing`".format( - k - ), - SourceLine(_doc, k, str), + val = _doc.get("linkMerge") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - loadListing=loadListing, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - loadListing: LoadListingEnum, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "LoadListingRequirement" - self.loadListing = loadListing - - attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) - - -@mypyc_attr(native_class=True) -class InplaceUpdateRequirement(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, InplaceUpdateRequirement): - return bool( - self.class_ == other.class_ - and self.inplaceUpdate == other.inplaceUpdate - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.inplaceUpdate)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("inplaceUpdate") is None: - raise ValidationException("missing required field `inplaceUpdate`", None, []) - - inplaceUpdate = load_field( - _doc.get("inplaceUpdate"), - booltype, - baseuri, - loadingOptions, - lc=_doc.get("inplaceUpdate") - ) + else: + _errors__.append( + ValidationException( + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), + [e], + detailed_message=f"the `linkMerge` field with value `{val}` " + "is not valid because:", + ) + ) + type_ = None + if "type" in _doc: + try: + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inplaceUpdate`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inplaceUpdate") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `type`": _errors__.append( ValidationException( - "the `inplaceUpdate` field is not valid because:", - SourceLine(_doc, "inplaceUpdate", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - else: - _errors__.append( - ValidationException( - "the `inplaceUpdate` field is not valid because:", - SourceLine(_doc, "inplaceUpdate", str), - [e], - detailed_message=f"the `inplaceUpdate` field with value `{val}` " - "is not valid because:", + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -21753,14 +17039,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `inplaceUpdate`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `outputBinding`, `format`, `outputSource`, `linkMerge`, `type`".format( k ), SourceLine(_doc, k, str), @@ -21770,10 +17056,20 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - inplaceUpdate=inplaceUpdate, + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + outputBinding=outputBinding, + format=format, + outputSource=outputSource, + linkMerge=linkMerge, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -21787,21 +17083,52 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.inplaceUpdate is not None: - r["inplaceUpdate"] = save( - self.inplaceUpdate, + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, top=False, - base_url=base_url, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, + top=False, + base_url=self.id, relative_uris=relative_uris, ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.outputSource is not None: + u = save_relative_uri(self.outputSource, self.id, False, 1, relative_uris) + r["outputSource"] = u + if self.linkMerge is not None: + r["linkMerge"] = save( + self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -21813,7 +17140,16 @@ def save( def __init__( self, - inplaceUpdate: bool, + id: str, + label: None | str = None, + secondaryFiles: None | Sequence[str] | str = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + outputBinding: CommandOutputBinding | None = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + type_: CWLType | None | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -21825,21 +17161,78 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.outputBinding = outputBinding + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.type_ = type_ - attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "outputBinding", + "format", + "outputSource", + "linkMerge", + "type", + ] + ) @mypyc_attr(native_class=True) -class Secrets(Saveable): +class WorkflowStepInput(Saveable): + """ + The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input parameters of the underlying step. + + Input object + ------------ + + A WorkflowStepInput object must contain an ``id`` field in the form ``#fieldname`` or ``#prefix/fieldname``. When the ``id`` field contains a slash ``/`` the field name consists of the characters following the final slash (the prefix portion may contain one or more slashes to indicate scope). This defines a field of the workflow step input object with the value of the ``source`` parameter(s). + + Merging + ------- + + To merge multiple inbound data links, `MultipleInputFeatureRequirement <#MultipleInputFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. + + If the sink parameter is an array, or named in a `workflow scatter <#WorkflowStep>`__ operation, there may be multiple inbound data links listed in the ``source`` field. The values from the input links are merged depending on the method specified in the ``linkMerge`` field. If not specified, the default method is "merge_nested". + + * **merge_nested** + + The input must be an array consisting of exactly one entry for each input link. If "merge_nested" is specified with a single link, the value from the link must be wrapped in a single-item list. + + * **merge_flattened** + + 1. The source and sink parameters must be compatible types, or the source type must be compatible with single element from the "items" type of the destination array parameter. + 2. Source parameters which are arrays are concatenated. Source parameters which are single element types are appended as single elements. + + """ + + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, Secrets): - return bool(self.class_ == other.class_ and self.secrets == other.secrets) + if isinstance(other, WorkflowStepInput): + return bool( + self.source == other.source + and self.linkMerge == other.linkMerge + and self.id == other.id + and self.default == other.default + and self.valueFrom == other.valueFrom + ) return False def __hash__(self) -> int: - return hash((self.class_, self.secrets)) + return hash( + (self.source, self.linkMerge, self.id, self.default, self.valueFrom) + ) @classmethod def fromDoc( @@ -21855,70 +17248,250 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("secrets") is None: - raise ValidationException("missing required field `secrets`", None, []) + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) - secrets = load_field( - _doc.get("secrets"), - uri_array_of_strtype_False_False_0_None, - baseuri, - loadingOptions, - lc=_doc.get("secrets") - ) + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + source = None + if "source" in _doc: + try: + source = _load_field( + _doc.get("source"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None, + baseuri, + loadingOptions, + lc=_doc.get("source") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `source`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("source") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `source` field is not valid because:", + SourceLine(_doc, "source", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `source` field is not valid because:", + SourceLine(_doc, "source", str), + [e], + detailed_message=f"the `source` field with value `{val}` " + "is not valid because:", + ) + ) + linkMerge = None + if "linkMerge" in _doc: + try: + linkMerge = _load_field( + _doc.get("linkMerge"), + union_of_None_type_or_LinkMergeMethodLoader, + baseuri, + loadingOptions, + lc=_doc.get("linkMerge") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secrets`": - _errors__.append( - ValidationException( - str(e), - None + if str(e) == "missing required field `linkMerge`": + _errors__.append( + ValidationException( + str(e), + None + ) ) + else: + val = _doc.get("linkMerge") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), + [e], + detailed_message=f"the `linkMerge` field with value `{val}` " + "is not valid because:", + ) + ) + default = None + if "default" in _doc: + try: + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, + baseuri, + loadingOptions, + lc=_doc.get("default") ) - else: - val = _doc.get("secrets") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `default`": _errors__.append( ValidationException( - "the `secrets` field is not valid because:", - SourceLine(_doc, "secrets", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("default") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [e], + detailed_message=f"the `default` field with value `{val}` " + "is not valid because:", + ) + ) + valueFrom = None + if "valueFrom" in _doc: + try: + valueFrom = _load_field( + _doc.get("valueFrom"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("valueFrom") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `valueFrom`": _errors__.append( ValidationException( - "the `secrets` field is not valid because:", - SourceLine(_doc, "secrets", str), - [e], - detailed_message=f"the `secrets` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) + else: + val = _doc.get("valueFrom") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), + [e], + detailed_message=f"the `valueFrom` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -21927,14 +17500,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `secrets`".format( + "invalid field `{}`, expected one of: `source`, `linkMerge`, `id`, `default`, `valueFrom`".format( k ), SourceLine(_doc, k, str), @@ -21944,10 +17517,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - secrets=secrets, + id=id, + source=source, + linkMerge=linkMerge, + default=default, + valueFrom=valueFrom, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -21961,17 +17539,24 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.secrets is not None: - u = save_relative_uri(self.secrets, base_url, False, 0, relative_uris) - r["secrets"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.source is not None: + u = save_relative_uri(self.source, self.id, False, 2, relative_uris) + r["source"] = u + if self.linkMerge is not None: + r["linkMerge"] = save( + self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.valueFrom is not None: + r["valueFrom"] = save( + self.valueFrom, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -21983,7 +17568,11 @@ def save( def __init__( self, - secrets: Sequence[str], + id: str, + source: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -21995,31 +17584,33 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "Secrets" - self.secrets = secrets + self.source = source + self.linkMerge = linkMerge + self.id = id + self.default = default + self.valueFrom = valueFrom - attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["source", "linkMerge", "id", "default", "valueFrom"] + ) @mypyc_attr(native_class=True) -class TimeLimit(Saveable): +class WorkflowStepOutput(Saveable): """ - Set an upper limit on the execution time of a CommandLineTool or - ExpressionTool. A tool execution which exceeds the time limit may - be preemptively terminated and considered failed. May also be - used by batch systems to make scheduling decisions. + Associate an output parameter of the underlying process with a workflow parameter. The workflow parameter (given in the ``id`` field) be may be used as a ``source`` to connect with input parameters of other workflow steps, or with an output parameter of the process. """ + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, TimeLimit): - return bool( - self.class_ == other.class_ and self.timelimit == other.timelimit - ) + if isinstance(other, WorkflowStepOutput): + return bool(self.id == other.id) return False def __hash__(self) -> int: - return hash((self.class_, self.timelimit)) + return hash((self.id)) @classmethod def fromDoc( @@ -22035,70 +17626,62 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("timelimit") is None: - raise ValidationException("missing required field `timelimit`", None, []) - - timelimit = load_field( - _doc.get("timelimit"), - union_of_inttype_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("timelimit") - ) + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `timelimit`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("timelimit") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `id`": _errors__.append( ValidationException( - "the `timelimit` field is not valid because:", - SourceLine(_doc, "timelimit", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `timelimit` field is not valid because:", - SourceLine(_doc, "timelimit", str), - [e], - detailed_message=f"the `timelimit` field with value `{val}` " - "is not valid because:", + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -22107,16 +17690,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `timelimit`".format( - k - ), + "invalid field `{}`, expected one of: `id`".format(k), SourceLine(_doc, k, str), ) ) @@ -22124,10 +17705,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - timelimit=timelimit, + id=id, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22141,21 +17723,9 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.timelimit is not None: - r["timelimit"] = save( - self.timelimit, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u # top refers to the directory level if top: @@ -22167,7 +17737,7 @@ def save( def __init__( self, - timelimit: i32 | str, + id: str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -22179,36 +17749,79 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "TimeLimit" - self.timelimit = timelimit + self.id = id - attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + attrs: ClassVar[Collection[str]] = frozenset(["id"]) @mypyc_attr(native_class=True) -class WorkReuse(Saveable): +class WorkflowStep(Saveable): """ - For implementations that support reusing output from past work (on - the assumption that same code and same input produce same - results), control whether to enable or disable the reuse behavior - for a particular tool or step (to accommodate situations where that - assumption is incorrect). A reused step is not executed but - instead returns the same output as the original execution. + A workflow step is an executable element of a workflow. It specifies the underlying process implementation (such as ``CommandLineTool`` or another ``Workflow``) in the ``run`` field and connects the input and output parameters of the underlying process to workflow parameters. + + Scatter/gather + ============== + + To use scatter/gather, `ScatterFeatureRequirement <#ScatterFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. - If `enableReuse` is not specified, correct tools should assume it - is enabled by default. + A "scatter" operation specifies that the associated workflow step or subworkflow should execute separately over a list of input elements. Each job making up a scatter operation is independent and may be executed concurrently. + + The ``scatter`` field specifies one or more input parameters which will be scattered. An input parameter may be listed more than once. The declared type of each input parameter is implicitly becomes an array of items of the input parameter type. If a parameter is listed more than once, it becomes a nested array. As a result, upstream parameters which are connected to scattered parameters must be arrays. + + All output parameter types are also implicitly wrapped in arrays. Each job in the scatter results in an entry in the output array. + + If any scattered parameter runtime value is an empty array, all outputs are set to empty arrays and no work is done for the step, according to applicable scattering rules. + + If ``scatter`` declares more than one input parameter, ``scatterMethod`` describes how to decompose the input into a discrete set of jobs. + + * **dotproduct** specifies that each of the input arrays are aligned and one element taken from each array to construct each job. It is an error if all input arrays are not the same length. + + * **nested_crossproduct** specifies the Cartesian product of the inputs, producing a job for every combination of the scattered inputs. The output must be nested arrays for each level of scattering, in the order that the input arrays are listed in the ``scatter`` field. + + * **flat_crossproduct** specifies the Cartesian product of the inputs, producing a job for every combination of the scattered inputs. The output arrays must be flattened to a single level, but otherwise listed in the order that the input arrays are listed in the ``scatter`` field. + + Subworkflows + ============ + + To specify a nested workflow as part of a workflow step, `SubworkflowFeatureRequirement <#SubworkflowFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. + + It is a fatal error if a workflow directly or indirectly invokes itself as a subworkflow (recursive workflows are not allowed). """ + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkReuse): + if isinstance(other, WorkflowStep): return bool( - self.class_ == other.class_ and self.enableReuse == other.enableReuse + self.id == other.id + and self.in_ == other.in_ + and self.out == other.out + and self.requirements == other.requirements + and self.hints == other.hints + and self.label == other.label + and self.doc == other.doc + and self.run == other.run + and self.scatter == other.scatter + and self.scatterMethod == other.scatterMethod ) return False def __hash__(self) -> int: - return hash((self.class_, self.enableReuse)) + return hash( + ( + self.id, + self.in_, + self.out, + self.requirements, + self.hints, + self.label, + self.doc, + self.run, + self.scatter, + self.scatterMethod, + ) + ) @classmethod def fromDoc( @@ -22224,234 +17837,362 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if _doc.get("in") is None: + raise ValidationException("missing required field `in`", None, []) - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, + in_ = _load_field( + _doc.get("in"), + idmap_in__array_of_WorkflowStepInputLoader, baseuri, loadingOptions, - lc=_doc.get("class") + lc=_doc.get("in") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `in`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("in") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `in` field is not valid because:", + SourceLine(_doc, "in", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `in` field is not valid because:", + SourceLine(_doc, "in", str), + [e], + detailed_message=f"the `in` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("enableReuse") is None: - raise ValidationException("missing required field `enableReuse`", None, []) + if _doc.get("out") is None: + raise ValidationException("missing required field `out`", None, []) - enableReuse = load_field( - _doc.get("enableReuse"), - union_of_booltype_or_strtype, + out = _load_field( + _doc.get("out"), + uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("enableReuse") + lc=_doc.get("out") ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `out`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("out") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `out` field is not valid because:", + SourceLine(_doc, "out", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `out` field is not valid because:", + SourceLine(_doc, "out", str), + [e], + detailed_message=f"the `out` field with value `{val}` " + "is not valid because:", + ) + ) + requirements = None + if "requirements" in _doc: + try: + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, + baseuri, + loadingOptions, + lc=_doc.get("requirements") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `requirements`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("requirements") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [e], + detailed_message=f"the `requirements` field with value `{val}` " + "is not valid because:", + ) + ) + hints = None + if "hints" in _doc: + try: + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_Any_type, + baseuri, + loadingOptions, + lc=_doc.get("hints") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `enableReuse`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("enableReuse") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `hints`": _errors__.append( ValidationException( - "the `enableReuse` field is not valid because:", - SourceLine(_doc, "enableReuse", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("hints") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), + [e], + detailed_message=f"the `hints` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": _errors__.append( ValidationException( - "the `enableReuse` field is not valid because:", - SourceLine(_doc, "enableReuse", str), - [e], - detailed_message=f"the `enableReuse` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `enableReuse`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - enableReuse=enableReuse, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.enableReuse is not None: - r["enableReuse"] = save( - self.enableReuse, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - enableReuse: bool | str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse - - attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) - - -@mypyc_attr(native_class=True) -class NetworkAccess(Saveable): - """ - Indicate whether a process requires outgoing IPv4/IPv6 network - access. Choice of IPv4 or IPv6 is implementation and site - specific, correct tools must support both. - - If `networkAccess` is false or not specified, tools must not - assume network access, except for localhost (the loopback device). - - If `networkAccess` is true, the tool must be able to make outgoing - connections to network resources. Resources may be on a private - subnet or the public Internet. However, implementations and sites - may apply their own security policies to restrict what is - accessible by the tool. - - Enabling network access does not imply a publicly routable IP - address or the ability to accept inbound connections. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, NetworkAccess): - return bool( - self.class_ == other.class_ - and self.networkAccess == other.networkAccess - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.networkAccess)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("networkAccess") is None: - raise ValidationException("missing required field `networkAccess`", None, []) + if _doc.get("run") is None: + raise ValidationException("missing required field `run`", None, []) - networkAccess = load_field( - _doc.get("networkAccess"), - union_of_booltype_or_strtype, + run = _load_field( + _doc.get("run"), + uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_False_False_None_None, baseuri, loadingOptions, - lc=_doc.get("networkAccess") + lc=_doc.get("run") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `networkAccess`": + if str(e) == "missing required field `run`": _errors__.append( ValidationException( str(e), @@ -22459,13 +18200,13 @@ def fromDoc( ) ) else: - val = _doc.get("networkAccess") + val = _doc.get("run") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `networkAccess` field is not valid because:", - SourceLine(_doc, "networkAccess", str), + "the `run` field is not valid because:", + SourceLine(_doc, "run", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -22477,13 +18218,107 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `networkAccess` field is not valid because:", - SourceLine(_doc, "networkAccess", str), + "the `run` field is not valid because:", + SourceLine(_doc, "run", str), [e], - detailed_message=f"the `networkAccess` field with value `{val}` " + detailed_message=f"the `run` field with value `{val}` " "is not valid because:", ) ) + scatter = None + if "scatter" in _doc: + try: + scatter = _load_field( + _doc.get("scatter"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None, + baseuri, + loadingOptions, + lc=_doc.get("scatter") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `scatter`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("scatter") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `scatter` field is not valid because:", + SourceLine(_doc, "scatter", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `scatter` field is not valid because:", + SourceLine(_doc, "scatter", str), + [e], + detailed_message=f"the `scatter` field with value `{val}` " + "is not valid because:", + ) + ) + scatterMethod = None + if "scatterMethod" in _doc: + try: + scatterMethod = _load_field( + _doc.get("scatterMethod"), + uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("scatterMethod") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `scatterMethod`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("scatterMethod") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `scatterMethod` field is not valid because:", + SourceLine(_doc, "scatterMethod", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `scatterMethod` field is not valid because:", + SourceLine(_doc, "scatterMethod", str), + [e], + detailed_message=f"the `scatterMethod` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -22492,14 +18327,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `networkAccess`".format( + "invalid field `{}`, expected one of: `id`, `in`, `out`, `requirements`, `hints`, `label`, `doc`, `run`, `scatter`, `scatterMethod`".format( k ), SourceLine(_doc, k, str), @@ -22509,10 +18344,20 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - networkAccess=networkAccess, + id=id, + in_=in_, + out=out, + requirements=requirements, + hints=hints, + label=label, + doc=doc, + run=run, + scatter=scatter, + scatterMethod=scatterMethod, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -22526,21 +18371,46 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.networkAccess is not None: - r["networkAccess"] = save( - self.networkAccess, + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.in_ is not None: + r["in"] = save( + self.in_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.out is not None: + u = save_relative_uri(self.out, self.id, True, None, relative_uris) + r["out"] = u + if self.requirements is not None: + r["requirements"] = save( + self.requirements, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.run is not None: + u = save_relative_uri(self.run, self.id, False, None, relative_uris) + r["run"] = u + if self.scatter is not None: + u = save_relative_uri(self.scatter, self.id, False, 0, relative_uris) + r["scatter"] = u + if self.scatterMethod is not None: + u = save_relative_uri( + self.scatterMethod, self.id, False, None, relative_uris + ) + r["scatterMethod"] = u # top refers to the directory level if top: @@ -22552,7 +18422,16 @@ def save( def __init__( self, - networkAccess: bool | str, + id: str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | Workflow | str, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | MultipleInputFeatureRequirement | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement] = None, + hints: None | Sequence[Any] = None, + label: None | str = None, + doc: None | str = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: None | ScatterMethod = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -22564,18 +18443,66 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess + self.id = id + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.label = label + self.doc = doc + self.run = run + self.scatter = scatter + self.scatterMethod = scatterMethod - attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "in", + "out", + "requirements", + "hints", + "label", + "doc", + "run", + "scatter", + "scatterMethod", + ] + ) @mypyc_attr(native_class=True) -class ProcessGenerator(Saveable): +class Workflow(Saveable): + """ + A workflow describes a set of **steps** and the **dependencies** between those steps. When a step produces output that will be consumed by a second step, the first step is a dependency of the second step. + + When there is a dependency, the workflow engine must execute the preceding step and wait for it to successfully produce output before executing the dependent step. If two steps are defined in the workflow graph that are not directly or indirectly dependent, these steps are **independent**, and may execute in any order or execute concurrently. A workflow is complete when all steps have been executed. + + Dependencies between parameters are expressed using the ``source`` field on `workflow step input parameters <#WorkflowStepInput>`__ and `workflow output parameters <#WorkflowOutputParameter>`__. + + The ``source`` field expresses the dependency of one parameter on another such that when a value is associated with the parameter specified by ``source``, that value is propagated to the destination parameter. When all data links inbound to a given step are fulfilled, the step is ready to execute. + + Workflow success and failure + ---------------------------- + + A completed step must result in one of ``success``, ``temporaryFailure`` or ``permanentFailure`` states. An implementation may choose to retry a step execution which resulted in ``temporaryFailure``. An implementation may choose to either continue running other steps of a workflow, or terminate immediately upon ``permanentFailure``. + + * If any step of a workflow execution results in ``permanentFailure``, then the workflow status is ``permanentFailure``. + + * If one or more steps result in ``temporaryFailure`` and all other steps complete ``success`` or are not executed, then the workflow status is ``temporaryFailure``. + + * If all workflow steps are executed and complete with ``success``, then the workflow status is ``success``. + + Extensions + ========== + + `ScatterFeatureRequirement <#ScatterFeatureRequirement>`__ and `SubworkflowFeatureRequirement <#SubworkflowFeatureRequirement>`__ are available as standard `extensions <#Extensions_and_Metadata>`__ to core workflow semantics. + + """ + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, ProcessGenerator): + if isinstance(other, Workflow): return bool( self.id == other.id and self.inputs == other.inputs @@ -22586,7 +18513,7 @@ def __eq__(self, other: Any) -> bool: and self.doc == other.doc and self.cwlVersion == other.cwlVersion and self.class_ == other.class_ - and self.run == other.run + and self.steps == other.steps ) return False @@ -22602,7 +18529,7 @@ def __hash__(self) -> int: self.doc, self.cwlVersion, self.class_, - self.run, + self.steps, ) ) @@ -22623,7 +18550,7 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -22679,23 +18606,24 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_Workflow_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e try: if _doc.get("inputs") is None: raise ValidationException("missing required field `inputs`", None, []) - inputs = load_field( + inputs = _load_field( _doc.get("inputs"), idmap_inputs_array_of_InputParameterLoader, baseuri, @@ -22743,9 +18671,9 @@ def fromDoc( if _doc.get("outputs") is None: raise ValidationException("missing required field `outputs`", None, []) - outputs = load_field( + outputs = _load_field( _doc.get("outputs"), - idmap_outputs_array_of_ExpressionToolOutputParameterLoader, + idmap_outputs_array_of_WorkflowOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -22790,9 +18718,9 @@ def fromDoc( requirements = None if "requirements" in _doc: try: - requirements = load_field( + requirements = _load_field( _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, baseuri, loadingOptions, lc=_doc.get("requirements") @@ -22837,9 +18765,9 @@ def fromDoc( hints = None if "hints" in _doc: try: - hints = load_field( + hints = _load_field( _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, baseuri, loadingOptions, lc=_doc.get("hints") @@ -22884,7 +18812,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -22931,7 +18859,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype, baseuri, @@ -22978,7 +18906,7 @@ def fromDoc( cwlVersion = None if "cwlVersion" in _doc: try: - cwlVersion = load_field( + cwlVersion = _load_field( _doc.get("cwlVersion"), uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, baseuri, @@ -23023,21 +18951,21 @@ def fromDoc( ) ) try: - if _doc.get("run") is None: - raise ValidationException("missing required field `run`", None, []) + if _doc.get("steps") is None: + raise ValidationException("missing required field `steps`", None, []) - run = load_field( - _doc.get("run"), - uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None, + steps = _load_field( + _doc.get("steps"), + idmap_steps_union_of_array_of_WorkflowStepLoader, baseuri, loadingOptions, - lc=_doc.get("run") + lc=_doc.get("steps") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `run`": + if str(e) == "missing required field `steps`": _errors__.append( ValidationException( str(e), @@ -23045,13 +18973,13 @@ def fromDoc( ) ) else: - val = _doc.get("run") + val = _doc.get("steps") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), + "the `steps` field is not valid because:", + SourceLine(_doc, "steps", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -23063,10 +18991,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), + "the `steps` field is not valid because:", + SourceLine(_doc, "steps", str), [e], - detailed_message=f"the `run` field with value `{val}` " + detailed_message=f"the `steps` field with value `{val}` " "is not valid because:", ) ) @@ -23078,14 +19006,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `inputs`, `outputs`, `requirements`, `hints`, `label`, `doc`, `cwlVersion`, `class`, `run`".format( + "invalid field `{}`, expected one of: `id`, `inputs`, `outputs`, `requirements`, `hints`, `label`, `doc`, `cwlVersion`, `class`, `steps`".format( k ), SourceLine(_doc, k, str), @@ -23103,7 +19031,7 @@ def fromDoc( label=label, doc=doc, cwlVersion=cwlVersion, - run=run, + steps=steps, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -23125,8 +19053,10 @@ def save( u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ @@ -23162,9 +19092,10 @@ def save( if self.cwlVersion is not None: u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) r["cwlVersion"] = u - if self.run is not None: - u = save_relative_uri(self.run, self.id, False, None, relative_uris) - r["run"] = u + if self.steps is not None: + r["steps"] = save( + self.steps, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -23177,11 +19108,11 @@ def save( def __init__( self, inputs: Sequence[InputParameter], - outputs: Sequence[ExpressionToolOutputParameter], - run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], id: None | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | TimeLimit | WorkReuse] = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | MultipleInputFeatureRequirement | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | MultipleInputFeatureRequirement | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement] = None, label: None | str = None, doc: None | str = None, cwlVersion: CWLVersion | None = None, @@ -23204,8 +19135,8 @@ def __init__( self.label = label self.doc = doc self.cwlVersion = cwlVersion - self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "Workflow" + self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -23218,27 +19149,25 @@ def __init__( "doc", "cwlVersion", "class", - "run", + "steps", ] ) @mypyc_attr(native_class=True) -class MPIRequirement(Saveable): +class SubworkflowFeatureRequirement(Saveable): """ - Indicates that a process requires an MPI runtime. + Indicates that the workflow platform must support nested workflows in the ``run`` field of `WorkflowStep <#WorkflowStep>`__. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, MPIRequirement): - return bool( - self.class_ == other.class_ and self.processes == other.processes - ) + if isinstance(other, SubworkflowFeatureRequirement): + return bool(self.class_ == other.class_) return False def __hash__(self) -> int: - return hash((self.class_, self.processes)) + return hash((self.class_)) @classmethod def fromDoc( @@ -23258,66 +19187,19 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - try: - if _doc.get("processes") is None: - raise ValidationException("missing required field `processes`", None, []) - - processes = load_field( - _doc.get("processes"), - union_of_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("processes") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `processes`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("processes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `processes` field is not valid because:", - SourceLine(_doc, "processes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `processes` field is not valid because:", - SourceLine(_doc, "processes", str), - [e], - detailed_message=f"the `processes` field with value `{val}` " - "is not valid because:", - ) - ) + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -23326,16 +19208,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `processes`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -23343,7 +19223,6 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - processes=processes, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -23361,20 +19240,15 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.processes is not None: - r["processes"] = save( - self.processes, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -23386,7 +19260,6 @@ def save( def __init__( self, - processes: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23398,40 +19271,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "MPIRequirement" - self.processes = processes + self.class_: Final[str] = "SubworkflowFeatureRequirement" - attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) @mypyc_attr(native_class=True) -class CUDARequirement(Saveable): +class ScatterFeatureRequirement(Saveable): """ - Require support for NVIDA CUDA (GPU hardware acceleration). + Indicates that the workflow platform must support the ``scatter`` and ``scatterMethod`` fields of `WorkflowStep <#WorkflowStep>`__. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CUDARequirement): - return bool( - self.class_ == other.class_ - and self.cudaComputeCapability == other.cudaComputeCapability - and self.cudaDeviceCountMax == other.cudaDeviceCountMax - and self.cudaDeviceCountMin == other.cudaDeviceCountMin - and self.cudaVersionMin == other.cudaVersionMin - ) + if isinstance(other, ScatterFeatureRequirement): + return bool(self.class_ == other.class_) return False def __hash__(self) -> int: - return hash( - ( - self.class_, - self.cudaComputeCapability, - self.cudaDeviceCountMax, - self.cudaDeviceCountMin, - self.cudaVersionMin, - ) - ) + return hash((self.class_)) @classmethod def fromDoc( @@ -23451,208 +19309,141 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_ScatterFeatureRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("cudaComputeCapability") is None: - raise ValidationException("missing required field `cudaComputeCapability`", None, []) - - cudaComputeCapability = load_field( - _doc.get("cudaComputeCapability"), - union_of_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("cudaComputeCapability") - ) - + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cudaComputeCapability`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaComputeCapability") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + raise e + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - "the `cudaComputeCapability` field is not valid because:", - SourceLine(_doc, "cudaComputeCapability", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + ValidationException("mapping with implicit null key") ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "the `cudaComputeCapability` field is not valid because:", - SourceLine(_doc, "cudaComputeCapability", str), - [e], - detailed_message=f"the `cudaComputeCapability` field with value `{val}` " - "is not valid because:", + "invalid field `{}`, expected one of: `class`".format(k), + SourceLine(_doc, k, str), ) ) - cudaDeviceCountMax = None - if "cudaDeviceCountMax" in _doc: - try: - cudaDeviceCountMax = load_field( - _doc.get("cudaDeviceCountMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("cudaDeviceCountMax") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `cudaDeviceCountMax`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaDeviceCountMax") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cudaDeviceCountMax` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMax", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cudaDeviceCountMax` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMax", str), - [e], - detailed_message=f"the `cudaDeviceCountMax` field with value `{val}` " - "is not valid because:", - ) - ) - cudaDeviceCountMin = None - if "cudaDeviceCountMin" in _doc: - try: - cudaDeviceCountMin = load_field( - _doc.get("cudaDeviceCountMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("cudaDeviceCountMin") - ) + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u - if str(e) == "missing required field `cudaDeviceCountMin`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaDeviceCountMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cudaDeviceCountMin` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cudaDeviceCountMin` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMin", str), - [e], - detailed_message=f"the `cudaDeviceCountMin` field with value `{val}` " - "is not valid because:", - ) - ) + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class MultipleInputFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support multiple inbound data links listed in the ``source`` field of `WorkflowStepInput <#WorkflowStepInput>`__. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, MultipleInputFeatureRequirement): + return bool(self.class_ == other.class_) + return False + + def __hash__(self) -> int: + return hash((self.class_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] try: - if _doc.get("cudaVersionMin") is None: - raise ValidationException("missing required field `cudaVersionMin`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - cudaVersionMin = load_field( - _doc.get("cudaVersionMin"), - strtype, + class_ = _load_field( + _doc.get("class"), + uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("cudaVersionMin") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cudaVersionMin`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaVersionMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cudaVersionMin` field is not valid because:", - SourceLine(_doc, "cudaVersionMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cudaVersionMin` field is not valid because:", - SourceLine(_doc, "cudaVersionMin", str), - [e], - detailed_message=f"the `cudaVersionMin` field with value `{val}` " - "is not valid because:", - ) - ) + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -23661,16 +19452,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `cudaComputeCapability`, `cudaDeviceCountMax`, `cudaDeviceCountMin`, `cudaVersionMin`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -23678,10 +19467,6 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - cudaComputeCapability=cudaComputeCapability, - cudaDeviceCountMax=cudaDeviceCountMax, - cudaDeviceCountMin=cudaDeviceCountMin, - cudaVersionMin=cudaVersionMin, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -23699,41 +19484,15 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.cudaComputeCapability is not None: - r["cudaComputeCapability"] = save( - self.cudaComputeCapability, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.cudaDeviceCountMax is not None: - r["cudaDeviceCountMax"] = save( - self.cudaDeviceCountMax, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.cudaDeviceCountMin is not None: - r["cudaDeviceCountMin"] = save( - self.cudaDeviceCountMin, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.cudaVersionMin is not None: - r["cudaVersionMin"] = save( - self.cudaVersionMin, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -23745,10 +19504,6 @@ def save( def __init__( self, - cudaComputeCapability: Sequence[str] | str, - cudaVersionMin: str, - cudaDeviceCountMax: None | i32 | str = None, - cudaDeviceCountMin: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23760,32 +19515,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.class_: Final[str] = "MultipleInputFeatureRequirement" - attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "cudaComputeCapability", - "cudaDeviceCountMax", - "cudaDeviceCountMin", - "cudaVersionMin", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) @mypyc_attr(native_class=True) -class ShmSize(Saveable): +class StepInputExpressionRequirement(Saveable): + """ + Indicate that the workflow platform must support the ``valueFrom`` field of `WorkflowStepInput <#WorkflowStepInput>`__. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, ShmSize): - return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) + if isinstance(other, StepInputExpressionRequirement): + return bool(self.class_ == other.class_) return False def __hash__(self) -> int: - return hash((self.class_, self.shmSize)) + return hash((self.class_)) @classmethod def fromDoc( @@ -23805,66 +19553,19 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_StepInputExpressionRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("shmSize") is None: - raise ValidationException("missing required field `shmSize`", None, []) - - shmSize = load_field( - _doc.get("shmSize"), - strtype, - baseuri, - loadingOptions, - lc=_doc.get("shmSize") - ) - + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `shmSize`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("shmSize") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `shmSize` field is not valid because:", - SourceLine(_doc, "shmSize", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `shmSize` field is not valid because:", - SourceLine(_doc, "shmSize", str), - [e], - detailed_message=f"the `shmSize` field with value `{val}` " - "is not valid because:", - ) - ) + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -23873,16 +19574,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `shmSize`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -23890,7 +19589,6 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - shmSize=shmSize, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -23908,17 +19606,15 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.shmSize is not None: - r["shmSize"] = save( - self.shmSize, top=False, base_url=base_url, relative_uris=relative_uris - ) # top refers to the directory level if top: @@ -23930,7 +19626,6 @@ def save( def __init__( self, - shmSize: str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23942,16 +19637,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "StepInputExpressionRequirement" - attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) _vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", - "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", "CWLArraySchema": "https://w3id.org/cwl/cwl#CWLArraySchema", "CWLInputFile": "https://w3id.org/cwl/cwl#CWLInputFile", "CWLObjectType": "https://w3id.org/cwl/cwl#CWLObjectType", @@ -23986,7 +19679,6 @@ def __init__( "File": "https://w3id.org/cwl/cwl#File", "InitialWorkDirRequirement": "https://w3id.org/cwl/cwl#InitialWorkDirRequirement", "InlineJavascriptRequirement": "https://w3id.org/cwl/cwl#InlineJavascriptRequirement", - "InplaceUpdateRequirement": "http://commonwl.org/cwltool#InplaceUpdateRequirement", "InputArraySchema": "https://w3id.org/cwl/cwl#InputArraySchema", "InputBinding": "https://w3id.org/cwl/cwl#InputBinding", "InputEnumSchema": "https://w3id.org/cwl/cwl#InputEnumSchema", @@ -23995,11 +19687,8 @@ def __init__( "InputRecordSchema": "https://w3id.org/cwl/cwl#InputRecordSchema", "InputSchema": "https://w3id.org/cwl/cwl#InputSchema", "LinkMergeMethod": "https://w3id.org/cwl/cwl#LinkMergeMethod", - "LoadListingRequirement": "http://commonwl.org/cwltool#LoadListingRequirement", - "MPIRequirement": "http://commonwl.org/cwltool#MPIRequirement", "MapSchema": "https://w3id.org/cwl/salad#MapSchema", "MultipleInputFeatureRequirement": "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement", - "NetworkAccess": "http://commonwl.org/cwltool#NetworkAccess", "OutputArraySchema": "https://w3id.org/cwl/cwl#OutputArraySchema", "OutputBinding": "https://w3id.org/cwl/cwl#OutputBinding", "OutputEnumSchema": "https://w3id.org/cwl/cwl#OutputEnumSchema", @@ -24010,7 +19699,6 @@ def __init__( "Parameter": "https://w3id.org/cwl/cwl#Parameter", "PrimitiveType": "https://w3id.org/cwl/salad#PrimitiveType", "Process": "https://w3id.org/cwl/cwl#Process", - "ProcessGenerator": "http://commonwl.org/cwltool#ProcessGenerator", "ProcessRequirement": "https://w3id.org/cwl/cwl#ProcessRequirement", "RecordField": "https://w3id.org/cwl/salad#RecordField", "RecordSchema": "https://w3id.org/cwl/salad#RecordSchema", @@ -24019,17 +19707,13 @@ def __init__( "ScatterMethod": "https://w3id.org/cwl/cwl#ScatterMethod", "SchemaBase": "https://w3id.org/cwl/cwl#SchemaBase", "SchemaDefRequirement": "https://w3id.org/cwl/cwl#SchemaDefRequirement", - "Secrets": "http://commonwl.org/cwltool#Secrets", "ShellCommandRequirement": "https://w3id.org/cwl/cwl#ShellCommandRequirement", - "ShmSize": "http://commonwl.org/cwltool#ShmSize", "Sink": "https://w3id.org/cwl/cwl#Sink", "SoftwarePackage": "https://w3id.org/cwl/cwl#SoftwarePackage", "SoftwareRequirement": "https://w3id.org/cwl/cwl#SoftwareRequirement", "StepInputExpressionRequirement": "https://w3id.org/cwl/cwl#StepInputExpressionRequirement", "SubworkflowFeatureRequirement": "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement", - "TimeLimit": "http://commonwl.org/cwltool#TimeLimit", "UnionSchema": "https://w3id.org/cwl/salad#UnionSchema", - "WorkReuse": "http://commonwl.org/cwltool#WorkReuse", "Workflow": "https://w3id.org/cwl/cwl#Workflow", "WorkflowOutputParameter": "https://w3id.org/cwl/cwl#WorkflowOutputParameter", "WorkflowStep": "https://w3id.org/cwl/cwl#WorkflowStep", @@ -24037,7 +19721,6 @@ def __init__( "WorkflowStepOutput": "https://w3id.org/cwl/cwl#WorkflowStepOutput", "array": "https://w3id.org/cwl/salad#array", "boolean": "http://www.w3.org/2001/XMLSchema#boolean", - "deep_listing": "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/deep_listing", "dotproduct": "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct", "double": "http://www.w3.org/2001/XMLSchema#double", "enum": "https://w3id.org/cwl/salad#enum", @@ -24049,10 +19732,8 @@ def __init__( "merge_flattened": "https://w3id.org/cwl/cwl#LinkMergeMethod/merge_flattened", "merge_nested": "https://w3id.org/cwl/cwl#LinkMergeMethod/merge_nested", "nested_crossproduct": "https://w3id.org/cwl/cwl#ScatterMethod/nested_crossproduct", - "no_listing": "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/no_listing", "null": "https://w3id.org/cwl/salad#null", "record": "https://w3id.org/cwl/salad#record", - "shallow_listing": "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/shallow_listing", "stderr": "https://w3id.org/cwl/cwl#stderr", "stdout": "https://w3id.org/cwl/cwl#stdout", "string": "http://www.w3.org/2001/XMLSchema#string", @@ -24062,7 +19743,6 @@ def __init__( _rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", - "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", "https://w3id.org/cwl/cwl#CWLArraySchema": "CWLArraySchema", "https://w3id.org/cwl/cwl#CWLInputFile": "CWLInputFile", "https://w3id.org/cwl/cwl#CWLObjectType": "CWLObjectType", @@ -24097,7 +19777,6 @@ def __init__( "https://w3id.org/cwl/cwl#File": "File", "https://w3id.org/cwl/cwl#InitialWorkDirRequirement": "InitialWorkDirRequirement", "https://w3id.org/cwl/cwl#InlineJavascriptRequirement": "InlineJavascriptRequirement", - "http://commonwl.org/cwltool#InplaceUpdateRequirement": "InplaceUpdateRequirement", "https://w3id.org/cwl/cwl#InputArraySchema": "InputArraySchema", "https://w3id.org/cwl/cwl#InputBinding": "InputBinding", "https://w3id.org/cwl/cwl#InputEnumSchema": "InputEnumSchema", @@ -24106,11 +19785,8 @@ def __init__( "https://w3id.org/cwl/cwl#InputRecordSchema": "InputRecordSchema", "https://w3id.org/cwl/cwl#InputSchema": "InputSchema", "https://w3id.org/cwl/cwl#LinkMergeMethod": "LinkMergeMethod", - "http://commonwl.org/cwltool#LoadListingRequirement": "LoadListingRequirement", - "http://commonwl.org/cwltool#MPIRequirement": "MPIRequirement", "https://w3id.org/cwl/salad#MapSchema": "MapSchema", "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement": "MultipleInputFeatureRequirement", - "http://commonwl.org/cwltool#NetworkAccess": "NetworkAccess", "https://w3id.org/cwl/cwl#OutputArraySchema": "OutputArraySchema", "https://w3id.org/cwl/cwl#OutputBinding": "OutputBinding", "https://w3id.org/cwl/cwl#OutputEnumSchema": "OutputEnumSchema", @@ -24121,7 +19797,6 @@ def __init__( "https://w3id.org/cwl/cwl#Parameter": "Parameter", "https://w3id.org/cwl/salad#PrimitiveType": "PrimitiveType", "https://w3id.org/cwl/cwl#Process": "Process", - "http://commonwl.org/cwltool#ProcessGenerator": "ProcessGenerator", "https://w3id.org/cwl/cwl#ProcessRequirement": "ProcessRequirement", "https://w3id.org/cwl/salad#RecordField": "RecordField", "https://w3id.org/cwl/salad#RecordSchema": "RecordSchema", @@ -24130,17 +19805,13 @@ def __init__( "https://w3id.org/cwl/cwl#ScatterMethod": "ScatterMethod", "https://w3id.org/cwl/cwl#SchemaBase": "SchemaBase", "https://w3id.org/cwl/cwl#SchemaDefRequirement": "SchemaDefRequirement", - "http://commonwl.org/cwltool#Secrets": "Secrets", "https://w3id.org/cwl/cwl#ShellCommandRequirement": "ShellCommandRequirement", - "http://commonwl.org/cwltool#ShmSize": "ShmSize", "https://w3id.org/cwl/cwl#Sink": "Sink", "https://w3id.org/cwl/cwl#SoftwarePackage": "SoftwarePackage", "https://w3id.org/cwl/cwl#SoftwareRequirement": "SoftwareRequirement", "https://w3id.org/cwl/cwl#StepInputExpressionRequirement": "StepInputExpressionRequirement", "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement": "SubworkflowFeatureRequirement", - "http://commonwl.org/cwltool#TimeLimit": "TimeLimit", "https://w3id.org/cwl/salad#UnionSchema": "UnionSchema", - "http://commonwl.org/cwltool#WorkReuse": "WorkReuse", "https://w3id.org/cwl/cwl#Workflow": "Workflow", "https://w3id.org/cwl/cwl#WorkflowOutputParameter": "WorkflowOutputParameter", "https://w3id.org/cwl/cwl#WorkflowStep": "WorkflowStep", @@ -24148,7 +19819,6 @@ def __init__( "https://w3id.org/cwl/cwl#WorkflowStepOutput": "WorkflowStepOutput", "https://w3id.org/cwl/salad#array": "array", "http://www.w3.org/2001/XMLSchema#boolean": "boolean", - "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/deep_listing": "deep_listing", "https://w3id.org/cwl/cwl#ScatterMethod/dotproduct": "dotproduct", "http://www.w3.org/2001/XMLSchema#double": "double", "https://w3id.org/cwl/salad#enum": "enum", @@ -24160,10 +19830,8 @@ def __init__( "https://w3id.org/cwl/cwl#LinkMergeMethod/merge_flattened": "merge_flattened", "https://w3id.org/cwl/cwl#LinkMergeMethod/merge_nested": "merge_nested", "https://w3id.org/cwl/cwl#ScatterMethod/nested_crossproduct": "nested_crossproduct", - "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/no_listing": "no_listing", "https://w3id.org/cwl/salad#null": "null", "https://w3id.org/cwl/salad#record": "record", - "http://commonwl.org/cwltool#LoadListingRequirement/loadListing/LoadListingEnum/shallow_listing": "shallow_listing", "https://w3id.org/cwl/cwl#stderr": "stderr", "https://w3id.org/cwl/cwl#stdout": "stdout", "http://www.w3.org/2001/XMLSchema#string": "string", @@ -24173,11 +19841,11 @@ def __init__( strtype: Final[_Loader[str]] = _PrimitiveLoader(str) inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) floattype: Final[_Loader[float]] = _PrimitiveLoader(float) booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) Any_type: Final[_Loader[Any]] = _AnyLoader() -longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) PrimitiveType: TypeAlias = Literal[ "null", "boolean", "int", "long", "float", "double", "string" ] @@ -24196,15 +19864,20 @@ def __init__( """ Names of salad data types (based on Avro schema declarations). -Refer to the [Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for -detailed information. +Refer to the `Avro schema declaration documentation `__ for detailed information. null: no value + boolean: a binary value + int: 32-bit signed integer + long: 64-bit signed integer + float: single precision (32-bit) IEEE 754 floating-point number + double: double precision (64-bit) IEEE 754 floating-point number + string: Unicode character sequence """ Any_: TypeAlias = Literal["Any"] @@ -24212,14 +19885,24 @@ def __init__( """ The **Any** type validates for any non-null value. """ -RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) -RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( - RecordSchema, None, None +RecordFieldLoader: Final[_Loader[schema_salad.metaschema.RecordField]] = _RecordLoader( + schema_salad.metaschema.RecordField, None, None +) +RecordSchemaLoader: Final[_Loader[schema_salad.metaschema.RecordSchema]] = ( + _RecordLoader(schema_salad.metaschema.RecordSchema, None, None) +) +EnumSchemaLoader: Final[_Loader[schema_salad.metaschema.EnumSchema]] = _RecordLoader( + schema_salad.metaschema.EnumSchema, None, None +) +ArraySchemaLoader: Final[_Loader[schema_salad.metaschema.ArraySchema]] = _RecordLoader( + schema_salad.metaschema.ArraySchema, None, None +) +MapSchemaLoader: Final[_Loader[schema_salad.metaschema.MapSchema]] = _RecordLoader( + schema_salad.metaschema.MapSchema, None, None +) +UnionSchemaLoader: Final[_Loader[schema_salad.metaschema.UnionSchema]] = _RecordLoader( + schema_salad.metaschema.UnionSchema, None, None ) -EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) CWLType: TypeAlias = Literal[ "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" ] @@ -24239,7 +19922,9 @@ def __init__( ) """ Extends primitive types with the concept of a file and directory as a builtin type. + File: A File object + Directory: A Directory object """ CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( @@ -24356,92 +20041,106 @@ def __init__( stdout: TypeAlias = Literal["stdout"] stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ -Only valid as a `type` for a `CommandLineTool` output with no -`outputBinding` set. +Only valid as a ``type`` for a ``CommandLineTool`` output with no ``outputBinding`` set. The following -``` -outputs: - an_output_name: - type: stdout -stdout: a_stdout_file -``` +:: + + outputs: + an_output_name: + type: stdout + + stdout: a_stdout_file + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: a_stdout_file - -stdout: a_stdout_file -``` - -If there is no `stdout` name provided, a random filename will be created. -For example, the following -``` -outputs: - an_output_name: - type: stdout -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: a_stdout_file + + stdout: a_stdout_file + + +If there is no ``stdout`` name provided, a random filename will be created. For example, the following + +:: + + outputs: + an_output_name: + type: stdout + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: random_stdout_filenameABCDEFG - -stdout: random_stdout_filenameABCDEFG -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: random_stdout_filenameABCDEFG + + stdout: random_stdout_filenameABCDEFG """ stderr: TypeAlias = Literal["stderr"] stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ -Only valid as a `type` for a `CommandLineTool` output with no -`outputBinding` set. +Only valid as a ``type`` for a ``CommandLineTool`` output with no ``outputBinding`` set. The following -``` -outputs: - an_output_name: - type: stderr -stderr: a_stderr_file -``` +:: + + outputs: + an_output_name: + type: stderr + + stderr: a_stderr_file + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: a_stderr_file - -stderr: a_stderr_file -``` - -If there is no `stderr` name provided, a random filename will be created. -For example, the following -``` -outputs: - an_output_name: - type: stderr -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: a_stderr_file + + stderr: a_stderr_file + + +If there is no ``stderr`` name provided, a random filename will be created. For example, the following + +:: + + outputs: + an_output_name: + type: stderr + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: random_stderr_filenameABCDEFG - -stderr: random_stderr_filenameABCDEFG -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: random_stderr_filenameABCDEFG + + stderr: random_stderr_filenameABCDEFG """ CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( CommandLineTool, None, None @@ -24483,7 +20182,7 @@ def __init__( "LinkMergeMethod", ) """ -The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). +The input link merge method, described in `WorkflowStepInput <#WorkflowStepInput>`__. """ WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( WorkflowOutputParameter, None, None @@ -24506,7 +20205,7 @@ def __init__( "ScatterMethod", ) """ -The scatter method, as described in [workflow step scatter](#WorkflowStep). +The scatter method, as described in `workflow step scatter <#WorkflowStep>`__. """ WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( WorkflowStep, None, None @@ -24524,28 +20223,6 @@ def __init__( StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( _RecordLoader(StepInputExpressionRequirement, None, None) ) -LoadListingRequirementLoader: Final[_Loader[LoadListingRequirement]] = _RecordLoader( - LoadListingRequirement, None, None -) -InplaceUpdateRequirementLoader: Final[_Loader[InplaceUpdateRequirement]] = ( - _RecordLoader(InplaceUpdateRequirement, None, None) -) -SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) -TimeLimitLoader: Final[_Loader[TimeLimit]] = _RecordLoader(TimeLimit, None, None) -WorkReuseLoader: Final[_Loader[WorkReuse]] = _RecordLoader(WorkReuse, None, None) -NetworkAccessLoader: Final[_Loader[NetworkAccess]] = _RecordLoader( - NetworkAccess, None, None -) -ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( - ProcessGenerator, None, None -) -MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( - MPIRequirement, None, None -) -CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( - CUDARequirement, None, None -) -ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) union_of_None_type_or_strtype_or_array_of_strtype: Final[ _Loader[None | Sequence[str] | str] @@ -24561,12 +20238,12 @@ def __init__( ) union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _UnionLoader( @@ -24583,12 +20260,12 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] @@ -24597,21 +20274,21 @@ def __init__( ) union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _UnionLoader( @@ -24628,21 +20305,21 @@ def __init__( ) typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _TypeDSLLoader( @@ -24650,11 +20327,11 @@ def __init__( 2, "v1.1", ) -array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( - RecordFieldLoader -) +array_of_RecordFieldLoader: Final[ + _Loader[Sequence[schema_salad.metaschema.RecordField]] +] = _ArrayLoader(RecordFieldLoader) union_of_None_type_or_array_of_RecordFieldLoader: Final[ - _Loader[None | Sequence[RecordField]] + _Loader[None | Sequence[schema_salad.metaschema.RecordField]] ] = _UnionLoader( ( None_type, @@ -24662,7 +20339,7 @@ def __init__( ) ) idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ - _Loader[None | Sequence[RecordField]] + _Loader[None | Sequence[schema_salad.metaschema.RecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") Record_name: TypeAlias = Literal["record"] Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") @@ -24688,21 +20365,21 @@ def __init__( ) uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _URILoader( @@ -24728,7 +20405,13 @@ def __init__( Union_nameLoader, 2, "v1.1" ) union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ - _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + _Loader[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] ] = _UnionLoader( ( PrimitiveTypeLoader, @@ -24740,7 +20423,13 @@ def __init__( ) array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] ] ] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype @@ -24749,9 +20438,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _UnionLoader( @@ -24768,9 +20463,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _URILoader( @@ -24784,9 +20485,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _TypeDSLLoader( @@ -24816,11 +20523,13 @@ def __init__( uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( - ( - None_type, - inttype, - inttype, +union_of_None_type_or_inttype_or_longtype: Final[_Loader[None | i32 | i64]] = ( + _UnionLoader( + ( + None_type, + inttype, + longtype, + ) ) ) union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( @@ -25152,29 +20861,20 @@ def __init__( idmap_outputs_array_of_OutputParameterLoader: Final[ _Loader[Sequence[OutputParameter]] ] = _IdMapLoader(array_of_OutputParameterLoader, "id", "type") -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ] ] = _UnionLoader( ( @@ -25190,135 +20890,90 @@ def __init__( ScatterFeatureRequirementLoader, MultipleInputFeatureRequirementLoader, StepInputExpressionRequirementLoader, - LoadListingRequirementLoader, - InplaceUpdateRequirementLoader, - SecretsLoader, - TimeLimitLoader, - WorkReuseLoader, - NetworkAccessLoader, - MPIRequirementLoader, - CUDARequirementLoader, - ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ] ] ] = _ArrayLoader( - union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader + union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ] ] ] = _UnionLoader( ( None_type, - array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ] ] ] = _IdMapLoader( - union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ] ] = _UnionLoader( ( @@ -25334,112 +20989,76 @@ def __init__( ScatterFeatureRequirementLoader, MultipleInputFeatureRequirementLoader, StepInputExpressionRequirementLoader, - LoadListingRequirementLoader, - InplaceUpdateRequirementLoader, - SecretsLoader, - TimeLimitLoader, - WorkReuseLoader, - NetworkAccessLoader, - MPIRequirementLoader, - CUDARequirementLoader, - ShmSizeLoader, Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ] ] ] = _ArrayLoader( - union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type + union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ None | Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ] ] ] = _UnionLoader( ( None_type, - array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ None | Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ] ] ] = _IdMapLoader( - union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_LoadListingRequirementLoader_or_InplaceUpdateRequirementLoader_or_SecretsLoader_or_TimeLimitLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, "class", "None", ) @@ -25964,13 +21583,13 @@ def __init__( uri_ResourceRequirement_classLoader_False_True_None_None: Final[ _Loader[ResourceRequirement_class] ] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) -union_of_None_type_or_inttype_or_inttype_or_strtype_or_ExpressionLoader: Final[ - _Loader[None | i32 | str] +union_of_None_type_or_inttype_or_longtype_or_strtype_or_ExpressionLoader: Final[ + _Loader[None | i32 | i64 | str] ] = _UnionLoader( ( None_type, inttype, - inttype, + longtype, strtype, ExpressionLoader, ) @@ -25985,6 +21604,16 @@ def __init__( ExpressionLoader, ) ) +union_of_None_type_or_longtype_or_strtype_or_ExpressionLoader: Final[ + _Loader[None | i64 | str] +] = _UnionLoader( + ( + None_type, + longtype, + strtype, + ExpressionLoader, + ) +) union_of_None_type_or_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype: Final[ _Loader[ CWLType @@ -26093,21 +21722,20 @@ def __init__( idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ _Loader[None | Sequence[Any]] ] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ - _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] -] = _UnionLoader( +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader: ( + Final[_Loader[CommandLineTool | ExpressionTool | Workflow | str]] +) = _UnionLoader( ( strtype, CommandLineToolLoader, ExpressionToolLoader, WorkflowLoader, - ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ - _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_False_False_None_None: Final[ + _Loader[CommandLineTool | ExpressionTool | Workflow | str] ] = _URILoader( - union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, False, False, None, @@ -26189,80 +21817,25 @@ def __init__( uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ _Loader[StepInputExpressionRequirement_class] ] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) -uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( - strtype, False, True, None, None -) -LoadListingEnum: TypeAlias = Literal["no_listing", "shallow_listing", "deep_listing"] -LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _EnumLoader( - ( - "no_listing", - "shallow_listing", - "deep_listing", - ), - "LoadListingEnum", -) -union_of_LoadListingEnumLoader: Final[_Loader[LoadListingEnum]] = _UnionLoader( - (LoadListingEnumLoader,) -) -uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( - array_of_strtype, False, False, 0, None -) -union_of_inttype_or_strtype: Final[_Loader[i32 | str]] = _UnionLoader( - ( - inttype, - strtype, - ) -) -union_of_booltype_or_strtype: Final[_Loader[bool | str]] = _UnionLoader( - ( - booltype, - strtype, - ) -) -union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( - ( - inttype, - ExpressionLoader, - ) -) -union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( - _UnionLoader( - ( - strtype, - array_of_strtype, - ) - ) -) -union_of_None_type_or_inttype_or_ExpressionLoader: Final[_Loader[None | i32 | str]] = ( - _UnionLoader( - ( - None_type, - inttype, - ExpressionLoader, - ) - ) -) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ - _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | Workflow] ] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, WorkflowLoader, - ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ - _Loader[Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow]] -] = _ArrayLoader( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader: ( + Final[_Loader[Sequence[CommandLineTool | ExpressionTool | Workflow]]] +) = _ArrayLoader( + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader: Final[ _Loader[ CommandLineTool | ExpressionTool - | ProcessGenerator - | Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] + | Sequence[CommandLineTool | ExpressionTool | Workflow] | Workflow ] ] = _UnionLoader( @@ -26270,8 +21843,7 @@ def __init__( CommandLineToolLoader, ExpressionToolLoader, WorkflowLoader, - ProcessGeneratorLoader, - array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, ) ) @@ -26279,7 +21851,6 @@ def __init__( ( booltype, inttype, - longtype, floattype, strtype, FileLoader, @@ -26289,39 +21860,29 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | str" ) -Documented: TypeAlias = RecordField Parameter: TypeAlias = InputParameter | OutputParameter InputBinding: TypeAlias = CommandLineBinding OutputBinding: TypeAlias = CommandOutputBinding InputSchema: TypeAlias = InputArraySchema | InputEnumSchema | InputRecordSchema OutputSchema: TypeAlias = OutputArraySchema | OutputEnumSchema | OutputRecordSchema ProcessRequirement: TypeAlias = ( - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement - | InplaceUpdateRequirement - | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement - | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement - | TimeLimit - | WorkReuse ) -Process: TypeAlias = CommandLineTool | ExpressionTool | ProcessGenerator | Workflow +Process: TypeAlias = CommandLineTool | ExpressionTool | Workflow Sink: TypeAlias = WorkflowStepInput SchemaBase: TypeAlias = InputSchema | OutputSchema | Parameter @@ -26336,7 +21897,7 @@ def load_document( if loadingOptions is None: loadingOptions = LoadingOptions() result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, doc, baseuri, loadingOptions, @@ -26355,7 +21916,7 @@ def load_document_with_metadata( if loadingOptions is None: loadingOptions = LoadingOptions(fileuri=baseuri) return _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, doc, baseuri, loadingOptions, @@ -26376,7 +21937,7 @@ def load_document_by_string( loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, result, uri, loadingOptions, @@ -26399,7 +21960,7 @@ def load_document_by_yaml( loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, yaml, uri, loadingOptions, diff --git a/src/cwl_utils/parser/cwl_v1_0_utils.py b/src/cwl_utils/parser/cwl_v1_0_utils.py index ec33287e..74e00c91 100644 --- a/src/cwl_utils/parser/cwl_v1_0_utils.py +++ b/src/cwl_utils/parser/cwl_v1_0_utils.py @@ -9,6 +9,8 @@ from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException +from schema_salad.metaschema import ArraySchema, RecordSchema, EnumSchema +from schema_salad.runtime import save, LoadingOptions, shortname, file_uri from schema_salad.sourceline import SourceLine, add_lc_filename from schema_salad.utils import aslist, json_dumps, yaml_no_ts @@ -56,22 +58,22 @@ def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, + loading_options: LoadingOptions, ) -> BasicOutputTypeSchemas: match schema_type: - case cwl.ArraySchema(): + case ArraySchema(): return cwl.OutputArraySchema.fromDoc( schema_type.save(), loading_options.baseuri, loading_options, ) - case cwl.EnumSchema(): + case EnumSchema(): return cwl.OutputEnumSchema.fromDoc( schema_type.save(), loading_options.baseuri, loading_options, ) - case cwl.RecordSchema(): + case RecordSchema(): return cwl.OutputRecordSchema.fromDoc( schema_type.save(), loading_options.baseuri, @@ -88,7 +90,7 @@ def in_output_type_schema_to_output_type_schema( | BasicOutputTypeSchemas | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] ), - loading_options: cwl.LoadingOptions, + loading_options: LoadingOptions, ) -> OutputTypeSchemas: if is_sequence(schema_type): return [ @@ -102,14 +104,14 @@ def in_output_type_schema_to_output_type_schema( def _compare_type(type1: Any, type2: Any) -> bool: match (type1, type1): - case cwl.ArraySchema() as t1, cwl.ArraySchema() as t2: + case ArraySchema() as t1, ArraySchema() as t2: return _compare_type(t1.items, t2.items) - case cwl.RecordSchema(), cwl.RecordSchema(): + case RecordSchema(), RecordSchema(): fields1 = { - cwl.shortname(field.name): field.type_ for field in (type1.fields or {}) + shortname(field.name): field.type_ for field in (type1.fields or {}) } fields2 = { - cwl.shortname(field.name): field.type_ for field in (type2.fields or {}) + shortname(field.name): field.type_ for field in (type2.fields or {}) } if fields1.keys() != fields2.keys(): return False @@ -127,9 +129,9 @@ def _compare_type(type1: Any, type2: Any) -> bool: def _inputfile_load( doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, - loadingOptions: cwl.LoadingOptions, + loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, cwl.LoadingOptions]: +) -> tuple[Any, LoadingOptions]: loader = cwl.CWLInputFileLoader match doc: case str(): @@ -143,9 +145,7 @@ def _inputfile_load( yaml = yaml_no_ts() result = yaml.load(textIO) add_lc_filename(result, doc_url) - loadingOptions = cwl.LoadingOptions( - copyfrom=loadingOptions, fileuri=doc_url - ) + loadingOptions = LoadingOptions(copyfrom=loadingOptions, fileuri=doc_url) _inputfile_load( result, doc_url, @@ -159,7 +159,7 @@ def _inputfile_load( if mf in doc: addl_metadata[mf] = doc[mf] - loadingOptions = cwl.LoadingOptions( + loadingOptions = LoadingOptions( copyfrom=loadingOptions, baseuri=baseuri, addl_metadata=addl_metadata, @@ -284,13 +284,13 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None: def load_inputfile( doc: Any, baseuri: str | None = None, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.0 input file from a serialized YAML string or a YAML object.""" if baseuri is None: - baseuri = cwl.file_uri(str(Path.cwd())) + "/" + baseuri = file_uri(str(Path.cwd())) + "/" if loadingOptions is None: - loadingOptions = cwl.LoadingOptions() + loadingOptions = LoadingOptions() result, metadata = _inputfile_load( doc, @@ -303,14 +303,14 @@ def load_inputfile( def load_inputfile_by_string( string: Any, uri: str, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.0 input file from a serialized YAML string.""" result = yaml_no_ts().load(string) add_lc_filename(result, uri) if loadingOptions is None: - loadingOptions = cwl.LoadingOptions(fileuri=uri) + loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _inputfile_load( result, @@ -323,13 +323,13 @@ def load_inputfile_by_string( def load_inputfile_by_yaml( yaml: Any, uri: str, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.0 input file from a YAML object.""" add_lc_filename(yaml, uri) if loadingOptions is None: - loadingOptions = cwl.LoadingOptions(fileuri=uri) + loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _inputfile_load( yaml, @@ -398,7 +398,7 @@ def type_for_step_output( raise ValidationException( "param {} not found in {}.".format( sourcename, - yaml_dumps(cwl.save(step)), + yaml_dumps(save(step)), ) ) @@ -415,7 +415,9 @@ def type_for_source( ): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] - params = param_for_source_id(process, sourcenames, parent, scatter_context) + params = cwl_utils.parser.utils.param_for_source_id( + process, sourcenames, parent, scatter_context + ) if not isinstance(params, MutableSequence): new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: @@ -493,92 +495,3 @@ def type_for_source( type_="array", ) return final_type - - -def param_for_source_id( - process: cwl.Process, - sourcenames: str | Sequence[str], - parent: cwl.Workflow | None = None, - scatter_context: list[tuple[int, str] | None] | None = None, -) -> ( - cwl_utils.parser.InputParameter - | cwl_utils.parser.OutputParameter - | MutableSequence[ - cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter - ] -): - """Find the process input parameter that matches one of the given sourcenames.""" - if isinstance(sourcenames, str): - sourcenames = [sourcenames] - params: MutableSequence[ - cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter - ] = [] - for sourcename in sourcenames: - if not isinstance(process, cwl.Workflow): - for param in process.inputs: - if param.id.split("#")[-1] == sourcename.split("#")[-1]: - params.append(param) - if scatter_context is not None: - scatter_context.append(None) - targets = [process] - if parent: - targets.append(parent) - for target in targets: - if isinstance(target, cwl.Workflow): - for inp in target.inputs: - if inp.id.split("#")[-1] == sourcename.split("#")[-1]: - params.append(inp) - if scatter_context is not None: - scatter_context.append(None) - for step in target.steps: - if ( - "/".join(sourcename.split("#")[-1].split("/")[:-1]) - == step.id.split("#")[-1] - and step.out - ): - step_run = cwl_utils.parser.utils.load_step(step) - cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - for outp in step.out: - outp_id = outp if isinstance(outp, str) else outp.id - if ( - outp_id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - if step_run and step_run.outputs: - for output in step_run.outputs: - if ( - output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - params.append(output) - if scatter_context is not None: - match step.scatter: - case str(): - scatter_context.append( - ( - 1, - step.scatterMethod - or "dotproduct", - ) - ) - case Sequence(): - scatter_context.append( - ( - len(step.scatter), - step.scatterMethod - or "dotproduct", - ) - ) - case _: - scatter_context.append(None) - if len(params) == 1: - return params[0] - elif len(params) > 1: - return params - raise WorkflowException( - "param {} not found in {}\n{}.".format( - sourcename, - yaml_dumps(cwl.save(process)), - (f" or\n {yaml_dumps(cwl.save(parent))}" if parent is not None else ""), - ) - ) diff --git a/src/cwl_utils/parser/cwl_v1_1.py b/src/cwl_utils/parser/cwl_v1_1.py index 91bd39bc..3828fe70 100644 --- a/src/cwl_utils/parser/cwl_v1_1.py +++ b/src/cwl_utils/parser/cwl_v1_1.py @@ -2,452 +2,63 @@ # This file was autogenerated using schema-salad-tool --codegen=python # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. - from __future__ import annotations -import copy -import logging import os -import pathlib import sys -import tempfile -import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 -import xml.sax # nosec -from abc import ABCMeta, abstractmethod -from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 -from collections.abc import MutableMapping, MutableSequence, Sequence -from io import StringIO -from itertools import chain -from mypy_extensions import i32, i64, mypyc_attr -from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 -from typing import Any, Final, Generic, TypeAlias, TypeVar, cast -from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit -from urllib.request import pathname2url - -from rdflib import Graph -from rdflib.plugins.parsers.notation3 import BadSyntax -from ruamel.yaml.comments import CommentedMap - -from schema_salad.exceptions import SchemaSaladException, ValidationException -from schema_salad.fetcher import DefaultFetcher, Fetcher, MemoryCachingFetcher -from schema_salad.sourceline import SourceLine, add_lc_filename -from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ +import uuid as _uuid__ +from collections.abc import Collection +from typing import ClassVar + +from schema_salad.runtime import ( + Saveable, + file_uri, + parse_errors, + prefix_url, + save, + save_relative_uri, +) if sys.version_info >= (3, 11): from typing import Self else: from typing_extensions import Self -_vocab: Final[dict[str, str]] = {} -_rvocab: Final[dict[str, str]] = {} - -_logger: Final = logging.getLogger("salad") - - -IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] -E = TypeVar("E", bound=str) -S = TypeVar("S", bound="Saveable") -T = TypeVar("T", covariant=True) - - -@mypyc_attr(native_class=True) -class LoadingOptions: - idx: Final[IdxType] - fileuri: Final[str | None] - baseuri: Final[str] - namespaces: Final[MutableMapping[str, str]] - schemas: Final[MutableSequence[str]] - original_doc: Final[Any | None] - addl_metadata: Final[MutableMapping[str, Any]] - fetcher: Final[Fetcher] - vocab: Final[dict[str, str]] - rvocab: Final[dict[str, str]] - cache: Final[CacheType] - imports: Final[list[str]] - includes: Final[list[str]] - no_link_check: Final[bool | None] - container: Final[str | None] - - def __init__( - self, - fetcher: Fetcher | None = None, - namespaces: dict[str, str] | None = None, - schemas: list[str] | None = None, - fileuri: str | None = None, - copyfrom: LoadingOptions | None = None, - original_doc: Any | None = None, - addl_metadata: dict[str, str] | None = None, - baseuri: str | None = None, - idx: IdxType | None = None, - imports: list[str] | None = None, - includes: list[str] | None = None, - no_link_check: bool | None = None, - container: str | None = None, - ) -> None: - """Create a LoadingOptions object.""" - self.original_doc = original_doc - - if idx is not None: - temp_idx = idx - else: - temp_idx = copyfrom.idx if copyfrom is not None else {} - self.idx = temp_idx - - if fileuri is not None: - temp_fileuri: str | None = fileuri - else: - temp_fileuri = copyfrom.fileuri if copyfrom is not None else None - self.fileuri = temp_fileuri - - if baseuri is not None: - temp_baseuri = baseuri - else: - temp_baseuri = copyfrom.baseuri if copyfrom is not None else "" - self.baseuri = temp_baseuri - - if namespaces is not None: - temp_namespaces: MutableMapping[str, str] = namespaces - else: - temp_namespaces = copyfrom.namespaces if copyfrom is not None else {} - self.namespaces = temp_namespaces - - if schemas is not None: - temp_schemas: MutableSequence[str] = schemas - else: - temp_schemas = copyfrom.schemas if copyfrom is not None else [] - self.schemas = temp_schemas - - if addl_metadata is not None: - temp_addl_metadata: MutableMapping[str, Any] = addl_metadata - else: - temp_addl_metadata = copyfrom.addl_metadata if copyfrom is not None else {} - self.addl_metadata = temp_addl_metadata - - if imports is not None: - temp_imports = imports - else: - temp_imports = copyfrom.imports if copyfrom is not None else [] - self.imports = temp_imports - - if includes is not None: - temp_includes = includes - else: - temp_includes = copyfrom.includes if copyfrom is not None else [] - self.includes = temp_includes - - if no_link_check is not None: - temp_no_link_check: bool | None = no_link_check - else: - temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False - self.no_link_check = temp_no_link_check - - if container is not None: - temp_container: str | None = container - else: - temp_container = copyfrom.container if copyfrom is not None else None - self.container = temp_container - - if fetcher is not None: - temp_fetcher = fetcher - elif copyfrom is not None: - temp_fetcher = copyfrom.fetcher - else: - import requests - from cachecontrol.caches import SeparateBodyFileCache - from cachecontrol.wrapper import CacheControl - - root = pathlib.Path(os.environ.get("HOME", tempfile.gettempdir())) - session = CacheControl( - requests.Session(), - cache=SeparateBodyFileCache(root / ".cache" / "salad"), - ) - temp_fetcher = DefaultFetcher({}, session) - self.fetcher = temp_fetcher - - self.cache = self.fetcher.cache if isinstance(self.fetcher, MemoryCachingFetcher) else {} - - if self.namespaces != {}: - temp_vocab = _vocab.copy() - temp_rvocab = _rvocab.copy() - for k, v in self.namespaces.items(): - temp_vocab[k] = v - temp_rvocab[v] = k - else: - temp_vocab = _vocab - temp_rvocab = _rvocab - self.vocab = temp_vocab - self.rvocab = temp_rvocab - - @property - def graph(self) -> Graph: - """Generate a merged rdflib.Graph from all entries in self.schemas.""" - graph = Graph() - if not self.schemas: - return graph - key: Final = str(hash(tuple(self.schemas))) - if key in self.cache: - return cast(Graph, self.cache[key]) - for schema in self.schemas: - fetchurl = ( - self.fetcher.urljoin(self.fileuri, schema) - if self.fileuri is not None - else pathlib.Path(schema).resolve().as_uri() - ) - if fetchurl not in self.cache or self.cache[fetchurl] is True: - _logger.debug("Getting external schema %s", fetchurl) - try: - content = self.fetcher.fetch_text(fetchurl) - except Exception as e: - _logger.warning("Could not load extension schema %s: %s", fetchurl, str(e)) - continue - newGraph = Graph() - err_msg = "unknown error" - for fmt in ["xml", "turtle"]: - try: - newGraph.parse(data=content, format=fmt, publicID=str(fetchurl)) - self.cache[fetchurl] = newGraph - graph += newGraph - break - except (xml.sax.SAXParseException, TypeError, BadSyntax) as e: - err_msg = str(e) - else: - _logger.warning("Could not load extension schema %s: %s", fetchurl, err_msg) - self.cache[key] = graph - return graph - - -@mypyc_attr(native_class=True) -class Saveable(metaclass=ABCMeta): - """Mark classes than have a save() and fromDoc() function.""" - - @classmethod - @abstractmethod - def fromDoc( - cls, - _doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None, - ) -> Self: - """Construct this object from the result of yaml.load().""" - - @abstractmethod - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - """Convert this object to a JSON/YAML friendly dictionary.""" - - -def load_field( - val: Any | None, - fieldtype: _Loader[T], - baseuri: str, - loadingOptions: LoadingOptions, - lc: Any | None = None, -) -> T: - """Load field.""" - if isinstance(val, MutableMapping): - if "$import" in val: - if loadingOptions.fileuri is None: - raise SchemaSaladException("Cannot load $import without fileuri") - url1: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$import"]) - result, metadata = _document_load_by_url( - fieldtype, - url1, - loadingOptions, - ) - loadingOptions.imports.append(url1) - return result - if "$include" in val: - if loadingOptions.fileuri is None: - raise SchemaSaladException("Cannot load $import without fileuri") - url2: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$include"]) - val = loadingOptions.fetcher.fetch_text(url2) - loadingOptions.includes.append(url2) - return fieldtype.load(val, baseuri, loadingOptions, lc=lc) +import schema_salad.metaschema +import copy +from abc import ABCMeta, abstractmethod +from collections.abc import MutableSequence, Sequence, MutableMapping +from io import StringIO +from itertools import chain +from typing import Literal, TypeVar # pylint: disable=unused-import # noqa: F401 +from collections.abc import Mapping +from typing import TypeAlias # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, cast, Generic +from urllib.parse import urldefrag, urlsplit, urlunsplit + +from mypy_extensions import i32, i64 # pylint: disable=unused-import # noqa: F401 +from mypy_extensions import mypyc_attr +from ruamel.yaml.comments import CommentedMap -save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str +from schema_salad.exceptions import ValidationException, SchemaSaladException +from schema_salad.runtime import ( + LoadingOptions, + convert_typing, + extract_type, + SaveableType, + FieldType, + EnumFieldType, ) +from schema_salad.sourceline import SourceLine, add_lc_filename +from schema_salad.utils import yaml_no_ts # requires schema-salad v8.2+ - -def extract_type(val_type: type[Any]) -> str: - """Take a type of value, and extracts the value as a string.""" - val_str: Final = str(val_type) - return val_str.split("'")[1] - - -def convert_typing(val_type: str) -> str: - """Normalize type names to schema-salad types.""" - if "None" in val_type: - return "null" - if "CommentedSeq" in val_type or "list" in val_type: - return "array" - if "CommentedMap" in val_type or "dict" in val_type: - return "object" - if "False" in val_type or "True" in val_type: - return "boolean" - return val_type - - -def parse_errors(error_message: str) -> tuple[str, str, str]: - """Parse error messages from several loaders into one error message.""" - if not error_message.startswith("Expected"): - return error_message, "", "" - vals: Final = error_message.split("\n") - if len(vals) == 1: - return error_message, "", "" - types1: Final = set() - for val in vals: - individual_vals = val.split(" ") - if val == "": - continue - if individual_vals[1] == "one": - individual_vals = val.split("(")[1].split(",") - for t in individual_vals: - types1.add(t.strip(" ").strip(")\n")) - elif individual_vals[2] == "").replace("'", "")) - elif individual_vals[0] == "Value": - types1.add(individual_vals[-1].strip(".")) - else: - types1.add(individual_vals[1].replace(",", "")) - types2: Final = {val for val in types1 if val != "NoneType"} - if "str" in types2: - types3 = {convert_typing(val) for val in types2 if "'" not in val} - else: - types3 = types2 - to_print = "" - for val in types3: - if "'" in val: - to_print = "value" if len(types3) == 1 else "values" - - if to_print == "": - to_print = "type" if len(types3) == 1 else "types" - - verb_tensage: Final = "is" if len(types3) == 1 else "are" - - return str(types3).replace("{", "(").replace("}", ")").replace("'", ""), to_print, verb_tensage - - -def save( - val: Any, - top: bool = True, - base_url: str = "", - relative_uris: bool = True, -) -> save_type: - if isinstance(val, Saveable): - return val.save(top=top, base_url=base_url, relative_uris=relative_uris) - if isinstance(val, MutableSequence): - return [save(v, top=False, base_url=base_url, relative_uris=relative_uris) for v in val] - if isinstance(val, MutableMapping): - newdict: Final = {} - for key in val: - newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) - return newdict - if val is None or isinstance(val, (i32, i64, float, bool, str)): - return val - raise Exception("Not Saveable: %s" % type(val)) - - -def save_with_metadata( - val: Any, - valLoadingOpts: LoadingOptions, - top: bool = True, - base_url: str = "", - relative_uris: bool = True, -) -> save_type: - """Save and set $namespaces, $schemas, $base and any other metadata fields at the top level.""" - saved_val: Final = save(val, top, base_url, relative_uris) - newdict: MutableMapping[str, Any] = {} - if isinstance(saved_val, MutableSequence): - newdict = {"$graph": saved_val} - elif isinstance(saved_val, MutableMapping): - newdict = saved_val - - if valLoadingOpts.namespaces: - newdict["$namespaces"] = valLoadingOpts.namespaces - if valLoadingOpts.schemas: - newdict["$schemas"] = valLoadingOpts.schemas - if valLoadingOpts.baseuri: - newdict["$base"] = valLoadingOpts.baseuri - for k, v in valLoadingOpts.addl_metadata.items(): - if k not in newdict: - newdict[k] = v - - return newdict - - -def expand_url( - url: str, - base_url: str, - loadingOptions: LoadingOptions, - scoped_id: bool = False, - vocab_term: bool = False, - scoped_ref: int | None = None, -) -> str: - if url in ("@id", "@type"): - return url - - if vocab_term and url in loadingOptions.vocab: - return url - - if bool(loadingOptions.vocab) and ":" in url: - prefix: Final = url.split(":")[0] - if prefix in loadingOptions.vocab: - url = loadingOptions.vocab[prefix] + url[len(prefix) + 1 :] - - split1: Final = urlsplit(url) - - if ( - (bool(split1.scheme) and split1.scheme in loadingOptions.fetcher.supported_schemes()) - or url.startswith("$(") - or url.startswith("${") - ): - pass - elif scoped_id and not bool(split1.fragment): - splitbase1: Final = urlsplit(base_url) - frg: str - if bool(splitbase1.fragment): - frg = splitbase1.fragment + "/" + split1.path - else: - frg = split1.path - pt: Final = splitbase1.path if splitbase1.path != "" else "/" - url = urlunsplit((splitbase1.scheme, splitbase1.netloc, pt, splitbase1.query, frg)) - elif scoped_ref is not None and not bool(split1.fragment): - splitbase2: Final = urlsplit(base_url) - sp = splitbase2.fragment.split("/") - n = scoped_ref - while n > 0 and len(sp) > 0: - sp.pop() - n -= 1 - sp.append(url) - url = urlunsplit( - ( - splitbase2.scheme, - splitbase2.netloc, - splitbase2.path, - splitbase2.query, - "/".join(sp), - ) - ) - else: - url = loadingOptions.fetcher.urljoin(base_url, url) - - if vocab_term: - split2: Final = urlsplit(url) - if bool(split2.scheme): - if url in loadingOptions.rvocab: - return loadingOptions.rvocab[url] - else: - raise ValidationException(f"Term {url!r} not in vocabulary") - - return url +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} @mypyc_attr(native_class=True) -class _Loader(Generic[T], metaclass=ABCMeta): +class _Loader(Generic[FieldType], metaclass=ABCMeta): @abstractmethod def load( self, @@ -456,7 +67,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: ... + ) -> FieldType: ... @mypyc_attr(native_class=True) @@ -475,8 +86,8 @@ def load( @mypyc_attr(native_class=True) -class _PrimitiveLoader(_Loader[T]): - def __init__(self, tp: type[T]) -> None: +class _PrimitiveLoader(_Loader[FieldType]): + def __init__(self, tp: type[FieldType]) -> None: self.tp: Final = tp def load( @@ -486,7 +97,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -496,8 +107,8 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _ArrayLoader(_Loader[Sequence[T]]): - def __init__(self, items: _Loader[T]) -> None: +class _ArrayLoader(_Loader[Sequence[FieldType]]): + def __init__(self, items: _Loader[FieldType]) -> None: self.items: Final = items def load( @@ -507,7 +118,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> list[T]: + ) -> list[FieldType]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -518,7 +129,7 @@ def load( fields: Final[list[str]] = [] for i in range(0, len(doc)): try: - lf = load_field( + lf = _load_field( doc[i], _UnionLoader([self, self.items]), baseuri, loadingOptions, lc=lc ) flatten = loadingOptions.container != "@list" @@ -554,10 +165,10 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _MapLoader(_Loader[Mapping[str, T]]): +class _MapLoader(_Loader[Mapping[str, FieldType]]): def __init__( self, - values: _Loader[T], + values: _Loader[FieldType], name: str | None = None, container: str | None = None, no_link_check: bool | None = None, @@ -574,7 +185,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> dict[str, T]: + ) -> dict[str, FieldType]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -585,7 +196,7 @@ def load( errors: Final[list[SchemaSaladException]] = [] for k, v in doc.items(): try: - lf = load_field(v, self.values, baseuri, loadingOptions, lc) + lf = _load_field(v, self.values, baseuri, loadingOptions, lc) r[k] = lf except ValidationException as e: errors.append(e.with_sourceline(SourceLine(doc, k, str))) @@ -598,7 +209,7 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _EnumLoader(_Loader[E]): +class _EnumLoader(_Loader[EnumFieldType]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -610,9 +221,9 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> E: + ) -> EnumFieldType: if doc in self.symbols: - return cast(E, doc) + return cast(EnumFieldType, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -620,8 +231,8 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _SecondaryDSLLoader(_Loader[T]): - def __init__(self, inner: _Loader[T]) -> None: +class _SecondaryDSLLoader(_Loader[FieldType]): + def __init__(self, inner: _Loader[FieldType]) -> None: self.inner: Final = inner def load( @@ -631,7 +242,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: r: Final[list[dict[str, Any]]] = [] match doc: case MutableSequence() as dlist: @@ -694,10 +305,10 @@ def load( @mypyc_attr(native_class=True) -class _RecordLoader(_Loader[S]): +class _RecordLoader(_Loader[SaveableType]): def __init__( self, - classtype: type[S], + classtype: type[SaveableType], container: str | None = None, no_link_check: bool | None = None, ) -> None: @@ -712,7 +323,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> S: + ) -> SaveableType: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -751,12 +362,12 @@ def load( @mypyc_attr(native_class=True) -class _UnionLoader(_Loader[T]): - def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: +class _UnionLoader(_Loader[FieldType]): + def __init__(self, alternates: Sequence[_Loader[FieldType]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[FieldType]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -766,7 +377,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: errors: Final = [] if lc is None: @@ -842,10 +453,10 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _URILoader(_Loader[T]): +class _URILoader(_Loader[FieldType]): def __init__( self, - inner: _Loader[T], + inner: _Loader[FieldType], scoped_id: bool, vocab_term: bool, scoped_ref: int | None, @@ -864,7 +475,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check @@ -875,7 +486,7 @@ def load( for i in decl: if isinstance(i, str): newdoc.append( - expand_url( + _expand_url( i, baseuri, loadingOptions, @@ -888,7 +499,7 @@ def load( newdoc.append(i) doc = newdoc case str(decl): - doc = expand_url( + doc = _expand_url( decl, baseuri, loadingOptions, @@ -912,8 +523,13 @@ def load( @mypyc_attr(native_class=True) -class _TypeDSLLoader(_Loader[T]): - def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: +class _TypeDSLLoader(_Loader[FieldType]): + def __init__( + self, + inner: _Loader[FieldType], + refScope: int | None, + salad_version: str, + ) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -939,14 +555,35 @@ def resolve( # To show the error message with the original type return doc else: - items = expand_url(rest, baseuri, loadingOptions, False, True, self.refScope) + items = _expand_url( + rest, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) else: items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): - items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) + items = _expand_url( + items, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) expanded: dict[str, Any] | str = {"type": "array", "items": items} else: - expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) + expanded = _expand_url( + doc_, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) if optional: return ["null", expanded] @@ -960,7 +597,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -982,9 +619,10 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -@mypyc_attr(native_class=True) -class _IdMapLoader(_Loader[T]): - def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: +class _IdMapLoader(_Loader[FieldType]): + def __init__( + self, inner: _Loader[FieldType], mapSubject: str, mapPredicate: str | None + ) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -996,7 +634,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -1023,12 +661,12 @@ def load( def _document_load( - loader: _Loader[T], + loader: _Loader[FieldType], doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[T, LoadingOptions]: +) -> tuple[FieldType, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1093,11 +731,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader[T], + loader: _Loader[FieldType], url: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[T, LoadingOptions]: +) -> tuple[FieldType, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1123,79 +761,101 @@ def _document_load_by_url( return loadingOptions.idx[url] -def file_uri(path: str, split_frag: bool = False) -> str: - """Transform a file path into a URL with file scheme.""" - if path.startswith("file://"): - return path - if split_frag: - pathsp: Final = path.split("#", 2) - frag = "#" + quote(str(pathsp[1])) if len(pathsp) == 2 else "" - urlpath = pathname2url(str(pathsp[0])) - else: - urlpath = pathname2url(path) - frag = "" - if urlpath.startswith("//"): - return f"file:{urlpath}{frag}" - return f"file://{urlpath}{frag}" - - -def prefix_url(url: str, namespaces: dict[str, str]) -> str: - """Expand short forms into full URLs using the given namespace dictionary.""" - for k, v in namespaces.items(): - if url.startswith(v): - return k + ":" + url[len(v) :] - return url +def _expand_url( + url: str, + base_url: str, + loadingOptions: LoadingOptions, + scoped_id: bool = False, + vocab_term: bool = False, + scoped_ref: int | None = None, +) -> str: + if url in ("@id", "@type"): + return url + + vocab = _vocab | loadingOptions.vocab + if vocab_term and url in vocab: + return url + if bool(vocab) and ":" in url: + prefix: Final = url.split(":")[0] + if prefix in vocab: + url = vocab[prefix] + url[len(prefix) + 1 :] -def save_relative_uri( - uri: Any, - base_url: str, - scoped_id: bool, - ref_scope: int | None, - relative_uris: bool, -) -> Any: - """Convert any URI to a relative one, obeying the scoping rules.""" - if isinstance(uri, MutableSequence): - return [save_relative_uri(u, base_url, scoped_id, ref_scope, relative_uris) for u in uri] - elif isinstance(uri, str): - if not relative_uris or uri == base_url: - return uri - urisplit: Final = urlsplit(uri) - basesplit: Final = urlsplit(base_url) - if urisplit.scheme == basesplit.scheme and urisplit.netloc == basesplit.netloc: - if urisplit.path != basesplit.path: - p = os.path.relpath(urisplit.path, os.path.dirname(basesplit.path)) - if urisplit.fragment: - p = p + "#" + urisplit.fragment - return p - - basefrag = basesplit.fragment + "/" - if ref_scope: - sp = basefrag.split("/") - i = 0 - while i < ref_scope: - sp.pop() - i += 1 - basefrag = "/".join(sp) - - if urisplit.fragment.startswith(basefrag): - return urisplit.fragment[len(basefrag) :] - return urisplit.fragment - return uri + split1: Final = urlsplit(url) + + if ( + (bool(split1.scheme) and split1.scheme in loadingOptions.fetcher.supported_schemes()) + or url.startswith("$(") + or url.startswith("${") + ): + pass + elif scoped_id and not bool(split1.fragment): + splitbase1: Final = urlsplit(base_url) + frg: str + if bool(splitbase1.fragment): + frg = splitbase1.fragment + "/" + split1.path + else: + frg = split1.path + pt: Final = splitbase1.path if splitbase1.path != "" else "/" + url = urlunsplit((splitbase1.scheme, splitbase1.netloc, pt, splitbase1.query, frg)) + elif scoped_ref is not None and not bool(split1.fragment): + splitbase2: Final = urlsplit(base_url) + sp = splitbase2.fragment.split("/") + n = scoped_ref + while n > 0 and len(sp) > 0: + sp.pop() + n -= 1 + sp.append(url) + url = urlunsplit( + ( + splitbase2.scheme, + splitbase2.netloc, + splitbase2.path, + splitbase2.query, + "/".join(sp), + ) + ) else: - return save(uri, top=False, base_url=base_url, relative_uris=relative_uris) + url = loadingOptions.fetcher.urljoin(base_url, url) + + if vocab_term: + split2: Final = urlsplit(url) + if bool(split2.scheme): + if url in (rvocab := _rvocab | loadingOptions.rvocab): + return rvocab[url] + else: + raise ValidationException(f"Term {url!r} not in vocabulary") + return url -def shortname(inputid: str) -> str: - """ - Compute the shortname of a fully qualified identifier. - See https://w3id.org/cwl/v1.2/SchemaSalad.html#Short_names. - """ - parsed_id: Final = urlparse(inputid) - if parsed_id.fragment: - return parsed_id.fragment.split("/")[-1] - return parsed_id.path.split("/")[-1] +def _load_field( + val: Any | None, + fieldtype: _Loader[FieldType], + baseuri: str, + loadingOptions: LoadingOptions, + lc: Any | None = None, +) -> FieldType: + """Load field.""" + if isinstance(val, MutableMapping): + if "$import" in val: + if loadingOptions.fileuri is None: + raise SchemaSaladException("Cannot load $import without fileuri") + url1: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$import"]) + result, metadata = _document_load_by_url( + fieldtype, + url1, + loadingOptions, + ) + loadingOptions.imports.append(url1) + return result + if "$include" in val: + if loadingOptions.fileuri is None: + raise SchemaSaladException("Cannot load $import without fileuri") + url2: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$include"]) + val = loadingOptions.fetcher.fetch_text(url2) + loadingOptions.includes.append(url2) + return fieldtype.load(val, baseuri, loadingOptions, lc=lc) def parser_info() -> str: @@ -1203,15 +863,211 @@ def parser_info() -> str: @mypyc_attr(native_class=True) -class RecordField(Saveable): - """ - A field of a record. - """ +class CWLArraySchema(schema_salad.metaschema.ArraySchema): + def __eq__(self, other: Any) -> bool: + if isinstance(other, CWLArraySchema): + return bool(self.items == other.items and self.type_ == other.type_) + return False + + def __hash__(self) -> int: + return hash((self.items, self.type_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) + + items = _load_field( + _doc.get("items"), + uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `items`, `type`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + items=items, + type_=type_, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.items is not None: + u = save_relative_uri(self.items, base_url, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + items: CWLArraySchema | CWLRecordSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | PrimitiveType | schema_salad.metaschema.EnumSchema | str] | schema_salad.metaschema.EnumSchema | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordField(schema_salad.metaschema.RecordField): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, RecordField): + if isinstance(other, CWLRecordField): return bool( self.doc == other.doc and self.name == other.name @@ -1239,7 +1095,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_strtype_True_False_None_None, baseuri, @@ -1295,7 +1151,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -1343,9 +1199,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2, + typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -1395,7 +1251,7 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] @@ -1455,7 +1311,7 @@ def save( def __init__( self, name: str, - type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: CWLArraySchema | CWLRecordSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | PrimitiveType | schema_salad.metaschema.EnumSchema | str] | schema_salad.metaschema.EnumSchema | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1476,9 +1332,9 @@ def __init__( @mypyc_attr(native_class=True) -class RecordSchema(Saveable): +class CWLRecordSchema(schema_salad.metaschema.RecordSchema): def __eq__(self, other: Any) -> bool: - if isinstance(other, RecordSchema): + if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) return False @@ -1502,9 +1358,9 @@ def fromDoc( fields = None if "fields" in _doc: try: - fields = load_field( + fields = _load_field( _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader, + idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader, baseuri, loadingOptions, lc=_doc.get("fields") @@ -1550,7 +1406,7 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), typedsl_Record_nameLoader_2, baseuri, @@ -1602,7 +1458,7 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] @@ -1657,7 +1513,7 @@ def save( def __init__( self, type_: Record_name, - fields: None | Sequence[RecordField] = None, + fields: None | Sequence[CWLRecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -1676,25 +1532,69 @@ def __init__( @mypyc_attr(native_class=True) -class EnumSchema(Saveable): +class File(Saveable): """ - Define an enumerated type. + Represents a file (or group of files when ``secondaryFiles`` is provided) that will be accessible by tools using standard POSIX file system call API such as open(2) and read(2). - """ + Files are represented as objects with ``class`` of ``File``. File objects have a number of properties that provide metadata about the file. - name: str + The ``location`` property of a File is a URI that uniquely identifies the file. Implementations must support the file:// URI scheme and may support other schemes such as http://. The value of ``location`` may also be a relative reference, in which case it must be resolved relative to the URI of the document it appears in. Alternately to ``location``, implementations must also accept the ``path`` property on File, which must be a filesystem path available on the same host as the CWL runner (for inputs) or the runtime environment of a command line tool execution (for command line tool outputs). + + If no ``location`` or ``path`` is specified, a file object must specify ``contents`` with the UTF-8 text content of the file. This is a "file literal". File literals do not correspond to external resources, but are created on disk with ``contents`` with when needed for a executing a tool. Where appropriate, expressions can return file literals to define new files on a runtime. The maximum size of ``contents`` is 64 kilobytes. + + The ``basename`` property defines the filename on disk where the file is staged. This may differ from the resource name. If not provided, ``basename`` must be computed from the last path part of ``location`` and made available to expressions. + + The ``secondaryFiles`` property is a list of File or Directory objects that must be staged in the same directory as the primary file. It is an error for file names to be duplicated in ``secondaryFiles``. + + The ``size`` property is the size in bytes of the File. It must be computed from the resource and made available to expressions. The ``checksum`` field contains a cryptographic hash of the file content for use it verifying file contents. Implementations may, at user option, enable or disable computation of the ``checksum`` field for performance or other reasons. However, the ability to compute output checksums is required to pass the CWL conformance test suite. + + When executing a CommandLineTool, the files and secondary files may be staged to an arbitrary directory, but must use the value of ``basename`` for the filename. The ``path`` property must be file path in the context of the tool execution runtime (local to the compute node, or within the executing container). All computed properties should be available to expressions. File literals also must be staged and ``path`` must be set. + + When collecting CommandLineTool outputs, ``glob`` matching returns file paths (with the ``path`` property) and the derived properties. This can all be modified by ``outputEval``. Alternately, if the file ``cwl.output.json`` is present in the output, ``outputBinding`` is ignored. + + File objects in the output must provide either a ``location`` URI or a ``path`` property in the context of the tool execution runtime (local to the compute node, or within the executing container). + + When evaluating an ExpressionTool, file objects must be referenced via ``location`` (the expression tool does not have access to files on disk so ``path`` is meaningless) or as file literals. It is legal to return a file object with an existing ``location`` but a different ``basename``. The ``loadContents`` field of ExpressionTool inputs behaves the same as on CommandLineTool inputs, however it is not meaningful on the outputs. + + An ExpressionTool may forward file references from input to output by using the same value for ``location``. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, EnumSchema): + if isinstance(other, File): return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ + self.class_ == other.class_ + and self.location == other.location + and self.path == other.path + and self.basename == other.basename + and self.dirname == other.dirname + and self.nameroot == other.nameroot + and self.nameext == other.nameext + and self.checksum == other.checksum + and self.size == other.size + and self.secondaryFiles == other.secondaryFiles + and self.format == other.format + and self.contents == other.contents ) return False def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_)) + return hash( + ( + self.class_, + self.location, + self.path, + self.basename, + self.dirname, + self.nameroot, + self.nameext, + self.checksum, + self.size, + self.secondaryFiles, + self.format, + self.contents, + ) + ) @classmethod def fromDoc( @@ -1710,21 +1610,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_File_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + location = None + if "location" in _doc: + try: + location = _load_field( + _doc.get("location"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("location") + ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `location`": _errors__.append( ValidationException( str(e), @@ -1732,13 +1649,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("location") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -1750,340 +1667,499 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `location` field with value `{val}` " "is not valid because:", ) ) + path = None + if "path" in _doc: + try: + path = _load_field( + _doc.get("path"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("path") + ) - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `path`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("path") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [e], + detailed_message=f"the `path` field with value `{val}` " + "is not valid because:", + ) + ) + basename = None + if "basename" in _doc: + try: + basename = _load_field( + _doc.get("basename"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("basename") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `basename`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + val = _doc.get("basename") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [e], + detailed_message=f"the `basename` field with value `{val}` " + "is not valid because:", + ) + ) + dirname = None + if "dirname" in _doc: + try: + dirname = _load_field( + _doc.get("dirname"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("dirname") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `dirname`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("dirname") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `dirname` field is not valid because:", + SourceLine(_doc, "dirname", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `dirname` field is not valid because:", + SourceLine(_doc, "dirname", str), + [e], + detailed_message=f"the `dirname` field with value `{val}` " + "is not valid because:", + ) + ) + nameroot = None + if "nameroot" in _doc: + try: + nameroot = _load_field( + _doc.get("nameroot"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("nameroot") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `nameroot`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`".format( - k - ), - SourceLine(_doc, k, str), + val = _doc.get("nameroot") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `nameroot` field is not valid because:", + SourceLine(_doc, "nameroot", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) - - -@mypyc_attr(native_class=True) -class ArraySchema(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, ArraySchema): - return bool(self.items == other.items and self.type_ == other.type_) - return False - - def __hash__(self) -> int: - return hash((self.items, self.type_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) + else: + _errors__.append( + ValidationException( + "the `nameroot` field is not valid because:", + SourceLine(_doc, "nameroot", str), + [e], + detailed_message=f"the `nameroot` field with value `{val}` " + "is not valid because:", + ) + ) + nameext = None + if "nameext" in _doc: + try: + nameext = _load_field( + _doc.get("nameext"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("nameext") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `nameext`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", + val = _doc.get("nameext") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `nameext` field is not valid because:", + SourceLine(_doc, "nameext", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + _errors__.append( + ValidationException( + "the `nameext` field is not valid because:", + SourceLine(_doc, "nameext", str), + [e], + detailed_message=f"the `nameext` field with value `{val}` " + "is not valid because:", + ) + ) + checksum = None + if "checksum" in _doc: + try: + checksum = _load_field( + _doc.get("checksum"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("checksum") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `checksum`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: + val = _doc.get("checksum") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `checksum` field is not valid because:", + SourceLine(_doc, "checksum", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `checksum` field is not valid because:", + SourceLine(_doc, "checksum", str), + [e], + detailed_message=f"the `checksum` field with value `{val}` " + "is not valid because:", + ) + ) + size = None + if "size" in _doc: + try: + size = _load_field( + _doc.get("size"), + union_of_None_type_or_inttype_or_longtype, + baseuri, + loadingOptions, + lc=_doc.get("size") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `size`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("size") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `size` field is not valid because:", + SourceLine(_doc, "size", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `size` field is not valid because:", + SourceLine(_doc, "size", str), + [e], + detailed_message=f"the `size` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `secondaryFiles`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + contents = None + if "contents" in _doc: + try: + contents = _load_field( + _doc.get("contents"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("contents") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `contents`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("contents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `contents` field is not valid because:", + SourceLine(_doc, "contents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `contents` field is not valid because:", + SourceLine(_doc, "contents", str), + [e], + detailed_message=f"the `contents` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: if not k: _errors__.append( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`".format( + "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `dirname`, `nameroot`, `nameext`, `checksum`, `size`, `secondaryFiles`, `format`, `contents`".format( k ), SourceLine(_doc, k, str), @@ -2093,8 +2169,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - items=items, - type_=type_, + location=location, + path=path, + basename=basename, + dirname=dirname, + nameroot=nameroot, + nameext=nameext, + checksum=checksum, + size=size, + secondaryFiles=secondaryFiles, + format=format, + contents=contents, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2111,26 +2196,82 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.location is not None: + u = save_relative_uri(self.location, base_url, False, None, relative_uris) + r["location"] = u + if self.path is not None: + u = save_relative_uri(self.path, base_url, False, None, relative_uris) + r["path"] = u + if self.basename is not None: + r["basename"] = save( + self.basename, top=False, base_url=base_url, relative_uris=relative_uris ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - + if self.dirname is not None: + r["dirname"] = save( + self.dirname, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.nameroot is not None: + r["nameroot"] = save( + self.nameroot, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.nameext is not None: + r["nameext"] = save( + self.nameext, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.checksum is not None: + r["checksum"] = save( + self.checksum, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.size is not None: + r["size"] = save( + self.size, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.format is not None: + u = save_relative_uri(self.format, base_url, True, None, relative_uris) + r["format"] = u + if self.contents is not None: + r["contents"] = save( + self.contents, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + def __init__( self, - items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Array_name, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | i32 | i64 = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2142,21 +2283,77 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.class_: Final[str] = "File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents - attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "location", + "path", + "basename", + "dirname", + "nameroot", + "nameext", + "checksum", + "size", + "secondaryFiles", + "format", + "contents", + ] + ) @mypyc_attr(native_class=True) -class MapSchema(Saveable): +class Directory(Saveable): + """ + Represents a directory to present to a command line tool. + + Directories are represented as objects with ``class`` of ``Directory``. Directory objects have a number of properties that provide metadata about the directory. + + The ``location`` property of a Directory is a URI that uniquely identifies the directory. Implementations must support the file:// URI scheme and may support other schemes such as http://. Alternately to ``location``, implementations must also accept the ``path`` property on Directory, which must be a filesystem path available on the same host as the CWL runner (for inputs) or the runtime environment of a command line tool execution (for command line tool outputs). + + A Directory object may have a ``listing`` field. This is a list of File and Directory objects that are contained in the Directory. For each entry in ``listing``, the ``basename`` property defines the name of the File or Subdirectory when staged to disk. If ``listing`` is not provided, the implementation must have some way of fetching the Directory listing at runtime based on the ``location`` field. + + If a Directory does not have ``location``, it is a Directory literal. A Directory literal must provide ``listing``. Directory literals must be created on disk at runtime as needed. + + The resources in a Directory literal do not need to have any implied relationship in their ``location``. For example, a Directory listing may contain two files located on different hosts. It is the responsibility of the runtime to ensure that those files are staged to disk appropriately. Secondary files associated with files in ``listing`` must also be staged to the same Directory. + + When executing a CommandLineTool, Directories must be recursively staged first and have local values of ``path`` assigned. + + Directory objects in CommandLineTool output must provide either a ``location`` URI or a ``path`` property in the context of the tool execution runtime (local to the compute node, or within the executing container). + + An ExpressionTool may forward file references from input to output by using the same value for ``location``. + + Name conflicts (the same ``basename`` appearing multiple times in ``listing`` or in any entry in ``secondaryFiles`` in the listing) is a fatal error. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, MapSchema): - return bool(self.type_ == other.type_ and self.values == other.values) + if isinstance(other, Directory): + return bool( + self.class_ == other.class_ + and self.location == other.location + and self.path == other.path + and self.basename == other.basename + and self.listing == other.listing + ) return False def __hash__(self) -> int: - return hash((self.type_, self.values)) + return hash( + (self.class_, self.location, self.path, self.basename, self.listing) + ) @classmethod def fromDoc( @@ -2173,117 +2370,226 @@ def fromDoc( _doc.lc.filename = doc.lc.filename _errors__ = [] try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Map_nameLoader_2, + class_ = _load_field( + _doc.get("class"), + uri_Directory_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) + raise e + location = None + if "location" in _doc: + try: + location = _load_field( + _doc.get("location"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("location") ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `location`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + val = _doc.get("location") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("values") is None: - raise ValidationException("missing required field `values`", None, []) - - values = load_field( - _doc.get("values"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("values") - ) + else: + _errors__.append( + ValidationException( + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), + [e], + detailed_message=f"the `location` field with value `{val}` " + "is not valid because:", + ) + ) + path = None + if "path" in _doc: + try: + path = _load_field( + _doc.get("path"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("path") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `values`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("values") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `path`": _errors__.append( ValidationException( - "the `values` field is not valid because:", - SourceLine(_doc, "values", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `values` field is not valid because:", - SourceLine(_doc, "values", str), - [e], - detailed_message=f"the `values` field with value `{val}` " - "is not valid because:", + val = _doc.get("path") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `type`, `values`".format( + else: + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [e], + detailed_message=f"the `path` field with value `{val}` " + "is not valid because:", + ) + ) + basename = None + if "basename" in _doc: + try: + basename = _load_field( + _doc.get("basename"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("basename") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `basename`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("basename") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [e], + detailed_message=f"the `basename` field with value `{val}` " + "is not valid because:", + ) + ) + listing = None + if "listing" in _doc: + try: + listing = _load_field( + _doc.get("listing"), + union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, + baseuri, + loadingOptions, + lc=_doc.get("listing") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `listing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("listing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [e], + detailed_message=f"the `listing` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `listing`".format( k ), SourceLine(_doc, k, str), @@ -2293,8 +2599,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - type_=type_, - values=values, + location=location, + path=path, + basename=basename, + listing=listing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2311,13 +2619,30 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.location is not None: + u = save_relative_uri(self.location, base_url, False, None, relative_uris) + r["location"] = u + if self.path is not None: + u = save_relative_uri(self.path, base_url, False, None, relative_uris) + r["path"] = u + if self.basename is not None: + r["basename"] = save( + self.basename, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.listing is not None: + r["listing"] = save( + self.listing, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.values is not None: - u = save_relative_uri(self.values, base_url, False, 2, relative_uris) - r["values"] = u # top refers to the directory level if top: @@ -2329,8 +2654,10 @@ def save( def __init__( self, - type_: Map_name, - values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2342,21 +2669,26 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.class_: Final[str] = "Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing - attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) @mypyc_attr(native_class=True) -class UnionSchema(Saveable): +class InputBinding(Saveable): def __eq__(self, other: Any) -> bool: - if isinstance(other, UnionSchema): - return bool(self.names == other.names and self.type_ == other.type_) + if isinstance(other, InputBinding): + return bool(self.loadContents == other.loadContents) return False def __hash__(self) -> int: - return hash((self.names, self.type_)) + return hash((self.loadContents)) @classmethod def fromDoc( @@ -2372,133 +2704,83 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("names") is None: - raise ValidationException("missing required field `names`", None, []) - - names = load_field( - _doc.get("names"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("names") - ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `names`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("names") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( - "the `names` field is not valid because:", - SourceLine(_doc, "names", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None + ) + ) + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "the `names` field is not valid because:", - SourceLine(_doc, "names", str), - [e], - detailed_message=f"the `names` field with value `{val}` " - "is not valid because:", + "invalid field `{}`, expected one of: `loadContents`".format( + k + ), + SourceLine(_doc, k, str), ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Union_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `names`, `type`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - names=names, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + loadContents=loadContents, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed def save( self, top: bool = False, base_url: str = "", relative_uris: bool = True @@ -2511,12 +2793,12 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.names is not None: - u = save_relative_uri(self.names, base_url, False, 2, relative_uris) - r["names"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -2529,8 +2811,7 @@ def save( def __init__( self, - names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Union_name, + loadContents: None | bool = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2542,21 +2823,44 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names - self.type_ = type_ + self.loadContents = loadContents - attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) @mypyc_attr(native_class=True) -class CWLArraySchema(ArraySchema): +class InputRecordField(CWLRecordField): + name: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLArraySchema): - return bool(self.items == other.items and self.type_ == other.type_) + if isinstance(other, InputRecordField): + return bool( + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.format == other.format + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + ) return False def __hash__(self) -> int: - return hash((self.items, self.type_)) + return hash( + ( + self.doc, + self.name, + self.type_, + self.label, + self.secondaryFiles, + self.streamable, + self.format, + self.loadContents, + self.loadListing, + ) + ) @classmethod def fromDoc( @@ -2572,61 +2876,116 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `name`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Array_nameLoader_2, + typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -2668,131 +3027,68 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - items=items, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, - type_: Array_name, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) - - -@mypyc_attr(native_class=True) -class CWLRecordField(RecordField): - name: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLRecordField): - return bool( - self.doc == other.doc - and self.name == other.name - and self.type_ == other.type_ - ) - return False - - def __hash__(self) -> int: - return hash((self.doc, self.name, self.type_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - name = None - if "name" in _doc: + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: try: - name = load_field( - _doc.get("name"), - uri_strtype_True_False_None_None, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -2800,13 +3096,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -2818,37 +3114,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "" - _errors__.append(ValidationException("missing name")) - else: - baseuri = name - doc = None - if "doc" in _doc: + streamable = None + if "streamable" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -2856,13 +3143,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -2874,77 +3161,170 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `format`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `loadContents`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) + loadListing = None + if "loadListing" in _doc: + try: + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, + baseuri, + loadingOptions, + lc=_doc.get("loadListing") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `loadListing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadListing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), + [e], + detailed_message=f"the `loadListing` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `loadContents`, `loadListing`".format( k ), SourceLine(_doc, k, str), @@ -2957,6 +3337,12 @@ def fromDoc( name=name, doc=doc, type_=type_, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + format=format, + loadContents=loadContents, + loadListing=loadListing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2985,6 +3371,41 @@ def save( r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.format is not None: + u = save_relative_uri(self.format, self.name, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) # top refers to the directory level if top: @@ -2997,8 +3418,14 @@ def save( def __init__( self, name: str, - type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -3013,19 +3440,45 @@ def __init__( self.doc = doc self.name = name self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing - attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "doc", + "name", + "type", + "label", + "secondaryFiles", + "streamable", + "format", + "loadContents", + "loadListing", + ] + ) @mypyc_attr(native_class=True) -class CWLRecordSchema(RecordSchema): +class InputRecordSchema(CWLRecordSchema): + name: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLRecordSchema): - return bool(self.fields == other.fields and self.type_ == other.type_) + if isinstance(other, InputRecordSchema): + return bool( + self.fields == other.fields + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.name == other.name + ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_)) + return hash((self.fields, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -3041,12 +3494,67 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `name`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name fields = None if "fields" in _doc: try: - fields = load_field( + fields = _load_field( _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader, + idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader, baseuri, loadingOptions, lc=_doc.get("fields") @@ -3092,7 +3600,7 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), typedsl_Record_nameLoader_2, baseuri, @@ -3136,22 +3644,116 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -3161,11 +3763,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, + label=label, + doc=doc, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -3179,13 +3785,24 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u if self.fields is not None: r["fields"] = save( - self.fields, top=False, base_url=base_url, relative_uris=relative_uris + self.fields, top=False, base_url=self.name, relative_uris=relative_uris ) if self.type_ is not None: r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -3199,7 +3816,10 @@ def save( def __init__( self, type_: Record_name, - fields: None | Sequence[CWLRecordField] = None, + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -3213,117 +3833,32 @@ def __init__( self.loadingOptions = LoadingOptions() self.fields = fields self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) @mypyc_attr(native_class=True) -class File(Saveable): - """ - Represents a file (or group of files when `secondaryFiles` is provided) that - will be accessible by tools using standard POSIX file system call API such as - open(2) and read(2). - - Files are represented as objects with `class` of `File`. File objects have - a number of properties that provide metadata about the file. - - The `location` property of a File is a URI that uniquely identifies the - file. Implementations must support the file:// URI scheme and may support - other schemes such as http://. The value of `location` may also be a - relative reference, in which case it must be resolved relative to the URI - of the document it appears in. Alternately to `location`, implementations - must also accept the `path` property on File, which must be a filesystem - path available on the same host as the CWL runner (for inputs) or the - runtime environment of a command line tool execution (for command line tool - outputs). - - If no `location` or `path` is specified, a file object must specify - `contents` with the UTF-8 text content of the file. This is a "file - literal". File literals do not correspond to external resources, but are - created on disk with `contents` with when needed for a executing a tool. - Where appropriate, expressions can return file literals to define new files - on a runtime. The maximum size of `contents` is 64 kilobytes. - - The `basename` property defines the filename on disk where the file is - staged. This may differ from the resource name. If not provided, - `basename` must be computed from the last path part of `location` and made - available to expressions. - - The `secondaryFiles` property is a list of File or Directory objects that - must be staged in the same directory as the primary file. It is an error - for file names to be duplicated in `secondaryFiles`. - - The `size` property is the size in bytes of the File. It must be computed - from the resource and made available to expressions. The `checksum` field - contains a cryptographic hash of the file content for use it verifying file - contents. Implementations may, at user option, enable or disable - computation of the `checksum` field for performance or other reasons. - However, the ability to compute output checksums is required to pass the - CWL conformance test suite. - - When executing a CommandLineTool, the files and secondary files may be - staged to an arbitrary directory, but must use the value of `basename` for - the filename. The `path` property must be file path in the context of the - tool execution runtime (local to the compute node, or within the executing - container). All computed properties should be available to expressions. - File literals also must be staged and `path` must be set. - - When collecting CommandLineTool outputs, `glob` matching returns file paths - (with the `path` property) and the derived properties. This can all be - modified by `outputEval`. Alternately, if the file `cwl.output.json` is - present in the output, `outputBinding` is ignored. - - File objects in the output must provide either a `location` URI or a `path` - property in the context of the tool execution runtime (local to the compute - node, or within the executing container). - - When evaluating an ExpressionTool, file objects must be referenced via - `location` (the expression tool does not have access to files on disk so - `path` is meaningless) or as file literals. It is legal to return a file - object with an existing `location` but a different `basename`. The - `loadContents` field of ExpressionTool inputs behaves the same as on - CommandLineTool inputs, however it is not meaningful on the outputs. - - An ExpressionTool may forward file references from input to output by using - the same value for `location`. - - """ +class InputEnumSchema(schema_salad.metaschema.EnumSchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, File): + if isinstance(other, InputEnumSchema): return bool( - self.class_ == other.class_ - and self.location == other.location - and self.path == other.path - and self.basename == other.basename - and self.dirname == other.dirname - and self.nameroot == other.nameroot - and self.nameext == other.nameext - and self.checksum == other.checksum - and self.size == other.size - and self.secondaryFiles == other.secondaryFiles - and self.format == other.format - and self.contents == other.contents + self.name == other.name + and self.symbols == other.symbols + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc ) return False def __hash__(self) -> int: - return hash( - ( - self.class_, - self.location, - self.path, - self.basename, - self.dirname, - self.nameroot, - self.nameext, - self.checksum, - self.size, - self.secondaryFiles, - self.format, - self.contents, - ) - ) + return hash((self.name, self.symbols, self.type_, self.label, self.doc)) @classmethod def fromDoc( @@ -3339,37 +3874,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_File_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - location = None - if "location" in _doc: + name = None + if "name" in _doc: try: - location = load_field( - _doc.get("location"), - uri_union_of_None_type_or_strtype_False_False_None_None, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("location") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `location`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -3377,13 +3896,13 @@ def fromDoc( ) ) else: - val = _doc.get("location") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3395,169 +3914,132 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `location` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - path = None - if "path" in _doc: - try: - path = load_field( - _doc.get("path"), - uri_union_of_None_type_or_strtype_False_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("path") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + try: + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) - if str(e) == "missing required field `path`": + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("symbols") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `symbols`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("symbols") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("path") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), - [e], - detailed_message=f"the `path` field with value `{val}` " - "is not valid because:", - ) + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) - basename = None - if "basename" in _doc: - try: - basename = load_field( - _doc.get("basename"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("basename") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `basename`": + ) + else: _errors__.append( ValidationException( - str(e), - None + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [e], + detailed_message=f"the `symbols` field with value `{val}` " + "is not valid because:", ) ) - else: - val = _doc.get("basename") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), - [e], - detailed_message=f"the `basename` field with value `{val}` " - "is not valid because:", - ) - ) - dirname = None - if "dirname" in _doc: - try: - dirname = load_field( - _doc.get("dirname"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dirname") - ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + type_ = _load_field( + _doc.get("type"), + typedsl_Enum_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) - if str(e) == "missing required field `dirname`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("dirname") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dirname` field is not valid because:", - SourceLine(_doc, "dirname", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `dirname` field is not valid because:", - SourceLine(_doc, "dirname", str), - [e], - detailed_message=f"the `dirname` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", ) - nameroot = None - if "nameroot" in _doc: + ) + label = None + if "label" in _doc: try: - nameroot = load_field( - _doc.get("nameroot"), + label = _load_field( + _doc.get("label"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("nameroot") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `nameroot`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -3565,13 +4047,13 @@ def fromDoc( ) ) else: - val = _doc.get("nameroot") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `nameroot` field is not valid because:", - SourceLine(_doc, "nameroot", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3583,28 +4065,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `nameroot` field is not valid because:", - SourceLine(_doc, "nameroot", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `nameroot` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - nameext = None - if "nameext" in _doc: + doc = None + if "doc" in _doc: try: - nameext = load_field( - _doc.get("nameext"), - union_of_None_type_or_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("nameext") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `nameext`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -3612,13 +4094,13 @@ def fromDoc( ) ) else: - val = _doc.get("nameext") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `nameext` field is not valid because:", - SourceLine(_doc, "nameext", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3630,75 +4112,163 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `nameext` field is not valid because:", - SourceLine(_doc, "nameext", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `nameext` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - checksum = None - if "checksum" in _doc: - try: - checksum = load_field( - _doc.get("checksum"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("checksum") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `checksum`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("checksum") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `checksum` field is not valid because:", - SourceLine(_doc, "checksum", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( + k + ), + SourceLine(_doc, k, str), ) - else: - _errors__.append( - ValidationException( - "the `checksum` field is not valid because:", - SourceLine(_doc, "checksum", str), - [e], - detailed_message=f"the `checksum` field with value `{val}` " - "is not valid because:", - ) - ) - size = None - if "size" in _doc: + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + name=name, + symbols=symbols, + type_=type_, + label=label, + doc=doc, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + loadingOptions.idx[name] = (_constructed, loadingOptions) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +@mypyc_attr(native_class=True) +class InputArraySchema(CWLArraySchema): + name: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, InputArraySchema): + return bool( + self.items == other.items + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.name == other.name + ) + return False + + def __hash__(self) -> int: + return hash((self.items, self.type_, self.label, self.doc, self.name)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + name = None + if "name" in _doc: try: - size = load_field( - _doc.get("size"), - union_of_None_type_or_inttype_or_inttype, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("size") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `size`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -3706,13 +4276,13 @@ def fromDoc( ) ) else: - val = _doc.get("size") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `size` field is not valid because:", - SourceLine(_doc, "size", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3724,122 +4294,179 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `size` field is not valid because:", - SourceLine(_doc, "size", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `size` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - if str(e) == "missing required field `secondaryFiles`": + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": _errors__.append( ValidationException( - str(e), - None + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", ) ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " f"{verb_tensage} {error_message}")], ) ) else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - contents = None - if "contents" in _doc: + doc = None + if "doc" in _doc: try: - contents = load_field( - _doc.get("contents"), - union_of_None_type_or_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("contents") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `contents`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -3847,13 +4474,13 @@ def fromDoc( ) ) else: - val = _doc.get("contents") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `contents` field is not valid because:", - SourceLine(_doc, "contents", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3865,10 +4492,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `contents` field is not valid because:", - SourceLine(_doc, "contents", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `contents` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) @@ -3880,14 +4507,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `dirname`, `nameroot`, `nameext`, `checksum`, `size`, `secondaryFiles`, `format`, `contents`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -3897,20 +4524,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - location=location, - path=path, - basename=basename, - dirname=dirname, - nameroot=nameroot, - nameext=nameext, - checksum=checksum, - size=size, - secondaryFiles=secondaryFiles, - format=format, - contents=contents, + name=name, + items=items, + type_=type_, + label=label, + doc=doc, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -3924,57 +4546,23 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.location is not None: - u = save_relative_uri(self.location, base_url, False, None, relative_uris) - r["location"] = u - if self.path is not None: - u = save_relative_uri(self.path, base_url, False, None, relative_uris) - r["path"] = u - if self.basename is not None: - r["basename"] = save( - self.basename, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.dirname is not None: - r["dirname"] = save( - self.dirname, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.nameroot is not None: - r["nameroot"] = save( - self.nameroot, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.nameext is not None: - r["nameext"] = save( - self.nameext, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.checksum is not None: - r["checksum"] = save( - self.checksum, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.size is not None: - r["size"] = save( - self.size, top=False, base_url=base_url, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.items is not None: + u = save_relative_uri(self.items, self.name, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.format is not None: - u = save_relative_uri(self.format, base_url, True, None, relative_uris) - r["format"] = u - if self.contents is not None: - r["contents"] = save( - self.contents, top=False, base_url=base_url, relative_uris=relative_uris + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -3987,17 +4575,11 @@ def save( def __init__( self, - location: None | str = None, - path: None | str = None, - basename: None | str = None, - dirname: None | str = None, - nameroot: None | str = None, - nameext: None | str = None, - checksum: None | str = None, - size: None | i32 = None, - secondaryFiles: None | Sequence[Directory | File] = None, - format: None | str = None, - contents: None | str = None, + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -4009,100 +4591,45 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "location", - "path", - "basename", - "dirname", - "nameroot", - "nameext", - "checksum", - "size", - "secondaryFiles", - "format", - "contents", - ] + ["items", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class Directory(Saveable): - """ - Represents a directory to present to a command line tool. - - Directories are represented as objects with `class` of `Directory`. Directory objects have - a number of properties that provide metadata about the directory. - - The `location` property of a Directory is a URI that uniquely identifies - the directory. Implementations must support the file:// URI scheme and may - support other schemes such as http://. Alternately to `location`, - implementations must also accept the `path` property on Directory, which - must be a filesystem path available on the same host as the CWL runner (for - inputs) or the runtime environment of a command line tool execution (for - command line tool outputs). - - A Directory object may have a `listing` field. This is a list of File and - Directory objects that are contained in the Directory. For each entry in - `listing`, the `basename` property defines the name of the File or - Subdirectory when staged to disk. If `listing` is not provided, the - implementation must have some way of fetching the Directory listing at - runtime based on the `location` field. - - If a Directory does not have `location`, it is a Directory literal. A - Directory literal must provide `listing`. Directory literals must be - created on disk at runtime as needed. - - The resources in a Directory literal do not need to have any implied - relationship in their `location`. For example, a Directory listing may - contain two files located on different hosts. It is the responsibility of - the runtime to ensure that those files are staged to disk appropriately. - Secondary files associated with files in `listing` must also be staged to - the same Directory. - - When executing a CommandLineTool, Directories must be recursively staged - first and have local values of `path` assigned. - - Directory objects in CommandLineTool output must provide either a - `location` URI or a `path` property in the context of the tool execution - runtime (local to the compute node, or within the executing container). - - An ExpressionTool may forward file references from input to output by using - the same value for `location`. - - Name conflicts (the same `basename` appearing multiple times in `listing` - or in any entry in `secondaryFiles` in the listing) is a fatal error. - - """ +class OutputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, Directory): + if isinstance(other, OutputRecordField): return bool( - self.class_ == other.class_ - and self.location == other.location - and self.path == other.path - and self.basename == other.basename - and self.listing == other.listing + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.format == other.format ) return False def __hash__(self) -> int: return hash( - (self.class_, self.location, self.path, self.basename, self.listing) + ( + self.doc, + self.name, + self.type_, + self.label, + self.secondaryFiles, + self.streamable, + self.format, + ) ) @classmethod @@ -4119,37 +4646,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_Directory_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - location = None - if "location" in _doc: + name = None + if "name" in _doc: try: - location = load_field( - _doc.get("location"), - uri_union_of_None_type_or_strtype_False_False_None_None, + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("location") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `location`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -4157,13 +4668,13 @@ def fromDoc( ) ) else: - val = _doc.get("location") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4175,28 +4686,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `location` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - path = None - if "path" in _doc: + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: try: - path = load_field( - _doc.get("path"), - uri_union_of_None_type_or_strtype_False_False_None_None, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("path") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `path`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -4204,13 +4724,13 @@ def fromDoc( ) ) else: - val = _doc.get("path") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4222,28 +4742,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `path` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - basename = None - if "basename" in _doc: + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: try: - basename = load_field( - _doc.get("basename"), + label = _load_field( + _doc.get("label"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("basename") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `basename`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -4251,13 +4819,13 @@ def fromDoc( ) ) else: - val = _doc.get("basename") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4269,28 +4837,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `basename` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - listing = None - if "listing" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - listing = load_field( - _doc.get("listing"), - union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("listing") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `listing`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -4298,13 +4866,13 @@ def fromDoc( ) ) else: - val = _doc.get("listing") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4316,170 +4884,89 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `listing` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `streamable`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `listing`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - location=location, - path=path, - basename=basename, - listing=listing, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.location is not None: - u = save_relative_uri(self.location, base_url, False, None, relative_uris) - r["location"] = u - if self.path is not None: - u = save_relative_uri(self.path, base_url, False, None, relative_uris) - r["path"] = u - if self.basename is not None: - r["basename"] = save( - self.basename, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.listing is not None: - r["listing"] = save( - self.listing, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - location: None | str = None, - path: None | str = None, - basename: None | str = None, - listing: None | Sequence[Directory | File] = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing - - attrs: ClassVar[Collection[str]] = frozenset( - ["class", "location", "path", "basename", "listing"] - ) - - -@mypyc_attr(native_class=True) -class InputBinding(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, InputBinding): - return bool(self.loadContents == other.loadContents) - return False - - def __hash__(self) -> int: - return hash((self.loadContents)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadContents`": - _errors__.append( - ValidationException( - str(e), - None + str(e), + None ) ) else: - val = _doc.get("loadContents") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4491,10 +4978,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) @@ -4506,14 +4993,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `loadContents`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`".format( k ), SourceLine(_doc, k, str), @@ -4523,10 +5010,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - loadContents=loadContents, + name=name, + doc=doc, + type_=type_, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + format=format, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -4540,13 +5034,38 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, top=False, - base_url=base_url, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.name, relative_uris=relative_uris, ) + if self.format is not None: + u = save_relative_uri(self.format, self.name, True, None, relative_uris) + r["format"] = u # top refers to the directory level if top: @@ -4558,7 +5077,13 @@ def save( def __init__( self, - loadContents: None | bool = None, + name: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -4570,44 +5095,36 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format - attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] + ) @mypyc_attr(native_class=True) -class InputRecordField(CWLRecordField): +class OutputRecordSchema(CWLRecordSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputRecordField): + if isinstance(other, OutputRecordSchema): return bool( - self.doc == other.doc - and self.name == other.name + self.fields == other.fields and self.type_ == other.type_ and self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.format == other.format - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing + and self.doc == other.doc + and self.name == other.name ) return False def __hash__(self) -> int: - return hash( - ( - self.doc, - self.name, - self.type_, - self.label, - self.secondaryFiles, - self.streamable, - self.format, - self.loadContents, - self.loadListing, - ) - ) + return hash((self.fields, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -4626,9 +5143,9 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), - uri_strtype_True_False_None_None, + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("name") @@ -4675,25 +5192,24 @@ def fromDoc( if docRoot is not None: name = docRoot else: - name = "" - _errors__.append(ValidationException("missing name")) + name = "_:" + str(_uuid__.uuid4()) else: baseuri = name - doc = None - if "doc" in _doc: + fields = None + if "fields" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("fields") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `fields`": _errors__.append( ValidationException( str(e), @@ -4701,13 +5217,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("fields") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4719,10 +5235,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `fields` field with value `{val}` " "is not valid because:", ) ) @@ -4730,9 +5246,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, + typedsl_Record_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -4777,7 +5293,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -4821,209 +5337,21 @@ def fromDoc( "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadContents`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadContents") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [e], - detailed_message=f"the `loadContents` field with value `{val}` " - "is not valid because:", - ) - ) - loadListing = None - if "loadListing" in _doc: + doc = None + if "doc" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("loadListing") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -5031,13 +5359,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadListing") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -5049,10 +5377,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `loadListing` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) @@ -5064,14 +5392,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `loadContents`, `loadListing`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -5082,14 +5410,10 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - doc=doc, + fields=fields, type_=type_, label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - format=format, - loadContents=loadContents, - loadListing=loadListing, + doc=doc, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5110,9 +5434,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=self.name, relative_uris=relative_uris ) if self.type_ is not None: r["type"] = save( @@ -5122,36 +5446,9 @@ def save( r["label"] = save( self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.format is not None: - u = save_relative_uri(self.format, self.name, True, None, relative_uris) - r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -5164,15 +5461,11 @@ def save( def __init__( self, - name: str, - type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, + type_: Record_name, + fields: None | Sequence[OutputRecordField] = None, label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5184,48 +5477,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name + self.fields = fields self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - [ - "doc", - "name", - "type", - "label", - "secondaryFiles", - "streamable", - "format", - "loadContents", - "loadListing", - ] + ["fields", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class InputRecordSchema(CWLRecordSchema): +class OutputEnumSchema(schema_salad.metaschema.EnumSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputRecordSchema): + if isinstance(other, OutputEnumSchema): return bool( - self.fields == other.fields + self.name == other.name + and self.symbols == other.symbols and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc - and self.name == other.name ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.doc, self.name)) + return hash((self.name, self.symbols, self.type_, self.label, self.doc)) @classmethod def fromDoc( @@ -5244,7 +5523,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -5296,60 +5575,61 @@ def fromDoc( name = "_:" + str(_uuid__.uuid4()) else: baseuri = name - fields = None - if "fields" in _doc: - try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader, - baseuri, - loadingOptions, - lc=_doc.get("fields") - ) + try: + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("symbols") + ) - if str(e) == "missing required field `fields`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `symbols`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("symbols") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("fields") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [e], - detailed_message=f"the `fields` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [e], + detailed_message=f"the `symbols` field with value `{val}` " + "is not valid because:", ) + ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Record_nameLoader_2, + typedsl_Enum_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -5394,7 +5674,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -5441,7 +5721,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -5493,14 +5773,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( k ), SourceLine(_doc, k, str), @@ -5511,7 +5791,7 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - fields=fields, + symbols=symbols, type_=type_, label=label, doc=doc, @@ -5535,10 +5815,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris @@ -5562,11 +5841,11 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[InputRecordField] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, - name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5578,34 +5857,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - ["fields", "type", "label", "doc", "name"] + ["name", "symbols", "type", "label", "doc"] ) @mypyc_attr(native_class=True) -class InputEnumSchema(EnumSchema): +class OutputArraySchema(CWLArraySchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputEnumSchema): + if isinstance(other, OutputArraySchema): return bool( - self.name == other.name - and self.symbols == other.symbols + self.items == other.items and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc + and self.name == other.name ) return False def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_, self.label, self.doc)) + return hash((self.items, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -5624,7 +5903,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -5677,21 +5956,21 @@ def fromDoc( else: baseuri = name try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None, baseuri, loadingOptions, - lc=_doc.get("symbols") + lc=_doc.get("items") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": + if str(e) == "missing required field `items`": _errors__.append( ValidationException( str(e), @@ -5699,13 +5978,13 @@ def fromDoc( ) ) else: - val = _doc.get("symbols") + val = _doc.get("items") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -5717,10 +5996,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), [e], - detailed_message=f"the `symbols` field with value `{val}` " + detailed_message=f"the `items` field with value `{val}` " "is not valid because:", ) ) @@ -5728,9 +6007,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Enum_nameLoader_2, + typedsl_Array_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -5775,7 +6054,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -5822,7 +6101,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -5874,14 +6153,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -5892,7 +6171,7 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - symbols=symbols, + items=items, type_=type_, label=label, doc=doc, @@ -5916,9 +6195,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u + if self.items is not None: + u = save_relative_uri(self.items, self.name, False, 2, relative_uris) + r["items"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris @@ -5942,11 +6221,11 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5958,34 +6237,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.items = items self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "doc"] + ["items", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class InputArraySchema(CWLArraySchema): - name: str +class InlineJavascriptRequirement(Saveable): + """ + Indicates that the workflow platform must support inline Javascript expressions. If this requirement is not present, the workflow platform must not perform expression interpolatation. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, InputArraySchema): + if isinstance(other, InlineJavascriptRequirement): return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - and self.name == other.name + self.class_ == other.class_ + and self.expressionLib == other.expressionLib ) return False def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.doc, self.name)) + return hash((self.class_, self.expressionLib)) @classmethod def fromDoc( @@ -6001,21 +6280,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_InlineJavascriptRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + expressionLib = None + if "expressionLib" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + expressionLib = _load_field( + _doc.get("expressionLib"), + union_of_None_type_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("expressionLib") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `expressionLib`": _errors__.append( ValidationException( str(e), @@ -6023,13 +6319,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("expressionLib") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `expressionLib` field is not valid because:", + SourceLine(_doc, "expressionLib", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6041,208 +6337,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `expressionLib` field is not valid because:", + SourceLine(_doc, "expressionLib", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `expressionLib` field with value `{val}` " "is not valid because:", ) ) @@ -6254,14 +6352,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `class`, `expressionLib`".format( k ), SourceLine(_doc, k, str), @@ -6271,15 +6369,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - items=items, - type_=type_, - label=label, - doc=doc, + expressionLib=expressionLib, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6293,23 +6386,22 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.items is not None: - u = save_relative_uri(self.items, self.name, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.expressionLib is not None: + r["expressionLib"] = save( + self.expressionLib, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -6322,11 +6414,7 @@ def save( def __init__( self, - items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, - type_: Array_name, - label: None | str = None, - doc: None | Sequence[str] | str = None, - name: None | str = None, + expressionLib: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -6338,46 +6426,26 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.class_: Final[str] = "InlineJavascriptRequirement" + self.expressionLib = expressionLib - attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "doc", "name"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @mypyc_attr(native_class=True) -class OutputRecordField(CWLRecordField): - name: str - +class SchemaDefRequirement(Saveable): + """ + This field consists of an array of type definitions which must be used when interpreting the ``inputs`` and ``outputs`` fields. When a ``type`` field contain a IRI, the implementation must check if the type is defined in ``schemaDefs`` and use that definition. If the type is not found in ``schemaDefs``, it is an error. The entries in ``schemaDefs`` must be processed in the order listed such that later schema definitions may refer to earlier schema definitions. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputRecordField): - return bool( - self.doc == other.doc - and self.name == other.name - and self.type_ == other.type_ - and self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.format == other.format - ) + if isinstance(other, SchemaDefRequirement): + return bool(self.class_ == other.class_ and self.types == other.types) return False def __hash__(self) -> int: - return hash( - ( - self.doc, - self.name, - self.type_, - self.label, - self.secondaryFiles, - self.streamable, - self.format, - ) - ) + return hash((self.class_, self.types)) @classmethod def fromDoc( @@ -6393,125 +6461,39 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("name") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "" - _errors__.append(ValidationException("missing name")) - else: - baseuri = name - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + class_ = _load_field( + _doc.get("class"), + uri_SchemaDefRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("types") is None: + raise ValidationException("missing required field `types`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, + types = _load_field( + _doc.get("types"), + array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("types") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `types`": _errors__.append( ValidationException( str(e), @@ -6519,13 +6501,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("types") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `types` field is not valid because:", + SourceLine(_doc, "types", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6537,169 +6519,187 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `types` field is not valid because:", + SourceLine(_doc, "types", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `types` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - str(e), - None + "invalid field `{}`, expected one of: `class`, `types`".format( + k + ), + SourceLine(_doc, k, str), ) ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + types=types, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `streamable`": + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.types is not None: + r["types"] = save( + self.types, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + + +@mypyc_attr(native_class=True) +class SecondaryFileSchema(Saveable): + def __eq__(self, other: Any) -> bool: + if isinstance(other, SecondaryFileSchema): + return bool( + self.pattern == other.pattern and self.required == other.required + ) + return False + + def __hash__(self) -> int: + return hash((self.pattern, self.required)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("pattern") is None: + raise ValidationException("missing required field `pattern`", None, []) + + pattern = _load_field( + _doc.get("pattern"), + union_of_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("pattern") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `pattern`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("pattern") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `pattern` field is not valid because:", + SourceLine(_doc, "pattern", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `pattern` field is not valid because:", + SourceLine(_doc, "pattern", str), + [e], + detailed_message=f"the `pattern` field with value `{val}` " + "is not valid because:", ) - format = None - if "format" in _doc: + ) + required = None + if "required" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + required = _load_field( + _doc.get("required"), + union_of_None_type_or_booltype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("required") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `required`": _errors__.append( ValidationException( str(e), @@ -6707,13 +6707,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("required") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `required` field is not valid because:", + SourceLine(_doc, "required", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6725,10 +6725,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `required` field is not valid because:", + SourceLine(_doc, "required", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `required` field with value `{val}` " "is not valid because:", ) ) @@ -6740,14 +6740,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`".format( + "invalid field `{}`, expected one of: `pattern`, `required`".format( k ), SourceLine(_doc, k, str), @@ -6757,17 +6757,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - doc=doc, - type_=type_, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - format=format, + pattern=pattern, + required=required, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6781,38 +6775,14 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.pattern is not None: + r["pattern"] = save( + self.pattern, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.required is not None: + r["required"] = save( + self.required, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.format is not None: - u = save_relative_uri(self.format, self.name, True, None, relative_uris) - r["format"] = u # top refers to the directory level if top: @@ -6824,13 +6794,8 @@ def save( def __init__( self, - name: str, - type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - format: None | str = None, + pattern: str, + required: None | bool | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -6842,36 +6807,28 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - - attrs: ClassVar[Collection[str]] = frozenset( - ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] - ) + self.pattern = pattern + self.required = required + + attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) @mypyc_attr(native_class=True) -class OutputRecordSchema(CWLRecordSchema): - name: str +class LoadListingRequirement(Saveable): + """ + Specify the desired behavior for loading the ``listing`` field of a Directory object for use by expressions. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputRecordSchema): + if isinstance(other, LoadListingRequirement): return bool( - self.fields == other.fields - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - and self.name == other.name + self.class_ == other.class_ and self.loadListing == other.loadListing ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.doc, self.name)) + return hash((self.class_, self.loadListing)) @classmethod def fromDoc( @@ -6887,218 +6844,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("name") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - fields = None - if "fields" in _doc: - try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader, - baseuri, - loadingOptions, - lc=_doc.get("fields") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `fields`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("fields") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [e], - detailed_message=f"the `fields` field with value `{val}` " - "is not valid because:", - ) - ) try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, + class_ = _load_field( + _doc.get("class"), + uri_LoadListingRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: + raise e + loadListing = None + if "loadListing" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("loadListing") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -7106,13 +6883,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7124,10 +6901,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " "is not valid because:", ) ) @@ -7139,14 +6916,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `class`, `loadListing`".format( k ), SourceLine(_doc, k, str), @@ -7156,15 +6933,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - fields=fields, - type_=type_, - label=label, - doc=doc, + loadListing=loadListing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7178,24 +6950,22 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -7208,11 +6978,7 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[OutputRecordField] = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - name: None | str = None, + loadListing: LoadListingEnum | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -7224,34 +6990,28 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.class_: Final[str] = "LoadListingRequirement" + self.loadListing = loadListing - attrs: ClassVar[Collection[str]] = frozenset( - ["fields", "type", "label", "doc", "name"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @mypyc_attr(native_class=True) -class OutputEnumSchema(EnumSchema): - name: str +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment by the workflow platform when executing the command line tool. May be the result of executing an expression, such as getting a parameter from input. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputEnumSchema): + if isinstance(other, EnvironmentDef): return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc + self.envName == other.envName and self.envValue == other.envValue ) return False def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_, self.label, self.doc)) + return hash((self.envName, self.envValue)) @classmethod def fromDoc( @@ -7267,77 +7027,22 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("name") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) + if _doc.get("envName") is None: + raise ValidationException("missing required field `envName`", None, []) - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, + envName = _load_field( + _doc.get("envName"), + strtype, baseuri, loadingOptions, - lc=_doc.get("symbols") + lc=_doc.get("envName") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": + if str(e) == "missing required field `envName`": _errors__.append( ValidationException( str(e), @@ -7345,13 +7050,13 @@ def fromDoc( ) ) else: - val = _doc.get("symbols") + val = _doc.get("envName") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), + "the `envName` field is not valid because:", + SourceLine(_doc, "envName", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7363,29 +7068,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), + "the `envName` field is not valid because:", + SourceLine(_doc, "envName", str), [e], - detailed_message=f"the `symbols` field with value `{val}` " + detailed_message=f"the `envName` field with value `{val}` " "is not valid because:", ) ) try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("envValue") is None: + raise ValidationException("missing required field `envValue`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, + envValue = _load_field( + _doc.get("envValue"), + union_of_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("envValue") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `envValue`": _errors__.append( ValidationException( str(e), @@ -7393,13 +7098,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("envValue") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `envValue` field is not valid because:", + SourceLine(_doc, "envValue", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7411,107 +7116,13 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `envValue` field is not valid because:", + SourceLine(_doc, "envValue", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `envValue` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -7520,14 +7131,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( + "invalid field `{}`, expected one of: `envName`, `envValue`".format( k ), SourceLine(_doc, k, str), @@ -7537,15 +7148,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - label=label, - doc=doc, + envName=envName, + envValue=envValue, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7559,23 +7166,13 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + if self.envName is not None: + r["envName"] = save( + self.envName, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.envValue is not None: + r["envValue"] = save( + self.envValue, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -7588,11 +7185,8 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, + envName: str, + envValue: str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -7604,34 +7198,62 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc + self.envName = envName + self.envValue = envValue - attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "doc"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @mypyc_attr(native_class=True) -class OutputArraySchema(CWLArraySchema): - name: str +class CommandLineBinding(InputBinding): + """ + When listed under ``inputBinding`` in the input schema, the term "value" refers to the the corresponding value in the input object. For binding objects listed in ``CommandLineTool.arguments``, the term "value" refers to the effective value after evaluating ``valueFrom``. + + The binding behavior when building the command line depends on the data type of the value. If there is a mismatch between the type described by the input schema and the effective value, such as resulting from an expression evaluation, an implementation must use the data type of the effective value. + + - **string**: Add ``prefix`` and the string to the command line. + + - **number**: Add ``prefix`` and decimal representation to command line. + + - **boolean**: If true, add ``prefix`` to the command line. If false, add nothing. + + - **File**: Add ``prefix`` and the value of ```File.path`` <#File>`__ to the command line. + + - **Directory**: Add ``prefix`` and the value of ```Directory.path`` <#Directory>`__ to the command line. + + - **array**: If ``itemSeparator`` is specified, add ``prefix`` and the join the array into a single string with ``itemSeparator`` separating the items. Otherwise first add ``prefix``, then recursively process individual elements. If the array is empty, it does not add anything to command line. + + - **object**: Add ``prefix`` only, and recursively add object fields for which ``inputBinding`` is specified. + + - **null**: Add nothing. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputArraySchema): + if isinstance(other, CommandLineBinding): return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - and self.name == other.name + self.loadContents == other.loadContents + and self.position == other.position + and self.prefix == other.prefix + and self.separate == other.separate + and self.itemSeparator == other.itemSeparator + and self.valueFrom == other.valueFrom + and self.shellQuote == other.shellQuote ) return False def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.doc, self.name)) + return hash( + ( + self.loadContents, + self.position, + self.prefix, + self.separate, + self.itemSeparator, + self.valueFrom, + self.shellQuote, + ) + ) @classmethod def fromDoc( @@ -7647,21 +7269,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + loadContents = None + if "loadContents" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("loadContents") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( str(e), @@ -7669,13 +7291,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("loadContents") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7687,132 +7309,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `loadContents` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: + position = None + if "position" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + position = _load_field( + _doc.get("position"), + union_of_None_type_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("position") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `position`": _errors__.append( ValidationException( str(e), @@ -7820,13 +7338,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("position") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `position` field is not valid because:", + SourceLine(_doc, "position", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7838,28 +7356,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `position` field is not valid because:", + SourceLine(_doc, "position", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `position` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + prefix = None + if "prefix" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + prefix = _load_field( + _doc.get("prefix"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("prefix") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `prefix`": _errors__.append( ValidationException( str(e), @@ -7867,13 +7385,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("prefix") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `prefix` field is not valid because:", + SourceLine(_doc, "prefix", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7885,10 +7403,198 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `prefix` field is not valid because:", + SourceLine(_doc, "prefix", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `prefix` field with value `{val}` " + "is not valid because:", + ) + ) + separate = None + if "separate" in _doc: + try: + separate = _load_field( + _doc.get("separate"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("separate") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `separate`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("separate") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `separate` field is not valid because:", + SourceLine(_doc, "separate", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `separate` field is not valid because:", + SourceLine(_doc, "separate", str), + [e], + detailed_message=f"the `separate` field with value `{val}` " + "is not valid because:", + ) + ) + itemSeparator = None + if "itemSeparator" in _doc: + try: + itemSeparator = _load_field( + _doc.get("itemSeparator"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("itemSeparator") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `itemSeparator`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("itemSeparator") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `itemSeparator` field is not valid because:", + SourceLine(_doc, "itemSeparator", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `itemSeparator` field is not valid because:", + SourceLine(_doc, "itemSeparator", str), + [e], + detailed_message=f"the `itemSeparator` field with value `{val}` " + "is not valid because:", + ) + ) + valueFrom = None + if "valueFrom" in _doc: + try: + valueFrom = _load_field( + _doc.get("valueFrom"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("valueFrom") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `valueFrom`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("valueFrom") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), + [e], + detailed_message=f"the `valueFrom` field with value `{val}` " + "is not valid because:", + ) + ) + shellQuote = None + if "shellQuote" in _doc: + try: + shellQuote = _load_field( + _doc.get("shellQuote"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("shellQuote") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `shellQuote`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("shellQuote") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `shellQuote` field is not valid because:", + SourceLine(_doc, "shellQuote", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `shellQuote` field is not valid because:", + SourceLine(_doc, "shellQuote", str), + [e], + detailed_message=f"the `shellQuote` field with value `{val}` " "is not valid because:", ) ) @@ -7900,14 +7606,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `loadContents`, `position`, `prefix`, `separate`, `itemSeparator`, `valueFrom`, `shellQuote`".format( k ), SourceLine(_doc, k, str), @@ -7917,15 +7623,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - items=items, - type_=type_, - label=label, - doc=doc, + loadContents=loadContents, + position=position, + prefix=prefix, + separate=separate, + itemSeparator=itemSeparator, + valueFrom=valueFrom, + shellQuote=shellQuote, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7939,23 +7646,45 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.items is not None: - u = save_relative_uri(self.items, self.name, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + if self.position is not None: + r["position"] = save( + self.position, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.prefix is not None: + r["prefix"] = save( + self.prefix, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.separate is not None: + r["separate"] = save( + self.separate, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.itemSeparator is not None: + r["itemSeparator"] = save( + self.itemSeparator, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.valueFrom is not None: + r["valueFrom"] = save( + self.valueFrom, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.shellQuote is not None: + r["shellQuote"] = save( + self.shellQuote, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -7968,11 +7697,13 @@ def save( def __init__( self, - items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - type_: Array_name, - label: None | str = None, - doc: None | Sequence[str] | str = None, - name: None | str = None, + loadContents: None | bool = None, + position: None | i32 | str = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -7984,36 +7715,53 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "doc", "name"] + [ + "loadContents", + "position", + "prefix", + "separate", + "itemSeparator", + "valueFrom", + "shellQuote", + ] ) @mypyc_attr(native_class=True) -class InlineJavascriptRequirement(Saveable): +class CommandOutputBinding(Saveable): """ - Indicates that the workflow platform must support inline Javascript expressions. - If this requirement is not present, the workflow platform must not perform expression - interpolatation. + Describes how to generate an output parameter based on the files produced by a CommandLineTool. + + The output parameter value is generated by applying these operations in the following order: + + - glob + - loadContents + - outputEval + - secondaryFiles """ def __eq__(self, other: Any) -> bool: - if isinstance(other, InlineJavascriptRequirement): + if isinstance(other, CommandOutputBinding): return bool( - self.class_ == other.class_ - and self.expressionLib == other.expressionLib + self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.glob == other.glob + and self.outputEval == other.outputEval ) return False def __hash__(self) -> int: - return hash((self.class_, self.expressionLib)) + return hash((self.loadContents, self.loadListing, self.glob, self.outputEval)) @classmethod def fromDoc( @@ -8029,37 +7777,68 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) - class_ = load_field( - _doc.get("class"), - uri_InlineJavascriptRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - expressionLib = None - if "expressionLib" in _doc: + if str(e) == "missing required field `loadContents`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) + loadListing = None + if "loadListing" in _doc: try: - expressionLib = load_field( - _doc.get("expressionLib"), - union_of_None_type_or_array_of_strtype, + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, baseuri, loadingOptions, - lc=_doc.get("expressionLib") + lc=_doc.get("loadListing") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `expressionLib`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -8067,13 +7846,13 @@ def fromDoc( ) ) else: - val = _doc.get("expressionLib") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `expressionLib` field is not valid because:", - SourceLine(_doc, "expressionLib", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8085,10 +7864,104 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `expressionLib` field is not valid because:", - SourceLine(_doc, "expressionLib", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `expressionLib` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " + "is not valid because:", + ) + ) + glob = None + if "glob" in _doc: + try: + glob = _load_field( + _doc.get("glob"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("glob") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `glob`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("glob") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `glob` field is not valid because:", + SourceLine(_doc, "glob", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `glob` field is not valid because:", + SourceLine(_doc, "glob", str), + [e], + detailed_message=f"the `glob` field with value `{val}` " + "is not valid because:", + ) + ) + outputEval = None + if "outputEval" in _doc: + try: + outputEval = _load_field( + _doc.get("outputEval"), + union_of_None_type_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputEval") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputEval`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outputEval") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputEval` field is not valid because:", + SourceLine(_doc, "outputEval", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputEval` field is not valid because:", + SourceLine(_doc, "outputEval", str), + [e], + detailed_message=f"the `outputEval` field with value `{val}` " "is not valid because:", ) ) @@ -8100,14 +7973,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `expressionLib`".format( + "invalid field `{}`, expected one of: `loadContents`, `loadListing`, `glob`, `outputEval`".format( k ), SourceLine(_doc, k, str), @@ -8117,7 +7990,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - expressionLib=expressionLib, + loadContents=loadContents, + loadListing=loadListing, + glob=glob, + outputEval=outputEval, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -8134,17 +8010,27 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.expressionLib is not None: - r["expressionLib"] = save( - self.expressionLib, + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.glob is not None: + r["glob"] = save( + self.glob, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.outputEval is not None: + r["outputEval"] = save( + self.outputEval, top=False, base_url=base_url, relative_uris=relative_uris, @@ -8160,7 +8046,10 @@ def save( def __init__( self, - expressionLib: None | Sequence[str] = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + glob: None | Sequence[str] | str = None, + outputEval: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8172,32 +8061,51 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.loadContents = loadContents + self.loadListing = loadListing + self.glob = glob + self.outputEval = outputEval - attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["loadContents", "loadListing", "glob", "outputEval"] + ) @mypyc_attr(native_class=True) -class SchemaDefRequirement(Saveable): - """ - This field consists of an array of type definitions which must be used when - interpreting the `inputs` and `outputs` fields. When a `type` field - contain a IRI, the implementation must check if the type is defined in - `schemaDefs` and use that definition. If the type is not found in - `schemaDefs`, it is an error. The entries in `schemaDefs` must be - processed in the order listed such that later schema definitions may refer - to earlier schema definitions. - - """ +class CommandInputRecordField(InputRecordField): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, SchemaDefRequirement): - return bool(self.class_ == other.class_ and self.types == other.types) + if isinstance(other, CommandInputRecordField): + return bool( + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.format == other.format + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.inputBinding == other.inputBinding + ) return False def __hash__(self) -> int: - return hash((self.class_, self.types)) + return hash( + ( + self.doc, + self.name, + self.type_, + self.label, + self.secondaryFiles, + self.streamable, + self.format, + self.loadContents, + self.loadListing, + self.inputBinding, + ) + ) @classmethod def fromDoc( @@ -8213,38 +8121,125 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) - class_ = load_field( - _doc.get("class"), - uri_SchemaDefRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + if str(e) == "missing required field `name`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("types") is None: - raise ValidationException("missing required field `types`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - types = load_field( - _doc.get("types"), - array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader, + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, - lc=_doc.get("types") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `types`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -8252,13 +8247,13 @@ def fromDoc( ) ) else: - val = _doc.get("types") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `types` field is not valid because:", - SourceLine(_doc, "types", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8270,185 +8265,169 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `types` field is not valid because:", - SourceLine(_doc, "types", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `types` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `types`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) + else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - types=types, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.types is not None: - r["types"] = save( - self.types, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema], - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SchemaDefRequirement" - self.types = types - - attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) - - -@mypyc_attr(native_class=True) -class SecondaryFileSchema(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, SecondaryFileSchema): - return bool( - self.pattern == other.pattern and self.required == other.required - ) - return False - - def __hash__(self) -> int: - return hash((self.pattern, self.required)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("pattern") is None: - raise ValidationException("missing required field `pattern`", None, []) - - pattern = load_field( - _doc.get("pattern"), - union_of_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("pattern") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `pattern`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("pattern") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( - "the `pattern` field is not valid because:", - SourceLine(_doc, "pattern", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `pattern` field is not valid because:", - SourceLine(_doc, "pattern", str), - [e], - detailed_message=f"the `pattern` field with value `{val}` " - "is not valid because:", + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - required = None - if "required" in _doc: + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: try: - required = load_field( - _doc.get("required"), - union_of_None_type_or_booltype_or_ExpressionLoader, + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, - lc=_doc.get("required") + lc=_doc.get("format") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `required`": + if str(e) == "missing required field `format`": _errors__.append( ValidationException( str(e), @@ -8456,13 +8435,13 @@ def fromDoc( ) ) else: - val = _doc.get("required") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `required` field is not valid because:", - SourceLine(_doc, "required", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8474,146 +8453,64 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `required` field is not valid because:", - SourceLine(_doc, "required", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `required` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `pattern`, `required`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - pattern=pattern, - required=required, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.pattern is not None: - r["pattern"] = save( - self.pattern, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.required is not None: - r["required"] = save( - self.required, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - pattern: str, - required: None | bool | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required - - attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) - - -@mypyc_attr(native_class=True) -class LoadListingRequirement(Saveable): - """ - Specify the desired behavior for loading the `listing` field of - a Directory object for use by expressions. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, LoadListingRequirement): - return bool( - self.class_ == other.class_ and self.loadListing == other.loadListing - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.loadListing)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_LoadListingRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) loadListing = None if "loadListing" in _doc: try: - loadListing = load_field( + loadListing = _load_field( _doc.get("loadListing"), union_of_None_type_or_LoadListingEnumLoader, baseuri, @@ -8657,6 +8554,53 @@ def fromDoc( "is not valid because:", ) ) + inputBinding = None + if "inputBinding" in _doc: + try: + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [e], + detailed_message=f"the `inputBinding` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -8665,14 +8609,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `loadListing`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `loadContents`, `loadListing`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -8682,10 +8626,20 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, + doc=doc, + type_=type_, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + format=format, + loadContents=loadContents, loadListing=loadListing, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -8699,19 +8653,57 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.format is not None: + u = save_relative_uri(self.format, self.name, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) if self.loadListing is not None: r["loadListing"] = save( self.loadListing, top=False, - base_url=base_url, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.name, relative_uris=relative_uris, ) @@ -8725,7 +8717,16 @@ def save( def __init__( self, + name: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, loadListing: LoadListingEnum | None = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8737,30 +8738,60 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "LoadListingRequirement" + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents self.loadListing = loadListing + self.inputBinding = inputBinding - attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) - - -@mypyc_attr(native_class=True) -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, EnvironmentDef): - return bool( - self.envName == other.envName and self.envValue == other.envValue - ) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "doc", + "name", + "type", + "label", + "secondaryFiles", + "streamable", + "format", + "loadContents", + "loadListing", + "inputBinding", + ] + ) + + +@mypyc_attr(native_class=True) +class CommandInputRecordSchema(InputRecordSchema): + name: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, CommandInputRecordSchema): + return bool( + self.fields == other.fields + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.name == other.name + and self.inputBinding == other.inputBinding + ) return False def __hash__(self) -> int: - return hash((self.envName, self.envValue)) + return hash( + ( + self.fields, + self.type_, + self.label, + self.doc, + self.name, + self.inputBinding, + ) + ) @classmethod def fromDoc( @@ -8776,70 +8807,124 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("envName") is None: - raise ValidationException("missing required field `envName`", None, []) - - envName = load_field( - _doc.get("envName"), - strtype, - baseuri, - loadingOptions, - lc=_doc.get("envName") - ) + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `envName`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("envName") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `name`": _errors__.append( ValidationException( - "the `envName` field is not valid because:", - SourceLine(_doc, "envName", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + fields = None + if "fields" in _doc: + try: + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader, + baseuri, + loadingOptions, + lc=_doc.get("fields") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `fields`": _errors__.append( ValidationException( - "the `envName` field is not valid because:", - SourceLine(_doc, "envName", str), - [e], - detailed_message=f"the `envName` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) + else: + val = _doc.get("fields") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [e], + detailed_message=f"the `fields` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("envValue") is None: - raise ValidationException("missing required field `envValue`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - envValue = load_field( - _doc.get("envValue"), - union_of_strtype_or_ExpressionLoader, + type_ = _load_field( + _doc.get("type"), + typedsl_Record_nameLoader_2, baseuri, loadingOptions, - lc=_doc.get("envValue") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `envValue`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -8847,13 +8932,13 @@ def fromDoc( ) ) else: - val = _doc.get("envValue") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `envValue` field is not valid because:", - SourceLine(_doc, "envValue", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8865,29 +8950,170 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `envValue` field is not valid because:", - SourceLine(_doc, "envValue", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `envValue` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `envName`, `envValue`".format( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) + inputBinding = None + if "inputBinding" in _doc: + try: + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [e], + detailed_message=f"the `inputBinding` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -8897,11 +9123,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - envName=envName, - envValue=envValue, + name=name, + fields=fields, + type_=type_, + label=label, + doc=doc, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -8915,13 +9146,31 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.envName is not None: - r["envName"] = save( - self.envName, top=False, base_url=base_url, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.envValue is not None: - r["envValue"] = save( - self.envValue, top=False, base_url=base_url, relative_uris=relative_uris + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.name, + relative_uris=relative_uris, ) # top refers to the directory level @@ -8934,8 +9183,12 @@ def save( def __init__( self, - envName: str, - envValue: str, + type_: Record_name, + fields: None | Sequence[CommandInputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8947,76 +9200,43 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding - attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name", "inputBinding"] + ) @mypyc_attr(native_class=True) -class CommandLineBinding(InputBinding): - """ - - When listed under `inputBinding` in the input schema, the term - "value" refers to the the corresponding value in the input object. For - binding objects listed in `CommandLineTool.arguments`, the term "value" - refers to the effective value after evaluating `valueFrom`. - - The binding behavior when building the command line depends on the data - type of the value. If there is a mismatch between the type described by - the input schema and the effective value, such as resulting from an - expression evaluation, an implementation must use the data type of the - effective value. - - - **string**: Add `prefix` and the string to the command line. - - - **number**: Add `prefix` and decimal representation to command line. - - - **boolean**: If true, add `prefix` to the command line. If false, add - nothing. - - - **File**: Add `prefix` and the value of - [`File.path`](#File) to the command line. - - - **Directory**: Add `prefix` and the value of - [`Directory.path`](#Directory) to the command line. - - - **array**: If `itemSeparator` is specified, add `prefix` and the join - the array into a single string with `itemSeparator` separating the - items. Otherwise first add `prefix`, then recursively process - individual elements. - If the array is empty, it does not add anything to command line. - - - **object**: Add `prefix` only, and recursively add object fields for - which `inputBinding` is specified. - - - **null**: Add nothing. - - """ +class CommandInputEnumSchema(InputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandLineBinding): + if isinstance(other, CommandInputEnumSchema): return bool( - self.loadContents == other.loadContents - and self.position == other.position - and self.prefix == other.prefix - and self.separate == other.separate - and self.itemSeparator == other.itemSeparator - and self.valueFrom == other.valueFrom - and self.shellQuote == other.shellQuote + self.name == other.name + and self.symbols == other.symbols + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: return hash( ( - self.loadContents, - self.position, - self.prefix, - self.separate, - self.itemSeparator, - self.valueFrom, - self.shellQuote, + self.name, + self.symbols, + self.type_, + self.label, + self.doc, + self.inputBinding, ) ) @@ -9034,21 +9254,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - loadContents = None - if "loadContents" in _doc: + name = None + if "name" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -9056,13 +9276,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9074,169 +9294,132 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - position = None - if "position" in _doc: - try: - position = load_field( - _doc.get("position"), - union_of_None_type_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("position") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + try: + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) - if str(e) == "missing required field `position`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("position") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `position` field is not valid because:", - SourceLine(_doc, "position", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `position` field is not valid because:", - SourceLine(_doc, "position", str), - [e], - detailed_message=f"the `position` field with value `{val}` " - "is not valid because:", - ) - ) - prefix = None - if "prefix" in _doc: - try: - prefix = load_field( - _doc.get("prefix"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("prefix") - ) + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("symbols") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `prefix`": + if str(e) == "missing required field `symbols`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("symbols") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("prefix") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `prefix` field is not valid because:", - SourceLine(_doc, "prefix", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `prefix` field is not valid because:", - SourceLine(_doc, "prefix", str), - [e], - detailed_message=f"the `prefix` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [e], + detailed_message=f"the `symbols` field with value `{val}` " + "is not valid because:", ) - separate = None - if "separate" in _doc: - try: - separate = load_field( - _doc.get("separate"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("separate") - ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + type_ = _load_field( + _doc.get("type"), + typedsl_Enum_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) - if str(e) == "missing required field `separate`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("separate") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `separate` field is not valid because:", - SourceLine(_doc, "separate", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `separate` field is not valid because:", - SourceLine(_doc, "separate", str), - [e], - detailed_message=f"the `separate` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", ) - itemSeparator = None - if "itemSeparator" in _doc: + ) + label = None + if "label" in _doc: try: - itemSeparator = load_field( - _doc.get("itemSeparator"), + label = _load_field( + _doc.get("label"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("itemSeparator") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `itemSeparator`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -9244,13 +9427,13 @@ def fromDoc( ) ) else: - val = _doc.get("itemSeparator") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `itemSeparator` field is not valid because:", - SourceLine(_doc, "itemSeparator", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9262,28 +9445,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `itemSeparator` field is not valid because:", - SourceLine(_doc, "itemSeparator", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `itemSeparator` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - valueFrom = None - if "valueFrom" in _doc: + doc = None + if "doc" in _doc: try: - valueFrom = load_field( - _doc.get("valueFrom"), - union_of_None_type_or_strtype_or_ExpressionLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("valueFrom") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `valueFrom`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -9291,13 +9474,13 @@ def fromDoc( ) ) else: - val = _doc.get("valueFrom") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9309,28 +9492,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `valueFrom` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - shellQuote = None - if "shellQuote" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - shellQuote = load_field( - _doc.get("shellQuote"), - union_of_None_type_or_booltype, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("shellQuote") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `shellQuote`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -9338,13 +9521,13 @@ def fromDoc( ) ) else: - val = _doc.get("shellQuote") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `shellQuote` field is not valid because:", - SourceLine(_doc, "shellQuote", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9356,10 +9539,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `shellQuote` field is not valid because:", - SourceLine(_doc, "shellQuote", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `shellQuote` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -9371,14 +9554,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `loadContents`, `position`, `prefix`, `separate`, `itemSeparator`, `valueFrom`, `shellQuote`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -9388,16 +9571,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - loadContents=loadContents, - position=position, - prefix=prefix, - separate=separate, - itemSeparator=itemSeparator, - valueFrom=valueFrom, - shellQuote=shellQuote, + name=name, + symbols=symbols, + type_=type_, + label=label, + doc=doc, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -9411,44 +9594,29 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.position is not None: - r["position"] = save( - self.position, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.prefix is not None: - r["prefix"] = save( - self.prefix, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.separate is not None: - r["separate"] = save( - self.separate, top=False, base_url=base_url, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.itemSeparator is not None: - r["itemSeparator"] = save( - self.itemSeparator, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.valueFrom is not None: - r["valueFrom"] = save( - self.valueFrom, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.shellQuote is not None: - r["shellQuote"] = save( - self.shellQuote, + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, top=False, - base_url=base_url, + base_url=self.name, relative_uris=relative_uris, ) @@ -9462,13 +9630,12 @@ def save( def __init__( self, - loadContents: None | bool = None, - position: None | i32 | str = None, - prefix: None | str = None, - separate: None | bool = None, - itemSeparator: None | str = None, - valueFrom: None | str = None, - shellQuote: None | bool = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -9480,55 +9647,38 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - [ - "loadContents", - "position", - "prefix", - "separate", - "itemSeparator", - "valueFrom", - "shellQuote", - ] + ["name", "symbols", "type", "label", "doc", "inputBinding"] ) @mypyc_attr(native_class=True) -class CommandOutputBinding(Saveable): - """ - Describes how to generate an output parameter based on the files produced - by a CommandLineTool. - - The output parameter value is generated by applying these operations in the - following order: - - - glob - - loadContents - - outputEval - - secondaryFiles - - """ +class CommandInputArraySchema(InputArraySchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputBinding): + if isinstance(other, CommandInputArraySchema): return bool( - self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.glob == other.glob - and self.outputEval == other.outputEval + self.items == other.items + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.name == other.name + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash((self.loadContents, self.loadListing, self.glob, self.outputEval)) + return hash( + (self.items, self.type_, self.label, self.doc, self.name, self.inputBinding) + ) @classmethod def fromDoc( @@ -9544,21 +9694,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - loadContents = None - if "loadContents" in _doc: + name = None + if "name" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -9566,13 +9716,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9584,28 +9734,132 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - loadListing = None - if "loadListing" in _doc: + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) + + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("loadListing") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -9613,13 +9867,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadListing") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9631,28 +9885,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `loadListing` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - glob = None - if "glob" in _doc: + doc = None + if "doc" in _doc: try: - glob = load_field( - _doc.get("glob"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("glob") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `glob`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -9660,13 +9914,13 @@ def fromDoc( ) ) else: - val = _doc.get("glob") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `glob` field is not valid because:", - SourceLine(_doc, "glob", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9678,28 +9932,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `glob` field is not valid because:", - SourceLine(_doc, "glob", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `glob` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - outputEval = None - if "outputEval" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - outputEval = load_field( - _doc.get("outputEval"), - union_of_None_type_or_ExpressionLoader, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("outputEval") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputEval`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -9707,13 +9961,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputEval") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputEval` field is not valid because:", - SourceLine(_doc, "outputEval", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9725,10 +9979,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputEval` field is not valid because:", - SourceLine(_doc, "outputEval", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `outputEval` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -9740,14 +9994,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `loadContents`, `loadListing`, `glob`, `outputEval`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -9757,13 +10011,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - loadContents=loadContents, - loadListing=loadListing, - glob=glob, - outputEval=outputEval, + name=name, + items=items, + type_=type_, + label=label, + doc=doc, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -9777,29 +10034,29 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.items is not None: + u = save_relative_uri(self.items, self.name, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.glob is not None: - r["glob"] = save( - self.glob, top=False, base_url=base_url, relative_uris=relative_uris + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.outputEval is not None: - r["outputEval"] = save( - self.outputEval, + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, top=False, - base_url=base_url, + base_url=self.name, relative_uris=relative_uris, ) @@ -9813,10 +10070,12 @@ def save( def __init__( self, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - glob: None | Sequence[str] | str = None, - outputEval: None | str = None, + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -9828,22 +10087,24 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["loadContents", "loadListing", "glob", "outputEval"] + ["items", "type", "label", "doc", "name", "inputBinding"] ) @mypyc_attr(native_class=True) -class CommandInputRecordField(InputRecordField): +class CommandOutputRecordField(OutputRecordField): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputRecordField): + if isinstance(other, CommandOutputRecordField): return bool( self.doc == other.doc and self.name == other.name @@ -9852,9 +10113,7 @@ def __eq__(self, other: Any) -> bool: and self.secondaryFiles == other.secondaryFiles and self.streamable == other.streamable and self.format == other.format - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.inputBinding == other.inputBinding + and self.outputBinding == other.outputBinding ) return False @@ -9868,9 +10127,7 @@ def __hash__(self) -> int: self.secondaryFiles, self.streamable, self.format, - self.loadContents, - self.loadListing, - self.inputBinding, + self.outputBinding, ) ) @@ -9891,7 +10148,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_strtype_True_False_None_None, baseuri, @@ -9947,7 +10204,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -9995,9 +10252,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, + typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -10042,7 +10299,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -10089,7 +10346,7 @@ def fromDoc( secondaryFiles = None if "secondaryFiles" in _doc: try: - secondaryFiles = load_field( + secondaryFiles = _load_field( _doc.get("secondaryFiles"), secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, @@ -10136,7 +10393,7 @@ def fromDoc( streamable = None if "streamable" in _doc: try: - streamable = load_field( + streamable = _load_field( _doc.get("streamable"), union_of_None_type_or_booltype, baseuri, @@ -10183,9 +10440,9 @@ def fromDoc( format = None if "format" in _doc: try: - format = load_field( + format = _load_field( _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, lc=_doc.get("format") @@ -10227,21 +10484,21 @@ def fromDoc( "is not valid because:", ) ) - loadContents = None - if "loadContents" in _doc: + outputBinding = None + if "outputBinding" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -10249,13 +10506,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10267,126 +10524,32 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) - loadListing = None - if "loadListing" in _doc: - try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, - baseuri, - loadingOptions, - lc=_doc.get("loadListing") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadListing`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("loadListing") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [e], - detailed_message=f"the `loadListing` field with value `{val}` " - "is not valid because:", - ) - ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `loadContents`, `loadListing`, `inputBinding`".format( - k - ), - SourceLine(_doc, k, str), + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `outputBinding`".format( + k + ), + SourceLine(_doc, k, str), ) ) @@ -10400,9 +10563,7 @@ def fromDoc( secondaryFiles=secondaryFiles, streamable=streamable, format=format, - loadContents=loadContents, - loadListing=loadListing, - inputBinding=inputBinding, + outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -10452,23 +10613,9 @@ def save( if self.format is not None: u = save_relative_uri(self.format, self.name, True, None, relative_uris) r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, top=False, base_url=self.name, relative_uris=relative_uris, @@ -10485,15 +10632,13 @@ def save( def __init__( self, name: str, - type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, label: None | str = None, secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, streamable: None | bool = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - inputBinding: CommandLineBinding | None = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -10512,9 +10657,7 @@ def __init__( self.secondaryFiles = secondaryFiles self.streamable = streamable self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.inputBinding = inputBinding + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( [ @@ -10525,40 +10668,28 @@ def __init__( "secondaryFiles", "streamable", "format", - "loadContents", - "loadListing", - "inputBinding", + "outputBinding", ] ) @mypyc_attr(native_class=True) -class CommandInputRecordSchema(InputRecordSchema): +class CommandOutputRecordSchema(OutputRecordSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputRecordSchema): + if isinstance(other, CommandOutputRecordSchema): return bool( self.fields == other.fields and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc and self.name == other.name - and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash( - ( - self.fields, - self.type_, - self.label, - self.doc, - self.name, - self.inputBinding, - ) - ) + return hash((self.fields, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -10577,7 +10708,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -10632,9 +10763,9 @@ def fromDoc( fields = None if "fields" in _doc: try: - fields = load_field( + fields = _load_field( _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader, + idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, baseuri, loadingOptions, lc=_doc.get("fields") @@ -10680,7 +10811,7 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), typedsl_Record_nameLoader_2, baseuri, @@ -10727,7 +10858,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -10774,7 +10905,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -10818,53 +10949,6 @@ def fromDoc( "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -10873,14 +10957,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`, `inputBinding`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -10895,7 +10979,6 @@ def fromDoc( type_=type_, label=label, doc=doc, - inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -10932,13 +11015,6 @@ def save( r["doc"] = save( self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -10951,11 +11027,10 @@ def save( def __init__( self, type_: Record_name, - fields: None | Sequence[CommandInputRecordField] = None, + fields: None | Sequence[CommandOutputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, - inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -10972,40 +11047,29 @@ def __init__( self.label = label self.doc = doc self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["fields", "type", "label", "doc", "name", "inputBinding"] + ["fields", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class CommandInputEnumSchema(InputEnumSchema): +class CommandOutputEnumSchema(OutputEnumSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputEnumSchema): + if isinstance(other, CommandOutputEnumSchema): return bool( self.name == other.name and self.symbols == other.symbols and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc - and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash( - ( - self.name, - self.symbols, - self.type_, - self.label, - self.doc, - self.inputBinding, - ) - ) + return hash((self.name, self.symbols, self.type_, self.label, self.doc)) @classmethod def fromDoc( @@ -11024,7 +11088,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -11080,7 +11144,7 @@ def fromDoc( if _doc.get("symbols") is None: raise ValidationException("missing required field `symbols`", None, []) - symbols = load_field( + symbols = _load_field( _doc.get("symbols"), uri_array_of_strtype_True_False_None_None, baseuri, @@ -11128,7 +11192,7 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), typedsl_Enum_nameLoader_2, baseuri, @@ -11175,7 +11239,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -11222,7 +11286,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -11266,53 +11330,6 @@ def fromDoc( "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -11321,14 +11338,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`, `inputBinding`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( k ), SourceLine(_doc, k, str), @@ -11343,7 +11360,6 @@ def fromDoc( type_=type_, label=label, doc=doc, - inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -11379,13 +11395,6 @@ def save( r["doc"] = save( self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -11402,7 +11411,6 @@ def __init__( name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, - inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -11419,33 +11427,29 @@ def __init__( self.type_ = type_ self.label = label self.doc = doc - self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "doc", "inputBinding"] + ["name", "symbols", "type", "label", "doc"] ) @mypyc_attr(native_class=True) -class CommandInputArraySchema(InputArraySchema): +class CommandOutputArraySchema(OutputArraySchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputArraySchema): + if isinstance(other, CommandOutputArraySchema): return bool( self.items == other.items and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc and self.name == other.name - and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash( - (self.items, self.type_, self.label, self.doc, self.name, self.inputBinding) - ) + return hash((self.items, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -11464,7 +11468,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -11520,9 +11524,9 @@ def fromDoc( if _doc.get("items") is None: raise ValidationException("missing required field `items`", None, []) - items = load_field( + items = _load_field( _doc.get("items"), - uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None, + uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None, baseuri, loadingOptions, lc=_doc.get("items") @@ -11568,7 +11572,7 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), typedsl_Array_nameLoader_2, baseuri, @@ -11615,7 +11619,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -11662,7 +11666,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -11706,69 +11710,22 @@ def fromDoc( "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`, `inputBinding`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -11783,7 +11740,6 @@ def fromDoc( type_=type_, label=label, doc=doc, - inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -11819,13 +11775,6 @@ def save( r["doc"] = save( self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -11837,12 +11786,11 @@ def save( def __init__( self, - items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, name: None | str = None, - inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -11859,42 +11807,52 @@ def __init__( self.label = label self.doc = doc self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "doc", "name", "inputBinding"] + ["items", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class CommandOutputRecordField(OutputRecordField): - name: str +class CommandInputParameter(Saveable): + """ + An input parameter for a CommandLineTool. + + """ + + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputRecordField): + if isinstance(other, CommandInputParameter): return bool( - self.doc == other.doc - and self.name == other.name - and self.type_ == other.type_ - and self.label == other.label + self.label == other.label and self.secondaryFiles == other.secondaryFiles and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id and self.format == other.format - and self.outputBinding == other.outputBinding + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.default == other.default + and self.type_ == other.type_ + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: return hash( ( - self.doc, - self.name, - self.type_, self.label, self.secondaryFiles, self.streamable, + self.doc, + self.id, self.format, - self.outputBinding, + self.loadContents, + self.loadListing, + self.default, + self.type_, + self.inputBinding, ) ) @@ -11912,21 +11870,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + id = None + if "id" in _doc: try: - name = load_field( - _doc.get("name"), + id = _load_field( + _doc.get("id"), uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -11934,13 +11892,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11952,121 +11910,26 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - if name is None: + if id is None: if docRoot is not None: - name = docRoot + id = docRoot else: - name = "" - _errors__.append(ValidationException("missing name")) + id = "" + _errors__.append(ValidationException("missing id")) else: - baseuri = name - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) + baseuri = id label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -12113,7 +11976,7 @@ def fromDoc( secondaryFiles = None if "secondaryFiles" in _doc: try: - secondaryFiles = load_field( + secondaryFiles = _load_field( _doc.get("secondaryFiles"), secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, @@ -12160,7 +12023,7 @@ def fromDoc( streamable = None if "streamable" in _doc: try: - streamable = load_field( + streamable = _load_field( _doc.get("streamable"), union_of_None_type_or_booltype, baseuri, @@ -12204,21 +12067,21 @@ def fromDoc( "is not valid because:", ) ) - format = None - if "format" in _doc: + doc = None + if "doc" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -12226,13 +12089,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12244,28 +12107,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - outputBinding = None - if "outputBinding" in _doc: + format = None + if "format" in _doc: try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, - lc=_doc.get("outputBinding") + lc=_doc.get("format") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputBinding`": + if str(e) == "missing required field `format`": _errors__.append( ValidationException( str(e), @@ -12273,13 +12136,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputBinding") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12291,202 +12154,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `outputBinding` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `outputBinding`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - doc=doc, - type_=type_, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - format=format, - outputBinding=outputBinding, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.format is not None: - u = save_relative_uri(self.format, self.name, True, None, relative_uris) - r["format"] = u - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - name: str, - type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - format: None | str = None, - outputBinding: CommandOutputBinding | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.outputBinding = outputBinding - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "doc", - "name", - "type", - "label", - "secondaryFiles", - "streamable", - "format", - "outputBinding", - ] - ) - - -@mypyc_attr(native_class=True) -class CommandOutputRecordSchema(OutputRecordSchema): - name: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputRecordSchema): - return bool( - self.fields == other.fields - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - and self.name == other.name - ) - return False - - def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.doc, self.name)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - name = None - if "name" in _doc: + loadContents = None + if "loadContents" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("loadContents") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( str(e), @@ -12494,13 +12183,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("loadContents") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12512,36 +12201,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `loadContents` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - fields = None - if "fields" in _doc: + loadListing = None + if "loadListing" in _doc: try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, baseuri, loadingOptions, - lc=_doc.get("fields") + lc=_doc.get("loadListing") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `fields`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -12549,13 +12230,13 @@ def fromDoc( ) ) else: - val = _doc.get("fields") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12567,32 +12248,79 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `fields` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + default = None + if "default" in _doc: + try: + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, + baseuri, + loadingOptions, + lc=_doc.get("default") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), + if str(e) == "missing required field `default`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("default") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [e], + detailed_message=f"the `default` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), None ) ) @@ -12622,68 +12350,21 @@ def fromDoc( "is not valid because:", ) ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -12691,13 +12372,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12709,10 +12390,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -12724,14 +12405,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -12741,15 +12422,21 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - fields=fields, - type_=type_, + id=id, label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, doc=doc, + format=format, + loadContents=loadContents, + loadListing=loadListing, + default=default, + type_=type_, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -12763,24 +12450,62 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u if self.label is not None: r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) if self.doc is not None: r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) # top refers to the directory level @@ -12793,11 +12518,17 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[CommandOutputRecordField] = None, + id: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | stdin | str, label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, doc: None | Sequence[str] | str = None, - name: None | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -12809,34 +12540,71 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["fields", "type", "label", "doc", "name"] + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "loadContents", + "loadListing", + "default", + "type", + "inputBinding", + ] ) @mypyc_attr(native_class=True) -class CommandOutputEnumSchema(OutputEnumSchema): - name: str +class CommandOutputParameter(Saveable): + """ + An output parameter for a CommandLineTool. + + """ + + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputEnumSchema): + if isinstance(other, CommandOutputParameter): return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - ) + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format + and self.type_ == other.type_ + and self.outputBinding == other.outputBinding + ) return False def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_, self.label, self.doc)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.type_, + self.outputBinding, + ) + ) @classmethod def fromDoc( @@ -12852,21 +12620,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + id = None + if "id" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -12874,13 +12642,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12892,132 +12660,131 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - if name is None: + if id is None: if docRoot is not None: - name = docRoot + id = docRoot else: - name = "_:" + str(_uuid__.uuid4()) + id = "" + _errors__.append(ValidationException("missing id")) else: - baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) + baseuri = id + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `label`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - label = None - if "label" in _doc: + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -13025,13 +12792,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13043,17 +12810,17 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -13097,170 +12864,35 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - label=label, - doc=doc, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc - - attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "doc"] - ) - - -@mypyc_attr(native_class=True) -class CommandOutputArraySchema(OutputArraySchema): - name: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputArraySchema): - return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - and self.name == other.name - ) - return False - - def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.doc, self.name)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": - _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException( + str(e), + None + ) ) else: - val = _doc.get("name") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13272,76 +12904,20 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Array_nameLoader_2, + typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -13383,21 +12959,21 @@ def fromDoc( "is not valid because:", ) ) - label = None - if "label" in _doc: + outputBinding = None + if "outputBinding" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("outputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `outputBinding`": _errors__.append( ValidationException( str(e), @@ -13405,13 +12981,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("outputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13423,57 +12999,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -13485,14 +13014,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`, `outputBinding`".format( k ), SourceLine(_doc, k, str), @@ -13502,15 +13031,18 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - items=items, - type_=type_, + id=id, label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, doc=doc, + format=format, + type_=type_, + outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -13524,23 +13056,44 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.items is not None: - u = save_relative_uri(self.items, self.name, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u if self.label is not None: r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) if self.doc is not None: r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) # top refers to the directory level @@ -13553,11 +13106,14 @@ def save( def __init__( self, - items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, - type_: Array_name, + id: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str, label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, doc: None | Sequence[str] | str = None, - name: None | str = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -13569,56 +13125,81 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.id = id + self.format = format + self.type_ = type_ + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "doc", "name"] + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "type", + "outputBinding", + ] ) @mypyc_attr(native_class=True) -class CommandInputParameter(Saveable): +class CommandLineTool(Saveable): """ - An input parameter for a CommandLineTool. + This defines the schema of the CWL Command Line Tool Description document. + """ id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputParameter): + if isinstance(other, CommandLineTool): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable + self.id == other.id + and self.label == other.label and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.default == other.default - and self.type_ == other.type_ - and self.inputBinding == other.inputBinding + and self.inputs == other.inputs + and self.outputs == other.outputs + and self.requirements == other.requirements + and self.hints == other.hints + and self.cwlVersion == other.cwlVersion + and self.class_ == other.class_ + and self.baseCommand == other.baseCommand + and self.arguments == other.arguments + and self.stdin == other.stdin + and self.stderr == other.stderr + and self.stdout == other.stdout + and self.successCodes == other.successCodes + and self.temporaryFailCodes == other.temporaryFailCodes + and self.permanentFailCodes == other.permanentFailCodes ) return False def __hash__(self) -> int: return hash( ( + self.id, self.label, - self.secondaryFiles, - self.streamable, self.doc, - self.id, - self.format, - self.loadContents, - self.loadListing, - self.default, - self.type_, - self.inputBinding, + self.inputs, + self.outputs, + self.requirements, + self.hints, + self.cwlVersion, + self.class_, + self.baseCommand, + self.arguments, + self.stdin, + self.stderr, + self.stdout, + self.successCodes, + self.temporaryFailCodes, + self.permanentFailCodes, ) ) @@ -13639,9 +13220,9 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), - uri_strtype_True_False_None_None, + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("id") @@ -13688,14 +13269,30 @@ def fromDoc( if docRoot is not None: id = docRoot else: - id = "" - _errors__.append(ValidationException("missing id")) + id = "_:" + str(_uuid__.uuid4()) else: baseuri = id + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_CommandLineTool_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -13739,21 +13336,21 @@ def fromDoc( "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + doc = None + if "doc" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -13761,13 +13358,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13779,42 +13376,138 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) + try: + if _doc.get("inputs") is None: + raise ValidationException("missing required field `inputs`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + inputs = _load_field( + _doc.get("inputs"), + idmap_inputs_array_of_CommandInputParameterLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputs") + ) - if str(e) == "missing required field `streamable`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputs`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputs") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [e], + detailed_message=f"the `inputs` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("outputs") is None: + raise ValidationException("missing required field `outputs`", None, []) + + outputs = _load_field( + _doc.get("outputs"), + idmap_outputs_array_of_CommandOutputParameterLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputs") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputs`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outputs") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), + [e], + detailed_message=f"the `outputs` field with value `{val}` " + "is not valid because:", + ) + ) + requirements = None + if "requirements" in _doc: + try: + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, + baseuri, + loadingOptions, + lc=_doc.get("requirements") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `requirements`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("requirements") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13826,28 +13519,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [e], - detailed_message=f"the `streamable` field with value `{val}` " + detailed_message=f"the `requirements` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + hints = None + if "hints" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("hints") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `hints`": _errors__.append( ValidationException( str(e), @@ -13855,13 +13548,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("hints") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13873,28 +13566,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `hints` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: + cwlVersion = None + if "cwlVersion" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + cwlVersion = _load_field( + _doc.get("cwlVersion"), + uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("cwlVersion") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `cwlVersion`": _errors__.append( ValidationException( str(e), @@ -13902,13 +13595,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("cwlVersion") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13920,28 +13613,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `cwlVersion` field with value `{val}` " "is not valid because:", ) ) - loadContents = None - if "loadContents" in _doc: + baseCommand = None + if "baseCommand" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + baseCommand = _load_field( + _doc.get("baseCommand"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("baseCommand") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `baseCommand`": _errors__.append( ValidationException( str(e), @@ -13949,13 +13642,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("baseCommand") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `baseCommand` field is not valid because:", + SourceLine(_doc, "baseCommand", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13967,28 +13660,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `baseCommand` field is not valid because:", + SourceLine(_doc, "baseCommand", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `baseCommand` field with value `{val}` " "is not valid because:", ) ) - loadListing = None - if "loadListing" in _doc: + arguments = None + if "arguments" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, + arguments = _load_field( + _doc.get("arguments"), + union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("loadListing") + lc=_doc.get("arguments") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": + if str(e) == "missing required field `arguments`": _errors__.append( ValidationException( str(e), @@ -13996,13 +13689,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadListing") + val = _doc.get("arguments") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `arguments` field is not valid because:", + SourceLine(_doc, "arguments", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14014,28 +13707,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `arguments` field is not valid because:", + SourceLine(_doc, "arguments", str), [e], - detailed_message=f"the `loadListing` field with value `{val}` " + detailed_message=f"the `arguments` field with value `{val}` " "is not valid because:", ) ) - default = None - if "default" in _doc: + stdin = None + if "stdin" in _doc: try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, + stdin = _load_field( + _doc.get("stdin"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("default") + lc=_doc.get("stdin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `default`": + if str(e) == "missing required field `stdin`": _errors__.append( ValidationException( str(e), @@ -14043,13 +13736,13 @@ def fromDoc( ) ) else: - val = _doc.get("default") + val = _doc.get("stdin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), + "the `stdin` field is not valid because:", + SourceLine(_doc, "stdin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14061,76 +13754,122 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), + "the `stdin` field is not valid because:", + SourceLine(_doc, "stdin", str), [e], - detailed_message=f"the `default` field with value `{val}` " + detailed_message=f"the `stdin` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + stderr = None + if "stderr" in _doc: + try: + stderr = _load_field( + _doc.get("stderr"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("stderr") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `stderr`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("stderr") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `stderr` field is not valid because:", + SourceLine(_doc, "stderr", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `stderr` field is not valid because:", + SourceLine(_doc, "stderr", str), + [e], + detailed_message=f"the `stderr` field with value `{val}` " + "is not valid because:", + ) + ) + stdout = None + if "stdout" in _doc: + try: + stdout = _load_field( + _doc.get("stdout"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("stdout") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `stdout`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - inputBinding = None - if "inputBinding" in _doc: + else: + val = _doc.get("stdout") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `stdout` field is not valid because:", + SourceLine(_doc, "stdout", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `stdout` field is not valid because:", + SourceLine(_doc, "stdout", str), + [e], + detailed_message=f"the `stdout` field with value `{val}` " + "is not valid because:", + ) + ) + successCodes = None + if "successCodes" in _doc: try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, + successCodes = _load_field( + _doc.get("successCodes"), + union_of_None_type_or_array_of_inttype, baseuri, loadingOptions, - lc=_doc.get("inputBinding") + lc=_doc.get("successCodes") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputBinding`": + if str(e) == "missing required field `successCodes`": _errors__.append( ValidationException( str(e), @@ -14138,13 +13877,13 @@ def fromDoc( ) ) else: - val = _doc.get("inputBinding") + val = _doc.get("successCodes") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `successCodes` field is not valid because:", + SourceLine(_doc, "successCodes", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14156,10 +13895,104 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `successCodes` field is not valid because:", + SourceLine(_doc, "successCodes", str), [e], - detailed_message=f"the `inputBinding` field with value `{val}` " + detailed_message=f"the `successCodes` field with value `{val}` " + "is not valid because:", + ) + ) + temporaryFailCodes = None + if "temporaryFailCodes" in _doc: + try: + temporaryFailCodes = _load_field( + _doc.get("temporaryFailCodes"), + union_of_None_type_or_array_of_inttype, + baseuri, + loadingOptions, + lc=_doc.get("temporaryFailCodes") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `temporaryFailCodes`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("temporaryFailCodes") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `temporaryFailCodes` field is not valid because:", + SourceLine(_doc, "temporaryFailCodes", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `temporaryFailCodes` field is not valid because:", + SourceLine(_doc, "temporaryFailCodes", str), + [e], + detailed_message=f"the `temporaryFailCodes` field with value `{val}` " + "is not valid because:", + ) + ) + permanentFailCodes = None + if "permanentFailCodes" in _doc: + try: + permanentFailCodes = _load_field( + _doc.get("permanentFailCodes"), + union_of_None_type_or_array_of_inttype, + baseuri, + loadingOptions, + lc=_doc.get("permanentFailCodes") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `permanentFailCodes`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("permanentFailCodes") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `permanentFailCodes` field is not valid because:", + SourceLine(_doc, "permanentFailCodes", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `permanentFailCodes` field is not valid because:", + SourceLine(_doc, "permanentFailCodes", str), + [e], + detailed_message=f"the `permanentFailCodes` field with value `{val}` " "is not valid because:", ) ) @@ -14171,14 +14004,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`, `inputBinding`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `class`, `baseCommand`, `arguments`, `stdin`, `stderr`, `stdout`, `successCodes`, `temporaryFailCodes`, `permanentFailCodes`".format( k ), SourceLine(_doc, k, str), @@ -14190,15 +14023,20 @@ def fromDoc( _constructed = cls( id=id, label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, doc=doc, - format=format, - loadContents=loadContents, - loadListing=loadListing, - default=default, - type_=type_, - inputBinding=inputBinding, + inputs=inputs, + outputs=outputs, + requirements=requirements, + hints=hints, + cwlVersion=cwlVersion, + baseCommand=baseCommand, + arguments=arguments, + stdin=stdin, + stderr=stderr, + stdout=stdout, + successCodes=successCodes, + temporaryFailCodes=temporaryFailCodes, + permanentFailCodes=permanentFailCodes, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -14219,56 +14057,86 @@ def save( if self.id is not None: u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, self.id, False, None, relative_uris) + r["class"] = u if self.label is not None: r["label"] = save( self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) if self.doc is not None: r["doc"] = save( self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, + if self.inputs is not None: + r["inputs"] = save( + self.inputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputs is not None: + r["outputs"] = save( + self.outputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.requirements is not None: + r["requirements"] = save( + self.requirements, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.cwlVersion is not None: + u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) + r["cwlVersion"] = u + if self.baseCommand is not None: + r["baseCommand"] = save( + self.baseCommand, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris + if self.arguments is not None: + r["arguments"] = save( + self.arguments, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris + if self.stdin is not None: + r["stdin"] = save( + self.stdin, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, + if self.stderr is not None: + r["stderr"] = save( + self.stderr, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.stdout is not None: + r["stdout"] = save( + self.stdout, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.successCodes is not None: + r["successCodes"] = save( + self.successCodes, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.temporaryFailCodes is not None: + r["temporaryFailCodes"] = save( + self.temporaryFailCodes, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.permanentFailCodes is not None: + r["permanentFailCodes"] = save( + self.permanentFailCodes, top=False, base_url=self.id, relative_uris=relative_uris, @@ -14284,17 +14152,22 @@ def save( def __init__( self, - id: str, - type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | stdin | str, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, doc: None | Sequence[str] | str = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - default: CWLObjectType | None = None, - inputBinding: CommandLineBinding | None = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -14306,68 +14179,96 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.class_: Final[str] = "CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ + "id", "label", - "secondaryFiles", - "streamable", "doc", - "id", - "format", - "loadContents", - "loadListing", - "default", - "type", - "inputBinding", + "inputs", + "outputs", + "requirements", + "hints", + "cwlVersion", + "class", + "baseCommand", + "arguments", + "stdin", + "stderr", + "stdout", + "successCodes", + "temporaryFailCodes", + "permanentFailCodes", ] ) @mypyc_attr(native_class=True) -class CommandOutputParameter(Saveable): - """ - An output parameter for a CommandLineTool. +class DockerRequirement(Saveable): """ + Indicates that a workflow component should be run in a `Docker `__ or Docker-compatible (such as `Singularity `__ and `udocker `__) container environment and specifies how to fetch or build the image. - id: str + If a CommandLineTool lists ``DockerRequirement`` under ``hints`` (or ``requirements``), it may (or must) be run in the specified Docker container. + + The platform must first acquire or install the correct Docker image as specified by ``dockerPull``, ``dockerImport``, ``dockerLoad`` or ``dockerFile``. + + The platform must execute the tool in the container using ``docker run`` with the appropriate Docker image and tool command line. + + The workflow platform may provide input files and the designated output directory through the use of volume bind mounts. The platform should rewrite file paths in the input object to correspond to the Docker bind mounted locations. That is, the platform should rewrite values in the parameter context such as ``runtime.outdir``, ``runtime.tmpdir`` and others to be valid paths within the container. The platform must ensure that ``runtime.outdir`` and ``runtime.tmpdir`` are distinct directories. + + When running a tool contained in Docker, the workflow platform must not assume anything about the contents of the Docker container, such as the presence or absence of specific software, except to assume that the generated command line represents a valid command within the runtime environment of the container. + + A container image may specify an `ENTRYPOINT `__ and/or `CMD `__. Command line arguments will be appended after all elements of ENTRYPOINT, and will override all elements specified using CMD (in other words, CMD is only used when the CommandLineTool definition produces an empty command line). + + Use of implicit ENTRYPOINT or CMD are discouraged due to reproducibility concerns of the implicit hidden execution point (For further discussion, see `https://doi.org/10.12688/f1000research.15140.1 `__). Portable CommandLineTool wrappers in which use of a container is optional must not rely on ENTRYPOINT or CMD. CommandLineTools which do rely on ENTRYPOINT or CMD must list ``DockerRequirement`` in the ``requirements`` section. + + Interaction with other requirements + ----------------------------------- + + If `EnvVarRequirement <#EnvVarRequirement>`__ is specified alongside a DockerRequirement, the environment variables must be provided to Docker using ``--env`` or ``--env-file`` and interact with the container's preexisting environment as defined by Docker. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputParameter): + if isinstance(other, DockerRequirement): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.type_ == other.type_ - and self.outputBinding == other.outputBinding + self.class_ == other.class_ + and self.dockerPull == other.dockerPull + and self.dockerLoad == other.dockerLoad + and self.dockerFile == other.dockerFile + and self.dockerImport == other.dockerImport + and self.dockerImageId == other.dockerImageId + and self.dockerOutputDirectory == other.dockerOutputDirectory ) return False def __hash__(self) -> int: return hash( ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.type_, - self.outputBinding, + self.class_, + self.dockerPull, + self.dockerLoad, + self.dockerFile, + self.dockerImport, + self.dockerImageId, + self.dockerOutputDirectory, ) ) @@ -14385,21 +14286,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_DockerRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + dockerPull = None + if "dockerPull" in _doc: try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, + dockerPull = _load_field( + _doc.get("dockerPull"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("id") + lc=_doc.get("dockerPull") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `dockerPull`": _errors__.append( ValidationException( str(e), @@ -14407,13 +14325,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("dockerPull") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `dockerPull` field is not valid because:", + SourceLine(_doc, "dockerPull", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14425,37 +14343,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `dockerPull` field is not valid because:", + SourceLine(_doc, "dockerPull", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `dockerPull` field with value `{val}` " "is not valid because:", ) ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: + dockerLoad = None + if "dockerLoad" in _doc: try: - label = load_field( - _doc.get("label"), + dockerLoad = _load_field( + _doc.get("dockerLoad"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("dockerLoad") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `dockerLoad`": _errors__.append( ValidationException( str(e), @@ -14463,13 +14372,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("dockerLoad") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `dockerLoad` field is not valid because:", + SourceLine(_doc, "dockerLoad", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14481,28 +14390,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `dockerLoad` field is not valid because:", + SourceLine(_doc, "dockerLoad", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `dockerLoad` field with value `{val}` " "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + dockerFile = None + if "dockerFile" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + dockerFile = _load_field( + _doc.get("dockerFile"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("dockerFile") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `dockerFile`": _errors__.append( ValidationException( str(e), @@ -14510,13 +14419,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("dockerFile") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `dockerFile` field is not valid because:", + SourceLine(_doc, "dockerFile", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14528,75 +14437,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `dockerFile` field is not valid because:", + SourceLine(_doc, "dockerFile", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " + detailed_message=f"the `dockerFile` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + dockerImport = None + if "dockerImport" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + dockerImport = _load_field( + _doc.get("dockerImport"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("dockerImport") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `dockerImport`": _errors__.append( ValidationException( str(e), @@ -14604,13 +14466,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("dockerImport") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `dockerImport` field is not valid because:", + SourceLine(_doc, "dockerImport", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14622,28 +14484,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `dockerImport` field is not valid because:", + SourceLine(_doc, "dockerImport", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `dockerImport` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: + dockerImageId = None + if "dockerImageId" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + dockerImageId = _load_field( + _doc.get("dockerImageId"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("dockerImageId") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `dockerImageId`": _errors__.append( ValidationException( str(e), @@ -14651,13 +14513,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("dockerImageId") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `dockerImageId` field is not valid because:", + SourceLine(_doc, "dockerImageId", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14669,76 +14531,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `dockerImageId` field is not valid because:", + SourceLine(_doc, "dockerImageId", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `dockerImageId` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: + dockerOutputDirectory = None + if "dockerOutputDirectory" in _doc: try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, + dockerOutputDirectory = _load_field( + _doc.get("dockerOutputDirectory"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("outputBinding") + lc=_doc.get("dockerOutputDirectory") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputBinding`": + if str(e) == "missing required field `dockerOutputDirectory`": _errors__.append( ValidationException( str(e), @@ -14746,13 +14560,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputBinding") + val = _doc.get("dockerOutputDirectory") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `dockerOutputDirectory` field is not valid because:", + SourceLine(_doc, "dockerOutputDirectory", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14764,10 +14578,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `dockerOutputDirectory` field is not valid because:", + SourceLine(_doc, "dockerOutputDirectory", str), [e], - detailed_message=f"the `outputBinding` field with value `{val}` " + detailed_message=f"the `dockerOutputDirectory` field with value `{val}` " "is not valid because:", ) ) @@ -14779,14 +14593,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`, `outputBinding`".format( + "invalid field `{}`, expected one of: `class`, `dockerPull`, `dockerLoad`, `dockerFile`, `dockerImport`, `dockerImageId`, `dockerOutputDirectory`".format( k ), SourceLine(_doc, k, str), @@ -14796,18 +14610,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - type_=type_, - outputBinding=outputBinding, + dockerPull=dockerPull, + dockerLoad=dockerLoad, + dockerFile=dockerFile, + dockerImport=dockerImport, + dockerImageId=dockerImageId, + dockerOutputDirectory=dockerOutputDirectory, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14821,43 +14632,56 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.dockerPull is not None: + r["dockerPull"] = save( + self.dockerPull, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, + if self.dockerLoad is not None: + r["dockerLoad"] = save( + self.dockerLoad, top=False, - base_url=self.id, + base_url=base_url, relative_uris=relative_uris, ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, + if self.dockerFile is not None: + r["dockerFile"] = save( + self.dockerFile, top=False, - base_url=self.id, + base_url=base_url, relative_uris=relative_uris, ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris + if self.dockerImport is not None: + r["dockerImport"] = save( + self.dockerImport, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris + if self.dockerImageId is not None: + r["dockerImageId"] = save( + self.dockerImageId, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, + if self.dockerOutputDirectory is not None: + r["dockerOutputDirectory"] = save( + self.dockerOutputDirectory, top=False, - base_url=self.id, + base_url=base_url, relative_uris=relative_uris, ) @@ -14871,15 +14695,13 @@ def save( def __init__( self, - id: str, - type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | str = None, - outputBinding: CommandOutputBinding | None = None, - extension_fields: MutableMapping[str, Any] | None = None, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: @@ -14890,83 +14712,41 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ - self.outputBinding = outputBinding + self.class_: Final[str] = "DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "type", - "outputBinding", + "class", + "dockerPull", + "dockerLoad", + "dockerFile", + "dockerImport", + "dockerImageId", + "dockerOutputDirectory", ] ) @mypyc_attr(native_class=True) -class CommandLineTool(Saveable): +class SoftwareRequirement(Saveable): """ - This defines the schema of the CWL Command Line Tool Description document. + A list of software packages that should be configured in the environment of the defined process. """ - id: str - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandLineTool): - return bool( - self.id == other.id - and self.label == other.label - and self.doc == other.doc - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.cwlVersion == other.cwlVersion - and self.class_ == other.class_ - and self.baseCommand == other.baseCommand - and self.arguments == other.arguments - and self.stdin == other.stdin - and self.stderr == other.stderr - and self.stdout == other.stdout - and self.successCodes == other.successCodes - and self.temporaryFailCodes == other.temporaryFailCodes - and self.permanentFailCodes == other.permanentFailCodes - ) + if isinstance(other, SoftwareRequirement): + return bool(self.class_ == other.class_ and self.packages == other.packages) return False def __hash__(self) -> int: - return hash( - ( - self.id, - self.label, - self.doc, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.cwlVersion, - self.class_, - self.baseCommand, - self.arguments, - self.stdin, - self.stderr, - self.stdout, - self.successCodes, - self.temporaryFailCodes, - self.permanentFailCodes, - ) - ) + return hash((self.class_, self.packages)) @classmethod def fromDoc( @@ -14982,187 +14762,39 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_CommandLineTool_classLoader_False_True_None_None, + uri_SoftwareRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) + raise e try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) + if _doc.get("packages") is None: + raise ValidationException("missing required field `packages`", None, []) - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_CommandInputParameterLoader, + packages = _load_field( + _doc.get("packages"), + idmap_packages_array_of_SoftwarePackageLoader, baseuri, loadingOptions, - lc=_doc.get("inputs") + lc=_doc.get("packages") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputs`": + if str(e) == "missing required field `packages`": _errors__.append( ValidationException( str(e), @@ -15170,13 +14802,13 @@ def fromDoc( ) ) else: - val = _doc.get("inputs") + val = _doc.get("packages") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), + "the `packages` field is not valid because:", + SourceLine(_doc, "packages", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15188,29 +14820,142 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), + "the `packages` field is not valid because:", + SourceLine(_doc, "packages", str), [e], - detailed_message=f"the `inputs` field with value `{val}` " + detailed_message=f"the `packages` field with value `{val}` " "is not valid because:", ) ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `packages`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + packages=packages, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.packages is not None: + r["packages"] = save( + self.packages, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + packages: Sequence[SoftwarePackage], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "SoftwareRequirement" + self.packages = packages + + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + + +@mypyc_attr(native_class=True) +class SoftwarePackage(Saveable): + def __eq__(self, other: Any) -> bool: + if isinstance(other, SoftwarePackage): + return bool( + self.package == other.package + and self.version == other.version + and self.specs == other.specs + ) + return False + + def __hash__(self) -> int: + return hash((self.package, self.version, self.specs)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) + if _doc.get("package") is None: + raise ValidationException("missing required field `package`", None, []) - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_CommandOutputParameterLoader, + package = _load_field( + _doc.get("package"), + strtype, baseuri, loadingOptions, - lc=_doc.get("outputs") + lc=_doc.get("package") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputs`": + if str(e) == "missing required field `package`": _errors__.append( ValidationException( str(e), @@ -15218,13 +14963,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputs") + val = _doc.get("package") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), + "the `package` field is not valid because:", + SourceLine(_doc, "package", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15236,28 +14981,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), + "the `package` field is not valid because:", + SourceLine(_doc, "package", str), [e], - detailed_message=f"the `outputs` field with value `{val}` " + detailed_message=f"the `package` field with value `{val}` " "is not valid because:", ) ) - requirements = None - if "requirements" in _doc: + version = None + if "version" in _doc: try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + version = _load_field( + _doc.get("version"), + union_of_None_type_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("requirements") + lc=_doc.get("version") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `requirements`": + if str(e) == "missing required field `version`": _errors__.append( ValidationException( str(e), @@ -15265,13 +15010,13 @@ def fromDoc( ) ) else: - val = _doc.get("requirements") + val = _doc.get("version") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), + "the `version` field is not valid because:", + SourceLine(_doc, "version", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15283,28 +15028,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), + "the `version` field is not valid because:", + SourceLine(_doc, "version", str), [e], - detailed_message=f"the `requirements` field with value `{val}` " + detailed_message=f"the `version` field with value `{val}` " "is not valid because:", ) ) - hints = None - if "hints" in _doc: + specs = None + if "specs" in _doc: try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + specs = _load_field( + _doc.get("specs"), + uri_union_of_None_type_or_array_of_strtype_False_False_None_True, baseuri, loadingOptions, - lc=_doc.get("hints") + lc=_doc.get("specs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `hints`": + if str(e) == "missing required field `specs`": _errors__.append( ValidationException( str(e), @@ -15312,13 +15057,13 @@ def fromDoc( ) ) else: - val = _doc.get("hints") + val = _doc.get("specs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), + "the `specs` field is not valid because:", + SourceLine(_doc, "specs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15330,122 +15075,148 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), + "the `specs` field is not valid because:", + SourceLine(_doc, "specs", str), [e], - detailed_message=f"the `hints` field with value `{val}` " + detailed_message=f"the `specs` field with value `{val}` " "is not valid because:", ) ) - cwlVersion = None - if "cwlVersion" in _doc: - try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("cwlVersion") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cwlVersion`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("cwlVersion") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " - "is not valid because:", - ) - ) - baseCommand = None - if "baseCommand" in _doc: - try: - baseCommand = load_field( - _doc.get("baseCommand"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("baseCommand") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `baseCommand`": _errors__.append( ValidationException( - str(e), - None + "invalid field `{}`, expected one of: `package`, `version`, `specs`".format( + k + ), + SourceLine(_doc, k, str), ) ) - else: - val = _doc.get("baseCommand") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `baseCommand` field is not valid because:", - SourceLine(_doc, "baseCommand", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `baseCommand` field is not valid because:", - SourceLine(_doc, "baseCommand", str), - [e], - detailed_message=f"the `baseCommand` field with value `{val}` " - "is not valid because:", - ) - ) - arguments = None - if "arguments" in _doc: + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + package=package, + version=version, + specs=specs, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.package is not None: + r["package"] = save( + self.package, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.version is not None: + r["version"] = save( + self.version, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.specs is not None: + u = save_relative_uri(self.specs, base_url, False, None, relative_uris) + r["specs"] = u + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.package = package + self.version = version + self.specs = specs + + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) + + +@mypyc_attr(native_class=True) +class Dirent(Saveable): + """ + Define a file or subdirectory that must be placed in the designated output directory prior to executing the command line tool. May be the result of executing an expression, such as building a configuration file from a template. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, Dirent): + return bool( + self.entryname == other.entryname + and self.entry == other.entry + and self.writable == other.writable + ) + return False + + def __hash__(self) -> int: + return hash((self.entryname, self.entry, self.writable)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + entryname = None + if "entryname" in _doc: try: - arguments = load_field( - _doc.get("arguments"), - union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, + entryname = _load_field( + _doc.get("entryname"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("arguments") + lc=_doc.get("entryname") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `arguments`": + if str(e) == "missing required field `entryname`": _errors__.append( ValidationException( str(e), @@ -15453,13 +15224,13 @@ def fromDoc( ) ) else: - val = _doc.get("arguments") + val = _doc.get("entryname") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `arguments` field is not valid because:", - SourceLine(_doc, "arguments", str), + "the `entryname` field is not valid because:", + SourceLine(_doc, "entryname", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15471,75 +15242,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `arguments` field is not valid because:", - SourceLine(_doc, "arguments", str), + "the `entryname` field is not valid because:", + SourceLine(_doc, "entryname", str), [e], - detailed_message=f"the `arguments` field with value `{val}` " + detailed_message=f"the `entryname` field with value `{val}` " "is not valid because:", ) ) - stdin = None - if "stdin" in _doc: - try: - stdin = load_field( - _doc.get("stdin"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("stdin") - ) + try: + if _doc.get("entry") is None: + raise ValidationException("missing required field `entry`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + entry = _load_field( + _doc.get("entry"), + union_of_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("entry") + ) - if str(e) == "missing required field `stdin`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `entry`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("entry") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `entry` field is not valid because:", + SourceLine(_doc, "entry", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("stdin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `stdin` field is not valid because:", - SourceLine(_doc, "stdin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `stdin` field is not valid because:", - SourceLine(_doc, "stdin", str), - [e], - detailed_message=f"the `stdin` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `entry` field is not valid because:", + SourceLine(_doc, "entry", str), + [e], + detailed_message=f"the `entry` field with value `{val}` " + "is not valid because:", ) - stderr = None - if "stderr" in _doc: + ) + writable = None + if "writable" in _doc: try: - stderr = load_field( - _doc.get("stderr"), - union_of_None_type_or_strtype_or_ExpressionLoader, + writable = _load_field( + _doc.get("writable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("stderr") + lc=_doc.get("writable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `stderr`": + if str(e) == "missing required field `writable`": _errors__.append( ValidationException( str(e), @@ -15547,13 +15319,13 @@ def fromDoc( ) ) else: - val = _doc.get("stderr") + val = _doc.get("writable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `stderr` field is not valid because:", - SourceLine(_doc, "stderr", str), + "the `writable` field is not valid because:", + SourceLine(_doc, "writable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15565,198 +15337,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `stderr` field is not valid because:", - SourceLine(_doc, "stderr", str), + "the `writable` field is not valid because:", + SourceLine(_doc, "writable", str), [e], - detailed_message=f"the `stderr` field with value `{val}` " - "is not valid because:", - ) - ) - stdout = None - if "stdout" in _doc: - try: - stdout = load_field( - _doc.get("stdout"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("stdout") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `stdout`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("stdout") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `stdout` field is not valid because:", - SourceLine(_doc, "stdout", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `stdout` field is not valid because:", - SourceLine(_doc, "stdout", str), - [e], - detailed_message=f"the `stdout` field with value `{val}` " - "is not valid because:", - ) - ) - successCodes = None - if "successCodes" in _doc: - try: - successCodes = load_field( - _doc.get("successCodes"), - union_of_None_type_or_array_of_inttype, - baseuri, - loadingOptions, - lc=_doc.get("successCodes") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `successCodes`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("successCodes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `successCodes` field is not valid because:", - SourceLine(_doc, "successCodes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `successCodes` field is not valid because:", - SourceLine(_doc, "successCodes", str), - [e], - detailed_message=f"the `successCodes` field with value `{val}` " - "is not valid because:", - ) - ) - temporaryFailCodes = None - if "temporaryFailCodes" in _doc: - try: - temporaryFailCodes = load_field( - _doc.get("temporaryFailCodes"), - union_of_None_type_or_array_of_inttype, - baseuri, - loadingOptions, - lc=_doc.get("temporaryFailCodes") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `temporaryFailCodes`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("temporaryFailCodes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `temporaryFailCodes` field is not valid because:", - SourceLine(_doc, "temporaryFailCodes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `temporaryFailCodes` field is not valid because:", - SourceLine(_doc, "temporaryFailCodes", str), - [e], - detailed_message=f"the `temporaryFailCodes` field with value `{val}` " - "is not valid because:", - ) - ) - permanentFailCodes = None - if "permanentFailCodes" in _doc: - try: - permanentFailCodes = load_field( - _doc.get("permanentFailCodes"), - union_of_None_type_or_array_of_inttype, - baseuri, - loadingOptions, - lc=_doc.get("permanentFailCodes") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `permanentFailCodes`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("permanentFailCodes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `permanentFailCodes` field is not valid because:", - SourceLine(_doc, "permanentFailCodes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `permanentFailCodes` field is not valid because:", - SourceLine(_doc, "permanentFailCodes", str), - [e], - detailed_message=f"the `permanentFailCodes` field with value `{val}` " + detailed_message=f"the `writable` field with value `{val}` " "is not valid because:", ) ) @@ -15768,14 +15352,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `class`, `baseCommand`, `arguments`, `stdin`, `stderr`, `stdout`, `successCodes`, `temporaryFailCodes`, `permanentFailCodes`".format( + "invalid field `{}`, expected one of: `entryname`, `entry`, `writable`".format( k ), SourceLine(_doc, k, str), @@ -15785,26 +15369,12 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, - label=label, - doc=doc, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - cwlVersion=cwlVersion, - baseCommand=baseCommand, - arguments=arguments, - stdin=stdin, - stderr=stderr, - stdout=stdout, - successCodes=successCodes, - temporaryFailCodes=temporaryFailCodes, - permanentFailCodes=permanentFailCodes, + entryname=entryname, + entry=entry, + writable=writable, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -15818,90 +15388,20 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) - r["class"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.baseCommand is not None: - r["baseCommand"] = save( - self.baseCommand, + if self.entryname is not None: + r["entryname"] = save( + self.entryname, top=False, - base_url=self.id, + base_url=base_url, relative_uris=relative_uris, ) - if self.arguments is not None: - r["arguments"] = save( - self.arguments, top=False, base_url=self.id, relative_uris=relative_uris + if self.entry is not None: + r["entry"] = save( + self.entry, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.stdin is not None: - r["stdin"] = save( - self.stdin, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.stderr is not None: - r["stderr"] = save( - self.stderr, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.stdout is not None: - r["stdout"] = save( - self.stdout, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.successCodes is not None: - r["successCodes"] = save( - self.successCodes, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.temporaryFailCodes is not None: - r["temporaryFailCodes"] = save( - self.temporaryFailCodes, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.permanentFailCodes is not None: - r["permanentFailCodes"] = save( - self.permanentFailCodes, - top=False, - base_url=self.id, - relative_uris=relative_uris, + if self.writable is not None: + r["writable"] = save( + self.writable, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -15914,22 +15414,9 @@ def save( def __init__( self, - inputs: Sequence[CommandInputParameter], - outputs: Sequence[CommandOutputParameter], - id: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: CWLVersion | None = None, - baseCommand: None | Sequence[str] | str = None, - arguments: None | Sequence[CommandLineBinding | str] = None, - stdin: None | str = None, - stderr: None | str = None, - stdout: None | str = None, - successCodes: None | Sequence[i32] = None, - temporaryFailCodes: None | Sequence[i32] = None, - permanentFailCodes: None | Sequence[i32] = None, + entry: str, + entryname: None | str = None, + writable: None | bool = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -15941,129 +15428,27 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_: Final[str] = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes + self.entryname = entryname + self.entry = entry + self.writable = writable - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "label", - "doc", - "inputs", - "outputs", - "requirements", - "hints", - "cwlVersion", - "class", - "baseCommand", - "arguments", - "stdin", - "stderr", - "stdout", - "successCodes", - "temporaryFailCodes", - "permanentFailCodes", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) @mypyc_attr(native_class=True) -class DockerRequirement(Saveable): +class InitialWorkDirRequirement(Saveable): """ - Indicates that a workflow component should be run in a - [Docker](http://docker.com) or Docker-compatible (such as - [Singularity](https://www.sylabs.io/) and [udocker](https://github.com/indigo-dc/udocker)) container environment and - specifies how to fetch or build the image. - - If a CommandLineTool lists `DockerRequirement` under - `hints` (or `requirements`), it may (or must) be run in the specified Docker - container. - - The platform must first acquire or install the correct Docker image as - specified by `dockerPull`, `dockerImport`, `dockerLoad` or `dockerFile`. - - The platform must execute the tool in the container using `docker run` with - the appropriate Docker image and tool command line. - - The workflow platform may provide input files and the designated output - directory through the use of volume bind mounts. The platform should rewrite - file paths in the input object to correspond to the Docker bind mounted - locations. That is, the platform should rewrite values in the parameter context - such as `runtime.outdir`, `runtime.tmpdir` and others to be valid paths - within the container. The platform must ensure that `runtime.outdir` and - `runtime.tmpdir` are distinct directories. - - When running a tool contained in Docker, the workflow platform must not - assume anything about the contents of the Docker container, such as the - presence or absence of specific software, except to assume that the - generated command line represents a valid command within the runtime - environment of the container. - - A container image may specify an - [ENTRYPOINT](https://docs.docker.com/engine/reference/builder/#entrypoint) - and/or - [CMD](https://docs.docker.com/engine/reference/builder/#cmd). - Command line arguments will be appended after all elements of - ENTRYPOINT, and will override all elements specified using CMD (in - other words, CMD is only used when the CommandLineTool definition - produces an empty command line). - - Use of implicit ENTRYPOINT or CMD are discouraged due to reproducibility - concerns of the implicit hidden execution point (For further discussion, see - [https://doi.org/10.12688/f1000research.15140.1](https://doi.org/10.12688/f1000research.15140.1)). Portable - CommandLineTool wrappers in which use of a container is optional must not rely on ENTRYPOINT or CMD. - CommandLineTools which do rely on ENTRYPOINT or CMD must list `DockerRequirement` in the - `requirements` section. - - ## Interaction with other requirements - - If [EnvVarRequirement](#EnvVarRequirement) is specified alongside a - DockerRequirement, the environment variables must be provided to Docker - using `--env` or `--env-file` and interact with the container's preexisting - environment as defined by Docker. + Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, DockerRequirement): - return bool( - self.class_ == other.class_ - and self.dockerPull == other.dockerPull - and self.dockerLoad == other.dockerLoad - and self.dockerFile == other.dockerFile - and self.dockerImport == other.dockerImport - and self.dockerImageId == other.dockerImageId - and self.dockerOutputDirectory == other.dockerOutputDirectory - ) + if isinstance(other, InitialWorkDirRequirement): + return bool(self.class_ == other.class_ and self.listing == other.listing) return False def __hash__(self) -> int: - return hash( - ( - self.class_, - self.dockerPull, - self.dockerLoad, - self.dockerFile, - self.dockerImport, - self.dockerImageId, - self.dockerOutputDirectory, - ) - ) + return hash((self.class_, self.listing)) @classmethod def fromDoc( @@ -16083,316 +15468,83 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_DockerRequirement_classLoader_False_True_None_None, + uri_InitialWorkDirRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - dockerPull = None - if "dockerPull" in _doc: - try: - dockerPull = load_field( - _doc.get("dockerPull"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dockerPull") - ) + raise e + try: + if _doc.get("listing") is None: + raise ValidationException("missing required field `listing`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + listing = _load_field( + _doc.get("listing"), + union_of_array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("listing") + ) - if str(e) == "missing required field `dockerPull`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `listing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("listing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("dockerPull") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dockerPull` field is not valid because:", - SourceLine(_doc, "dockerPull", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `dockerPull` field is not valid because:", - SourceLine(_doc, "dockerPull", str), - [e], - detailed_message=f"the `dockerPull` field with value `{val}` " - "is not valid because:", - ) - ) - dockerLoad = None - if "dockerLoad" in _doc: - try: - dockerLoad = load_field( - _doc.get("dockerLoad"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dockerLoad") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `dockerLoad`": _errors__.append( ValidationException( - str(e), - None + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [e], + detailed_message=f"the `listing` field with value `{val}` " + "is not valid because:", ) ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("dockerLoad") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dockerLoad` field is not valid because:", - SourceLine(_doc, "dockerLoad", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `dockerLoad` field is not valid because:", - SourceLine(_doc, "dockerLoad", str), - [e], - detailed_message=f"the `dockerLoad` field with value `{val}` " - "is not valid because:", - ) - ) - dockerFile = None - if "dockerFile" in _doc: - try: - dockerFile = load_field( - _doc.get("dockerFile"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dockerFile") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `dockerFile`": _errors__.append( ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("dockerFile") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dockerFile` field is not valid because:", - SourceLine(_doc, "dockerFile", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `dockerFile` field is not valid because:", - SourceLine(_doc, "dockerFile", str), - [e], - detailed_message=f"the `dockerFile` field with value `{val}` " - "is not valid because:", - ) - ) - dockerImport = None - if "dockerImport" in _doc: - try: - dockerImport = load_field( - _doc.get("dockerImport"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dockerImport") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `dockerImport`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("dockerImport") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dockerImport` field is not valid because:", - SourceLine(_doc, "dockerImport", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `dockerImport` field is not valid because:", - SourceLine(_doc, "dockerImport", str), - [e], - detailed_message=f"the `dockerImport` field with value `{val}` " - "is not valid because:", - ) - ) - dockerImageId = None - if "dockerImageId" in _doc: - try: - dockerImageId = load_field( - _doc.get("dockerImageId"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dockerImageId") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `dockerImageId`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("dockerImageId") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dockerImageId` field is not valid because:", - SourceLine(_doc, "dockerImageId", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `dockerImageId` field is not valid because:", - SourceLine(_doc, "dockerImageId", str), - [e], - detailed_message=f"the `dockerImageId` field with value `{val}` " - "is not valid because:", - ) - ) - dockerOutputDirectory = None - if "dockerOutputDirectory" in _doc: - try: - dockerOutputDirectory = load_field( - _doc.get("dockerOutputDirectory"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dockerOutputDirectory") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `dockerOutputDirectory`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("dockerOutputDirectory") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dockerOutputDirectory` field is not valid because:", - SourceLine(_doc, "dockerOutputDirectory", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `dockerOutputDirectory` field is not valid because:", - SourceLine(_doc, "dockerOutputDirectory", str), - [e], - detailed_message=f"the `dockerOutputDirectory` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `dockerPull`, `dockerLoad`, `dockerFile`, `dockerImport`, `dockerImageId`, `dockerOutputDirectory`".format( + "invalid field `{}`, expected one of: `class`, `listing`".format( k ), SourceLine(_doc, k, str), @@ -16402,12 +15554,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - dockerPull=dockerPull, - dockerLoad=dockerLoad, - dockerFile=dockerFile, - dockerImport=dockerImport, - dockerImageId=dockerImageId, - dockerOutputDirectory=dockerOutputDirectory, + listing=listing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -16425,54 +15572,18 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.dockerPull is not None: - r["dockerPull"] = save( - self.dockerPull, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerLoad is not None: - r["dockerLoad"] = save( - self.dockerLoad, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerFile is not None: - r["dockerFile"] = save( - self.dockerFile, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerImport is not None: - r["dockerImport"] = save( - self.dockerImport, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerImageId is not None: - r["dockerImageId"] = save( - self.dockerImageId, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.dockerOutputDirectory is not None: - r["dockerOutputDirectory"] = save( - self.dockerOutputDirectory, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.listing is not None: + r["listing"] = save( + self.listing, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -16485,12 +15596,7 @@ def save( def __init__( self, - dockerPull: None | str = None, - dockerLoad: None | str = None, - dockerFile: None | str = None, - dockerImport: None | str = None, - dockerImageId: None | str = None, - dockerOutputDirectory: None | str = None, + listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -16502,42 +15608,26 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory + self.class_: Final[str] = "InitialWorkDirRequirement" + self.listing = listing - attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "dockerPull", - "dockerLoad", - "dockerFile", - "dockerImport", - "dockerImageId", - "dockerOutputDirectory", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) @mypyc_attr(native_class=True) -class SoftwareRequirement(Saveable): +class EnvVarRequirement(Saveable): """ - A list of software packages that should be configured in the environment of - the defined process. + Define a list of environment variables which will be set in the execution environment of the tool. See ``EnvironmentDef`` for details. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, SoftwareRequirement): - return bool(self.class_ == other.class_ and self.packages == other.packages) + if isinstance(other, EnvVarRequirement): + return bool(self.class_ == other.class_ and self.envDef == other.envDef) return False def __hash__(self) -> int: - return hash((self.class_, self.packages)) + return hash((self.class_, self.envDef)) @classmethod def fromDoc( @@ -16557,34 +15647,35 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_SoftwareRequirement_classLoader_False_True_None_None, + uri_EnvVarRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e try: - if _doc.get("packages") is None: - raise ValidationException("missing required field `packages`", None, []) + if _doc.get("envDef") is None: + raise ValidationException("missing required field `envDef`", None, []) - packages = load_field( - _doc.get("packages"), - idmap_packages_array_of_SoftwarePackageLoader, + envDef = _load_field( + _doc.get("envDef"), + idmap_envDef_array_of_EnvironmentDefLoader, baseuri, loadingOptions, - lc=_doc.get("packages") + lc=_doc.get("envDef") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `packages`": + if str(e) == "missing required field `envDef`": _errors__.append( ValidationException( str(e), @@ -16592,13 +15683,13 @@ def fromDoc( ) ) else: - val = _doc.get("packages") + val = _doc.get("envDef") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `packages` field is not valid because:", - SourceLine(_doc, "packages", str), + "the `envDef` field is not valid because:", + SourceLine(_doc, "envDef", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16610,10 +15701,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `packages` field is not valid because:", - SourceLine(_doc, "packages", str), + "the `envDef` field is not valid because:", + SourceLine(_doc, "envDef", str), [e], - detailed_message=f"the `packages` field with value `{val}` " + detailed_message=f"the `envDef` field with value `{val}` " "is not valid because:", ) ) @@ -16625,14 +15716,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `packages`".format( + "invalid field `{}`, expected one of: `class`, `envDef`".format( k ), SourceLine(_doc, k, str), @@ -16642,7 +15733,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - packages=packages, + envDef=envDef, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -16660,16 +15751,18 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.packages is not None: - r["packages"] = save( - self.packages, top=False, base_url=base_url, relative_uris=relative_uris + if self.envDef is not None: + r["envDef"] = save( + self.envDef, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -16682,7 +15775,7 @@ def save( def __init__( self, - packages: Sequence[SoftwarePackage], + envDef: Sequence[EnvironmentDef], extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -16694,25 +15787,26 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages + self.class_: Final[str] = "EnvVarRequirement" + self.envDef = envDef - attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) @mypyc_attr(native_class=True) -class SoftwarePackage(Saveable): +class ShellCommandRequirement(Saveable): + """ + Modify the behavior of CommandLineTool to generate a single string containing a shell command line. Each item in the argument list must be joined into a string separated by single spaces and quoted to prevent interpretation by the shell, unless ``CommandLineBinding`` for that argument contains ``shellQuote: false``. If ``shellQuote: false`` is specified, the argument is joined into the command string without quoting, which allows the use of shell metacharacters such as ``|`` for pipes. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, SoftwarePackage): - return bool( - self.package == other.package - and self.version == other.version - and self.specs == other.specs - ) + if isinstance(other, ShellCommandRequirement): + return bool(self.class_ == other.class_) return False def __hash__(self) -> int: - return hash((self.package, self.version, self.specs)) + return hash((self.class_)) @classmethod def fromDoc( @@ -16729,147 +15823,22 @@ def fromDoc( _doc.lc.filename = doc.lc.filename _errors__ = [] try: - if _doc.get("package") is None: - raise ValidationException("missing required field `package`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - package = load_field( - _doc.get("package"), - strtype, + class_ = _load_field( + _doc.get("class"), + uri_ShellCommandRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("package") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `package`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("package") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `package` field is not valid because:", - SourceLine(_doc, "package", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `package` field is not valid because:", - SourceLine(_doc, "package", str), - [e], - detailed_message=f"the `package` field with value `{val}` " - "is not valid because:", - ) - ) - version = None - if "version" in _doc: - try: - version = load_field( - _doc.get("version"), - union_of_None_type_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("version") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `version`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("version") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `version` field is not valid because:", - SourceLine(_doc, "version", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `version` field is not valid because:", - SourceLine(_doc, "version", str), - [e], - detailed_message=f"the `version` field with value `{val}` " - "is not valid because:", - ) - ) - specs = None - if "specs" in _doc: - try: - specs = load_field( - _doc.get("specs"), - uri_union_of_None_type_or_array_of_strtype_False_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("specs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `specs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("specs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `specs` field is not valid because:", - SourceLine(_doc, "specs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `specs` field is not valid because:", - SourceLine(_doc, "specs", str), - [e], - detailed_message=f"the `specs` field with value `{val}` " - "is not valid because:", - ) - ) + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -16878,16 +15847,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `package`, `version`, `specs`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -16895,9 +15862,6 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - package=package, - version=version, - specs=specs, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -16914,17 +15878,16 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.package is not None: - r["package"] = save( - self.package, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.version is not None: - r["version"] = save( - self.version, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.specs is not None: - u = save_relative_uri(self.specs, base_url, False, None, relative_uris) - r["specs"] = u + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u # top refers to the directory level if top: @@ -16936,9 +15899,6 @@ def save( def __init__( self, - package: str, - version: None | Sequence[str] = None, - specs: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -16950,34 +15910,59 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "ShellCommandRequirement" - attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) @mypyc_attr(native_class=True) -class Dirent(Saveable): +class ResourceRequirement(Saveable): """ - Define a file or subdirectory that must be placed in the designated output - directory prior to executing the command line tool. May be the result of - executing an expression, such as building a configuration file from a - template. + Specify basic hardware resource requirements. - """ + "min" is the minimum amount of a resource that must be reserved to schedule a job. If "min" cannot be satisfied, the job should not be run. - def __eq__(self, other: Any) -> bool: - if isinstance(other, Dirent): - return bool( - self.entryname == other.entryname - and self.entry == other.entry - and self.writable == other.writable - ) + "max" is the maximum amount of a resource that the job shall be permitted to use. If a node has sufficient resources, multiple jobs may be scheduled on a single node provided each job's "max" resource requirements are met. If a job attempts to exceed its "max" resource allocation, an implementation may deny additional resources, which may result in job failure. + + If "min" is specified but "max" is not, then "max" == "min" If "max" is specified by "min" is not, then "min" == "max". + + It is an error if max < min. + + It is an error if the value of any of these fields is negative. + + If neither "min" nor "max" is specified for a resource, use the default values below. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, ResourceRequirement): + return bool( + self.class_ == other.class_ + and self.coresMin == other.coresMin + and self.coresMax == other.coresMax + and self.ramMin == other.ramMin + and self.ramMax == other.ramMax + and self.tmpdirMin == other.tmpdirMin + and self.tmpdirMax == other.tmpdirMax + and self.outdirMin == other.outdirMin + and self.outdirMax == other.outdirMax + ) return False def __hash__(self) -> int: - return hash((self.entryname, self.entry, self.writable)) + return hash( + ( + self.class_, + self.coresMin, + self.coresMax, + self.ramMin, + self.ramMax, + self.tmpdirMin, + self.tmpdirMax, + self.outdirMin, + self.outdirMax, + ) + ) @classmethod def fromDoc( @@ -16993,21 +15978,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - entryname = None - if "entryname" in _doc: + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_ResourceRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + coresMin = None + if "coresMin" in _doc: try: - entryname = load_field( - _doc.get("entryname"), - union_of_None_type_or_strtype_or_ExpressionLoader, + coresMin = _load_field( + _doc.get("coresMin"), + union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("entryname") + lc=_doc.get("coresMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `entryname`": + if str(e) == "missing required field `coresMin`": _errors__.append( ValidationException( str(e), @@ -17015,13 +16017,13 @@ def fromDoc( ) ) else: - val = _doc.get("entryname") + val = _doc.get("coresMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `entryname` field is not valid because:", - SourceLine(_doc, "entryname", str), + "the `coresMin` field is not valid because:", + SourceLine(_doc, "coresMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17033,76 +16035,75 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `entryname` field is not valid because:", - SourceLine(_doc, "entryname", str), + "the `coresMin` field is not valid because:", + SourceLine(_doc, "coresMin", str), [e], - detailed_message=f"the `entryname` field with value `{val}` " + detailed_message=f"the `coresMin` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("entry") is None: - raise ValidationException("missing required field `entry`", None, []) - - entry = load_field( - _doc.get("entry"), - union_of_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("entry") - ) + coresMax = None + if "coresMax" in _doc: + try: + coresMax = _load_field( + _doc.get("coresMax"), + union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("coresMax") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `entry`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("entry") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `coresMax`": _errors__.append( ValidationException( - "the `entry` field is not valid because:", - SourceLine(_doc, "entry", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `entry` field is not valid because:", - SourceLine(_doc, "entry", str), - [e], - detailed_message=f"the `entry` field with value `{val}` " - "is not valid because:", + val = _doc.get("coresMax") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `coresMax` field is not valid because:", + SourceLine(_doc, "coresMax", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - writable = None - if "writable" in _doc: + else: + _errors__.append( + ValidationException( + "the `coresMax` field is not valid because:", + SourceLine(_doc, "coresMax", str), + [e], + detailed_message=f"the `coresMax` field with value `{val}` " + "is not valid because:", + ) + ) + ramMin = None + if "ramMin" in _doc: try: - writable = load_field( - _doc.get("writable"), - union_of_None_type_or_booltype, + ramMin = _load_field( + _doc.get("ramMin"), + union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("writable") + lc=_doc.get("ramMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `writable`": + if str(e) == "missing required field `ramMin`": _errors__.append( ValidationException( str(e), @@ -17110,13 +16111,13 @@ def fromDoc( ) ) else: - val = _doc.get("writable") + val = _doc.get("ramMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `writable` field is not valid because:", - SourceLine(_doc, "writable", str), + "the `ramMin` field is not valid because:", + SourceLine(_doc, "ramMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17128,49 +16129,289 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `writable` field is not valid because:", - SourceLine(_doc, "writable", str), + "the `ramMin` field is not valid because:", + SourceLine(_doc, "ramMin", str), [e], - detailed_message=f"the `writable` field with value `{val}` " + detailed_message=f"the `ramMin` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + ramMax = None + if "ramMax" in _doc: + try: + ramMax = _load_field( + _doc.get("ramMax"), + union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("ramMax") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `ramMax`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("ramMax") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `ramMax` field is not valid because:", + SourceLine(_doc, "ramMax", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `ramMax` field is not valid because:", + SourceLine(_doc, "ramMax", str), + [e], + detailed_message=f"the `ramMax` field with value `{val}` " + "is not valid because:", + ) + ) + tmpdirMin = None + if "tmpdirMin" in _doc: + try: + tmpdirMin = _load_field( + _doc.get("tmpdirMin"), + union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("tmpdirMin") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `tmpdirMin`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `entryname`, `entry`, `writable`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - entryname=entryname, - entry=entry, - writable=writable, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: + else: + val = _doc.get("tmpdirMin") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `tmpdirMin` field is not valid because:", + SourceLine(_doc, "tmpdirMin", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `tmpdirMin` field is not valid because:", + SourceLine(_doc, "tmpdirMin", str), + [e], + detailed_message=f"the `tmpdirMin` field with value `{val}` " + "is not valid because:", + ) + ) + tmpdirMax = None + if "tmpdirMax" in _doc: + try: + tmpdirMax = _load_field( + _doc.get("tmpdirMax"), + union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("tmpdirMax") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `tmpdirMax`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("tmpdirMax") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `tmpdirMax` field is not valid because:", + SourceLine(_doc, "tmpdirMax", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `tmpdirMax` field is not valid because:", + SourceLine(_doc, "tmpdirMax", str), + [e], + detailed_message=f"the `tmpdirMax` field with value `{val}` " + "is not valid because:", + ) + ) + outdirMin = None + if "outdirMin" in _doc: + try: + outdirMin = _load_field( + _doc.get("outdirMin"), + union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("outdirMin") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outdirMin`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outdirMin") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outdirMin` field is not valid because:", + SourceLine(_doc, "outdirMin", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outdirMin` field is not valid because:", + SourceLine(_doc, "outdirMin", str), + [e], + detailed_message=f"the `outdirMin` field with value `{val}` " + "is not valid because:", + ) + ) + outdirMax = None + if "outdirMax" in _doc: + try: + outdirMax = _load_field( + _doc.get("outdirMax"), + union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("outdirMax") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outdirMax`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outdirMax") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outdirMax` field is not valid because:", + SourceLine(_doc, "outdirMax", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outdirMax` field is not valid because:", + SourceLine(_doc, "outdirMax", str), + [e], + detailed_message=f"the `outdirMax` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `coresMin`, `coresMax`, `ramMin`, `ramMax`, `tmpdirMin`, `tmpdirMax`, `outdirMin`, `outdirMax`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + coresMin=coresMin, + coresMax=coresMax, + ramMin=ramMin, + ramMax=ramMax, + tmpdirMin=tmpdirMin, + tmpdirMax=tmpdirMax, + outdirMin=outdirMin, + outdirMax=outdirMax, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: r: dict[str, Any] = {} if relative_uris: @@ -17179,20 +16420,59 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.entryname is not None: - r["entryname"] = save( - self.entryname, + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.coresMin is not None: + r["coresMin"] = save( + self.coresMin, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.coresMax is not None: + r["coresMax"] = save( + self.coresMax, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.ramMin is not None: + r["ramMin"] = save( + self.ramMin, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.ramMax is not None: + r["ramMax"] = save( + self.ramMax, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.tmpdirMin is not None: + r["tmpdirMin"] = save( + self.tmpdirMin, top=False, base_url=base_url, relative_uris=relative_uris, ) - if self.entry is not None: - r["entry"] = save( - self.entry, top=False, base_url=base_url, relative_uris=relative_uris + if self.tmpdirMax is not None: + r["tmpdirMax"] = save( + self.tmpdirMax, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.writable is not None: - r["writable"] = save( - self.writable, top=False, base_url=base_url, relative_uris=relative_uris + if self.outdirMin is not None: + r["outdirMin"] = save( + self.outdirMin, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.outdirMax is not None: + r["outdirMax"] = save( + self.outdirMax, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -17205,9 +16485,14 @@ def save( def __init__( self, - entry: str, - entryname: None | str = None, - writable: None | bool = None, + coresMin: None | i32 | i64 | str = None, + coresMax: None | i32 | i64 | str = None, + ramMin: None | i32 | i64 | str = None, + ramMax: None | i32 | i64 | str = None, + tmpdirMin: None | i32 | i64 | str = None, + tmpdirMax: None | i32 | i64 | str = None, + outdirMin: None | i32 | i64 | str = None, + outdirMax: None | i32 | i64 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17219,26 +16504,49 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.class_: Final[str] = "ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax - attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "coresMin", + "coresMax", + "ramMin", + "ramMax", + "tmpdirMin", + "tmpdirMax", + "outdirMin", + "outdirMax", + ] + ) @mypyc_attr(native_class=True) -class InitialWorkDirRequirement(Saveable): +class WorkReuse(Saveable): """ - Define a list of files and subdirectories that must be created by the workflow platform in the designated output directory prior to executing the command line tool. + For implementations that support reusing output from past work (on the assumption that same code and same input produce same results), control whether to enable or disable the reuse behavior for a particular tool or step (to accommodate situations where that assumption is incorrect). A reused step is not executed but instead returns the same output as the original execution. + + If ``enableReuse`` is not specified, correct tools should assume it is enabled by default. + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, InitialWorkDirRequirement): - return bool(self.class_ == other.class_ and self.listing == other.listing) + if isinstance(other, WorkReuse): + return bool( + self.class_ == other.class_ and self.enableReuse == other.enableReuse + ) return False def __hash__(self) -> int: - return hash((self.class_, self.listing)) + return hash((self.class_, self.enableReuse)) @classmethod def fromDoc( @@ -17258,34 +16566,35 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_InitialWorkDirRequirement_classLoader_False_True_None_None, + uri_WorkReuse_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e try: - if _doc.get("listing") is None: - raise ValidationException("missing required field `listing`", None, []) + if _doc.get("enableReuse") is None: + raise ValidationException("missing required field `enableReuse`", None, []) - listing = load_field( - _doc.get("listing"), - union_of_array_of_union_of_None_type_or_FileLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader_or_DirectoryLoader_or_DirentLoader_or_ExpressionLoader_or_ExpressionLoader, + enableReuse = _load_field( + _doc.get("enableReuse"), + union_of_booltype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("listing") + lc=_doc.get("enableReuse") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `listing`": + if str(e) == "missing required field `enableReuse`": _errors__.append( ValidationException( str(e), @@ -17293,13 +16602,13 @@ def fromDoc( ) ) else: - val = _doc.get("listing") + val = _doc.get("enableReuse") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), + "the `enableReuse` field is not valid because:", + SourceLine(_doc, "enableReuse", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17311,10 +16620,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), + "the `enableReuse` field is not valid because:", + SourceLine(_doc, "enableReuse", str), [e], - detailed_message=f"the `listing` field with value `{val}` " + detailed_message=f"the `enableReuse` field with value `{val}` " "is not valid because:", ) ) @@ -17326,14 +16635,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `listing`".format( + "invalid field `{}`, expected one of: `class`, `enableReuse`".format( k ), SourceLine(_doc, k, str), @@ -17343,7 +16652,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - listing=listing, + enableReuse=enableReuse, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -17361,16 +16670,21 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.listing is not None: - r["listing"] = save( - self.listing, top=False, base_url=base_url, relative_uris=relative_uris + if self.enableReuse is not None: + r["enableReuse"] = save( + self.enableReuse, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -17383,7 +16697,7 @@ def save( def __init__( self, - listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str, + enableReuse: bool | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17395,27 +16709,35 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing + self.class_: Final[str] = "WorkReuse" + self.enableReuse = enableReuse - attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @mypyc_attr(native_class=True) -class EnvVarRequirement(Saveable): +class NetworkAccess(Saveable): """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. + Indicate whether a process requires outgoing IPv4/IPv6 network access. Choice of IPv4 or IPv6 is implementation and site specific, correct tools must support both. + + If ``networkAccess`` is false or not specified, tools must not assume network access, except for localhost (the loopback device). + + If ``networkAccess`` is true, the tool must be able to make outgoing connections to network resources. Resources may be on a private subnet or the public Internet. However, implementations and sites may apply their own security policies to restrict what is accessible by the tool. + + Enabling network access does not imply a publicly routable IP address or the ability to accept inbound connections. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, EnvVarRequirement): - return bool(self.class_ == other.class_ and self.envDef == other.envDef) + if isinstance(other, NetworkAccess): + return bool( + self.class_ == other.class_ + and self.networkAccess == other.networkAccess + ) return False def __hash__(self) -> int: - return hash((self.class_, self.envDef)) + return hash((self.class_, self.networkAccess)) @classmethod def fromDoc( @@ -17435,34 +16757,35 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_EnvVarRequirement_classLoader_False_True_None_None, + uri_NetworkAccess_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e try: - if _doc.get("envDef") is None: - raise ValidationException("missing required field `envDef`", None, []) + if _doc.get("networkAccess") is None: + raise ValidationException("missing required field `networkAccess`", None, []) - envDef = load_field( - _doc.get("envDef"), - idmap_envDef_array_of_EnvironmentDefLoader, + networkAccess = _load_field( + _doc.get("networkAccess"), + union_of_booltype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("envDef") + lc=_doc.get("networkAccess") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `envDef`": + if str(e) == "missing required field `networkAccess`": _errors__.append( ValidationException( str(e), @@ -17470,13 +16793,13 @@ def fromDoc( ) ) else: - val = _doc.get("envDef") + val = _doc.get("networkAccess") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `envDef` field is not valid because:", - SourceLine(_doc, "envDef", str), + "the `networkAccess` field is not valid because:", + SourceLine(_doc, "networkAccess", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17488,10 +16811,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `envDef` field is not valid because:", - SourceLine(_doc, "envDef", str), + "the `networkAccess` field is not valid because:", + SourceLine(_doc, "networkAccess", str), [e], - detailed_message=f"the `envDef` field with value `{val}` " + detailed_message=f"the `networkAccess` field with value `{val}` " "is not valid because:", ) ) @@ -17503,14 +16826,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `envDef`".format( + "invalid field `{}`, expected one of: `class`, `networkAccess`".format( k ), SourceLine(_doc, k, str), @@ -17520,7 +16843,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - envDef=envDef, + networkAccess=networkAccess, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -17538,16 +16861,21 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.envDef is not None: - r["envDef"] = save( - self.envDef, top=False, base_url=base_url, relative_uris=relative_uris + if self.networkAccess is not None: + r["networkAccess"] = save( + self.networkAccess, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -17560,7 +16888,7 @@ def save( def __init__( self, - envDef: Sequence[EnvironmentDef], + networkAccess: bool | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17572,32 +16900,37 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef + self.class_: Final[str] = "NetworkAccess" + self.networkAccess = networkAccess - attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @mypyc_attr(native_class=True) -class ShellCommandRequirement(Saveable): +class InplaceUpdateRequirement(Saveable): """ - Modify the behavior of CommandLineTool to generate a single string - containing a shell command line. Each item in the argument list must be - joined into a string separated by single spaces and quoted to prevent - interpretation by the shell, unless `CommandLineBinding` for that argument - contains `shellQuote: false`. If `shellQuote: false` is specified, the - argument is joined into the command string without quoting, which allows - the use of shell metacharacters such as `|` for pipes. + If ``inplaceUpdate`` is true, then an implementation supporting this feature may permit tools to directly update files with ``writable: true`` in InitialWorkDirRequirement. That is, as an optimization, files may be destructively modified in place as opposed to copied and updated. + + An implementation must ensure that only one workflow step may access a writable file at a time. It is an error if a file which is writable by one workflow step file is accessed (for reading or writing) by any other workflow step running independently. However, a file which has been updated in a previous completed step may be used as input to multiple steps, provided it is read-only in every step. + + Workflow steps which modify a file must produce the modified file as output. Downstream steps which further process the file must use the output of previous steps, and not refer to a common input (this is necessary for both ordering and correctness). + + Workflow authors should provide this in the ``hints`` section. The intent of this feature is that workflows produce the same results whether or not InplaceUpdateRequirement is supported by the implementation, and this feature is primarily available as an optimization for particular environments. + + Users and implementers should be aware that workflows that destructively modify inputs may not be repeatable or reproducible. In particular, enabling this feature implies that WorkReuse should not be enabled. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, ShellCommandRequirement): - return bool(self.class_ == other.class_) + if isinstance(other, InplaceUpdateRequirement): + return bool( + self.class_ == other.class_ + and self.inplaceUpdate == other.inplaceUpdate + ) return False def __hash__(self) -> int: - return hash((self.class_)) + return hash((self.class_, self.inplaceUpdate)) @classmethod def fromDoc( @@ -17617,18 +16950,67 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_ShellCommandRequirement_classLoader_False_True_None_None, + uri_InplaceUpdateRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("inplaceUpdate") is None: + raise ValidationException("missing required field `inplaceUpdate`", None, []) + + inplaceUpdate = _load_field( + _doc.get("inplaceUpdate"), + booltype, + baseuri, + loadingOptions, + lc=_doc.get("inplaceUpdate") + ) + except ValidationException as e: - raise e + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inplaceUpdate`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inplaceUpdate") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inplaceUpdate` field is not valid because:", + SourceLine(_doc, "inplaceUpdate", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inplaceUpdate` field is not valid because:", + SourceLine(_doc, "inplaceUpdate", str), + [e], + detailed_message=f"the `inplaceUpdate` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -17637,14 +17019,16 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), + "invalid field `{}`, expected one of: `class`, `inplaceUpdate`".format( + k + ), SourceLine(_doc, k, str), ) ) @@ -17652,6 +17036,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + inplaceUpdate=inplaceUpdate, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -17669,13 +17054,22 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u + if self.inplaceUpdate is not None: + r["inplaceUpdate"] = save( + self.inplaceUpdate, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) # top refers to the directory level if top: @@ -17687,6 +17081,7 @@ def save( def __init__( self, + inplaceUpdate: bool, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17698,66 +17093,28 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ShellCommandRequirement" + self.class_: Final[str] = "InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate - attrs: ClassVar[Collection[str]] = frozenset(["class"]) + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @mypyc_attr(native_class=True) -class ResourceRequirement(Saveable): +class ToolTimeLimit(Saveable): """ - Specify basic hardware resource requirements. - - "min" is the minimum amount of a resource that must be reserved to schedule - a job. If "min" cannot be satisfied, the job should not be run. - - "max" is the maximum amount of a resource that the job shall be permitted - to use. If a node has sufficient resources, multiple jobs may be scheduled - on a single node provided each job's "max" resource requirements are - met. If a job attempts to exceed its "max" resource allocation, an - implementation may deny additional resources, which may result in job - failure. - - If "min" is specified but "max" is not, then "max" == "min" - If "max" is specified by "min" is not, then "min" == "max". - - It is an error if max < min. - - It is an error if the value of any of these fields is negative. - - If neither "min" nor "max" is specified for a resource, use the default values below. + Set an upper limit on the execution time of a CommandLineTool. A CommandLineTool whose execution duration exceeds the time limit may be preemptively terminated and considered failed. May also be used by batch systems to make scheduling decisions. The execution duration excludes external operations, such as staging of files, pulling a docker image etc, and only counts wall-time for the execution of the command line itself. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, ResourceRequirement): + if isinstance(other, ToolTimeLimit): return bool( - self.class_ == other.class_ - and self.coresMin == other.coresMin - and self.coresMax == other.coresMax - and self.ramMin == other.ramMin - and self.ramMax == other.ramMax - and self.tmpdirMin == other.tmpdirMin - and self.tmpdirMax == other.tmpdirMax - and self.outdirMin == other.outdirMin - and self.outdirMax == other.outdirMax + self.class_ == other.class_ and self.timelimit == other.timelimit ) return False def __hash__(self) -> int: - return hash( - ( - self.class_, - self.coresMin, - self.coresMax, - self.ramMin, - self.ramMax, - self.tmpdirMin, - self.tmpdirMax, - self.outdirMin, - self.outdirMax, - ) - ) + return hash((self.class_, self.timelimit)) @classmethod def fromDoc( @@ -17777,33 +17134,214 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_ResourceRequirement_classLoader_False_True_None_None, + uri_ToolTimeLimit_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - coresMin = None - if "coresMin" in _doc: + raise e + try: + if _doc.get("timelimit") is None: + raise ValidationException("missing required field `timelimit`", None, []) + + timelimit = _load_field( + _doc.get("timelimit"), + union_of_inttype_or_longtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("timelimit") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `timelimit`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("timelimit") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `timelimit` field is not valid because:", + SourceLine(_doc, "timelimit", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `timelimit` field is not valid because:", + SourceLine(_doc, "timelimit", str), + [e], + detailed_message=f"the `timelimit` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `timelimit`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + timelimit=timelimit, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.timelimit is not None: + r["timelimit"] = save( + self.timelimit, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + timelimit: i32 | i64 | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ToolTimeLimit" + self.timelimit = timelimit + + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + + +@mypyc_attr(native_class=True) +class ExpressionToolOutputParameter(Saveable): + id: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, ExpressionToolOutputParameter): + return bool( + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format + and self.type_ == other.type_ + ) + return False + + def __hash__(self) -> int: + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.type_, + ) + ) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + id = None + if "id" in _doc: try: - coresMin = load_field( - _doc.get("coresMin"), - union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("coresMin") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `coresMin`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -17811,13 +17349,13 @@ def fromDoc( ) ) else: - val = _doc.get("coresMin") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `coresMin` field is not valid because:", - SourceLine(_doc, "coresMin", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17829,28 +17367,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `coresMin` field is not valid because:", - SourceLine(_doc, "coresMin", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `coresMin` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - coresMax = None - if "coresMax" in _doc: + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: try: - coresMax = load_field( - _doc.get("coresMax"), - union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("coresMax") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `coresMax`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -17858,13 +17405,13 @@ def fromDoc( ) ) else: - val = _doc.get("coresMax") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `coresMax` field is not valid because:", - SourceLine(_doc, "coresMax", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17876,28 +17423,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `coresMax` field is not valid because:", - SourceLine(_doc, "coresMax", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `coresMax` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - ramMin = None - if "ramMin" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - ramMin = load_field( - _doc.get("ramMin"), - union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("ramMin") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `ramMin`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -17905,13 +17452,13 @@ def fromDoc( ) ) else: - val = _doc.get("ramMin") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `ramMin` field is not valid because:", - SourceLine(_doc, "ramMin", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17923,28 +17470,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `ramMin` field is not valid because:", - SourceLine(_doc, "ramMin", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `ramMin` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - ramMax = None - if "ramMax" in _doc: + streamable = None + if "streamable" in _doc: try: - ramMax = load_field( - _doc.get("ramMax"), - union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("ramMax") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `ramMax`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -17952,13 +17499,13 @@ def fromDoc( ) ) else: - val = _doc.get("ramMax") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `ramMax` field is not valid because:", - SourceLine(_doc, "ramMax", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17970,28 +17517,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `ramMax` field is not valid because:", - SourceLine(_doc, "ramMax", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `ramMax` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - tmpdirMin = None - if "tmpdirMin" in _doc: + doc = None + if "doc" in _doc: try: - tmpdirMin = load_field( - _doc.get("tmpdirMin"), - union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("tmpdirMin") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `tmpdirMin`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -17999,13 +17546,13 @@ def fromDoc( ) ) else: - val = _doc.get("tmpdirMin") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `tmpdirMin` field is not valid because:", - SourceLine(_doc, "tmpdirMin", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18017,28 +17564,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `tmpdirMin` field is not valid because:", - SourceLine(_doc, "tmpdirMin", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `tmpdirMin` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - tmpdirMax = None - if "tmpdirMax" in _doc: + format = None + if "format" in _doc: try: - tmpdirMax = load_field( - _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, - lc=_doc.get("tmpdirMax") + lc=_doc.get("format") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `tmpdirMax`": + if str(e) == "missing required field `format`": _errors__.append( ValidationException( str(e), @@ -18046,13 +17593,13 @@ def fromDoc( ) ) else: - val = _doc.get("tmpdirMax") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `tmpdirMax` field is not valid because:", - SourceLine(_doc, "tmpdirMax", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18064,107 +17611,61 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `tmpdirMax` field is not valid because:", - SourceLine(_doc, "tmpdirMax", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `tmpdirMax` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) - outdirMin = None - if "outdirMin" in _doc: - try: - outdirMin = load_field( - _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("outdirMin") - ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) - if str(e) == "missing required field `outdirMin`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("outdirMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outdirMin` field is not valid because:", - SourceLine(_doc, "outdirMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outdirMin` field is not valid because:", - SourceLine(_doc, "outdirMin", str), - [e], - detailed_message=f"the `outdirMin` field with value `{val}` " - "is not valid because:", - ) - ) - outdirMax = None - if "outdirMax" in _doc: - try: - outdirMax = load_field( - _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("outdirMax") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outdirMax`": _errors__.append( ValidationException( - str(e), - None + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", ) ) - else: - val = _doc.get("outdirMax") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outdirMax` field is not valid because:", - SourceLine(_doc, "outdirMax", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outdirMax` field is not valid because:", - SourceLine(_doc, "outdirMax", str), - [e], - detailed_message=f"the `outdirMax` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -18173,14 +17674,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `coresMin`, `coresMax`, `ramMin`, `ramMax`, `tmpdirMin`, `tmpdirMax`, `outdirMin`, `outdirMax`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`".format( k ), SourceLine(_doc, k, str), @@ -18190,17 +17691,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - coresMin=coresMin, - coresMax=coresMax, - ramMin=ramMin, - ramMax=ramMax, - tmpdirMin=tmpdirMin, - tmpdirMax=tmpdirMax, - outdirMin=outdirMin, - outdirMax=outdirMax, + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -18214,57 +17715,37 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.coresMin is not None: - r["coresMin"] = save( - self.coresMin, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.coresMax is not None: - r["coresMax"] = save( - self.coresMax, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.ramMin is not None: - r["ramMin"] = save( - self.ramMin, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.ramMax is not None: - r["ramMax"] = save( - self.ramMax, top=False, base_url=base_url, relative_uris=relative_uris + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.tmpdirMin is not None: - r["tmpdirMin"] = save( - self.tmpdirMin, + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.tmpdirMax is not None: - r["tmpdirMax"] = save( - self.tmpdirMax, + if self.streamable is not None: + r["streamable"] = save( + self.streamable, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.outdirMin is not None: - r["outdirMin"] = save( - self.outdirMin, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.outdirMax is not None: - r["outdirMax"] = save( - self.outdirMax, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris ) # top refers to the directory level @@ -18277,14 +17758,13 @@ def save( def __init__( self, - coresMin: None | i32 | str = None, - coresMax: None | i32 | str = None, - ramMin: None | i32 | str = None, - ramMax: None | i32 | str = None, - tmpdirMin: None | i32 | str = None, - tmpdirMax: None | i32 | str = None, - outdirMin: None | i32 | str = None, - outdirMax: None | i32 | str = None, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -18296,55 +17776,56 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "coresMin", - "coresMax", - "ramMin", - "ramMax", - "tmpdirMin", - "tmpdirMax", - "outdirMin", - "outdirMax", - ] + ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] ) @mypyc_attr(native_class=True) -class WorkReuse(Saveable): - """ - For implementations that support reusing output from past work (on - the assumption that same code and same input produce same - results), control whether to enable or disable the reuse behavior - for a particular tool or step (to accommodate situations where that - assumption is incorrect). A reused step is not executed but - instead returns the same output as the original execution. - - If `enableReuse` is not specified, correct tools should assume it - is enabled by default. - - """ +class WorkflowInputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkReuse): + if isinstance(other, WorkflowInputParameter): return bool( - self.class_ == other.class_ and self.enableReuse == other.enableReuse + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.default == other.default + and self.type_ == other.type_ + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash((self.class_, self.enableReuse)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.loadContents, + self.loadListing, + self.default, + self.type_, + self.inputBinding, + ) + ) @classmethod def fromDoc( @@ -18360,3488 +17841,138 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) - class_ = load_field( - _doc.get("class"), - uri_WorkReuse_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("enableReuse") is None: - raise ValidationException("missing required field `enableReuse`", None, []) + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) - enableReuse = load_field( - _doc.get("enableReuse"), - union_of_booltype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("enableReuse") - ) + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `enableReuse`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("enableReuse") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `label`": _errors__.append( ValidationException( - "the `enableReuse` field is not valid because:", - SourceLine(_doc, "enableReuse", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - "the `enableReuse` field is not valid because:", - SourceLine(_doc, "enableReuse", str), - [e], - detailed_message=f"the `enableReuse` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `enableReuse`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - enableReuse=enableReuse, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.enableReuse is not None: - r["enableReuse"] = save( - self.enableReuse, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - enableReuse: bool | str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse - - attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) - - -@mypyc_attr(native_class=True) -class NetworkAccess(Saveable): - """ - Indicate whether a process requires outgoing IPv4/IPv6 network - access. Choice of IPv4 or IPv6 is implementation and site - specific, correct tools must support both. - - If `networkAccess` is false or not specified, tools must not - assume network access, except for localhost (the loopback device). - - If `networkAccess` is true, the tool must be able to make outgoing - connections to network resources. Resources may be on a private - subnet or the public Internet. However, implementations and sites - may apply their own security policies to restrict what is - accessible by the tool. - - Enabling network access does not imply a publicly routable IP - address or the ability to accept inbound connections. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, NetworkAccess): - return bool( - self.class_ == other.class_ - and self.networkAccess == other.networkAccess - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.networkAccess)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_NetworkAccess_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("networkAccess") is None: - raise ValidationException("missing required field `networkAccess`", None, []) - - networkAccess = load_field( - _doc.get("networkAccess"), - union_of_booltype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("networkAccess") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `networkAccess`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("networkAccess") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `networkAccess` field is not valid because:", - SourceLine(_doc, "networkAccess", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `networkAccess` field is not valid because:", - SourceLine(_doc, "networkAccess", str), - [e], - detailed_message=f"the `networkAccess` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `networkAccess`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - networkAccess=networkAccess, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.networkAccess is not None: - r["networkAccess"] = save( - self.networkAccess, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - networkAccess: bool | str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess - - attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) - - -@mypyc_attr(native_class=True) -class InplaceUpdateRequirement(Saveable): - """ - - If `inplaceUpdate` is true, then an implementation supporting this - feature may permit tools to directly update files with `writable: - true` in InitialWorkDirRequirement. That is, as an optimization, - files may be destructively modified in place as opposed to copied - and updated. - - An implementation must ensure that only one workflow step may - access a writable file at a time. It is an error if a file which - is writable by one workflow step file is accessed (for reading or - writing) by any other workflow step running independently. - However, a file which has been updated in a previous completed - step may be used as input to multiple steps, provided it is - read-only in every step. - - Workflow steps which modify a file must produce the modified file - as output. Downstream steps which further process the file must - use the output of previous steps, and not refer to a common input - (this is necessary for both ordering and correctness). - - Workflow authors should provide this in the `hints` section. The - intent of this feature is that workflows produce the same results - whether or not InplaceUpdateRequirement is supported by the - implementation, and this feature is primarily available as an - optimization for particular environments. - - Users and implementers should be aware that workflows that - destructively modify inputs may not be repeatable or reproducible. - In particular, enabling this feature implies that WorkReuse should - not be enabled. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, InplaceUpdateRequirement): - return bool( - self.class_ == other.class_ - and self.inplaceUpdate == other.inplaceUpdate - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.inplaceUpdate)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_InplaceUpdateRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("inplaceUpdate") is None: - raise ValidationException("missing required field `inplaceUpdate`", None, []) - - inplaceUpdate = load_field( - _doc.get("inplaceUpdate"), - booltype, - baseuri, - loadingOptions, - lc=_doc.get("inplaceUpdate") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inplaceUpdate`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inplaceUpdate") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inplaceUpdate` field is not valid because:", - SourceLine(_doc, "inplaceUpdate", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inplaceUpdate` field is not valid because:", - SourceLine(_doc, "inplaceUpdate", str), - [e], - detailed_message=f"the `inplaceUpdate` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `inplaceUpdate`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - inplaceUpdate=inplaceUpdate, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.inplaceUpdate is not None: - r["inplaceUpdate"] = save( - self.inplaceUpdate, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - inplaceUpdate: bool, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate - - attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) - - -@mypyc_attr(native_class=True) -class ToolTimeLimit(Saveable): - """ - Set an upper limit on the execution time of a CommandLineTool. - A CommandLineTool whose execution duration exceeds the time - limit may be preemptively terminated and considered failed. - May also be used by batch systems to make scheduling decisions. - The execution duration excludes external operations, such as - staging of files, pulling a docker image etc, and only counts - wall-time for the execution of the command line itself. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ToolTimeLimit): - return bool( - self.class_ == other.class_ and self.timelimit == other.timelimit - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.timelimit)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ToolTimeLimit_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("timelimit") is None: - raise ValidationException("missing required field `timelimit`", None, []) - - timelimit = load_field( - _doc.get("timelimit"), - union_of_inttype_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("timelimit") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `timelimit`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("timelimit") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `timelimit` field is not valid because:", - SourceLine(_doc, "timelimit", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `timelimit` field is not valid because:", - SourceLine(_doc, "timelimit", str), - [e], - detailed_message=f"the `timelimit` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `timelimit`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - timelimit=timelimit, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.timelimit is not None: - r["timelimit"] = save( - self.timelimit, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - timelimit: i32 | str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ToolTimeLimit" - self.timelimit = timelimit - - attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) - - -@mypyc_attr(native_class=True) -class ExpressionToolOutputParameter(Saveable): - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ExpressionToolOutputParameter): - return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.type_ == other.type_ - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.type_, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset( - ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] - ) - - -@mypyc_attr(native_class=True) -class WorkflowInputParameter(Saveable): - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowInputParameter): - return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.default == other.default - and self.type_ == other.type_ - and self.inputBinding == other.inputBinding - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.loadContents, - self.loadListing, - self.default, - self.type_, - self.inputBinding, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadContents`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadContents") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [e], - detailed_message=f"the `loadContents` field with value `{val}` " - "is not valid because:", - ) - ) - loadListing = None - if "loadListing" in _doc: - try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, - baseuri, - loadingOptions, - lc=_doc.get("loadListing") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadListing`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadListing") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [e], - detailed_message=f"the `loadListing` field with value `{val}` " - "is not valid because:", - ) - ) - default = None - if "default" in _doc: - try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, - baseuri, - loadingOptions, - lc=_doc.get("default") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `default`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("default") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [e], - detailed_message=f"the `default` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_InputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`, `inputBinding`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - loadContents=loadContents, - loadListing=loadListing, - default=default, - type_=type_, - inputBinding=inputBinding, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - default: CWLObjectType | None = None, - inputBinding: InputBinding | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "loadContents", - "loadListing", - "default", - "type", - "inputBinding", - ] - ) - - -@mypyc_attr(native_class=True) -class ExpressionTool(Saveable): - """ - An ExpressionTool is a type of Process object that can be run by itself - or as a Workflow step. It executes a pure Javascript expression that has - access to the same input parameters as a workflow. It is meant to be used - sparingly as a way to isolate complex Javascript expressions that need to - operate on input data and produce some result; perhaps just a - rearrangement of the inputs. No Docker software container is required - or allowed. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ExpressionTool): - return bool( - self.id == other.id - and self.label == other.label - and self.doc == other.doc - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.cwlVersion == other.cwlVersion - and self.class_ == other.class_ - and self.expression == other.expression - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.label, - self.doc, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.cwlVersion, - self.class_, - self.expression, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ExpressionTool_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_WorkflowInputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) - - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_ExpressionToolOutputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [e], - detailed_message=f"the `outputs` field with value `{val}` " - "is not valid because:", - ) - ) - requirements = None - if "requirements" in _doc: - try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, - baseuri, - loadingOptions, - lc=_doc.get("requirements") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `requirements`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("requirements") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [e], - detailed_message=f"the `requirements` field with value `{val}` " - "is not valid because:", - ) - ) - hints = None - if "hints" in _doc: - try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("hints") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `hints`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("hints") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [e], - detailed_message=f"the `hints` field with value `{val}` " - "is not valid because:", - ) - ) - cwlVersion = None - if "cwlVersion" in _doc: - try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("cwlVersion") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cwlVersion`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cwlVersion") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("expression") is None: - raise ValidationException("missing required field `expression`", None, []) - - expression = load_field( - _doc.get("expression"), - ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("expression") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `expression`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("expression") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `expression` field is not valid because:", - SourceLine(_doc, "expression", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `expression` field is not valid because:", - SourceLine(_doc, "expression", str), - [e], - detailed_message=f"the `expression` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `class`, `expression`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - doc=doc, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - cwlVersion=cwlVersion, - expression=expression, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) - r["class"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.expression is not None: - r["expression"] = save( - self.expression, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - inputs: Sequence[WorkflowInputParameter], - outputs: Sequence[ExpressionToolOutputParameter], - expression: str, - id: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: CWLVersion | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_: Final[str] = "ExpressionTool" - self.expression = expression - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "label", - "doc", - "inputs", - "outputs", - "requirements", - "hints", - "cwlVersion", - "class", - "expression", - ] - ) - - -@mypyc_attr(native_class=True) -class WorkflowOutputParameter(Saveable): - """ - Describe an output parameter of a workflow. The parameter must be - connected to one or more parameters defined in the workflow that - will provide the value of the output parameter. It is legal to - connect a WorkflowInputParameter to a WorkflowOutputParameter. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowOutputParameter): - return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.outputSource == other.outputSource - and self.linkMerge == other.linkMerge - and self.type_ == other.type_ - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.outputSource, - self.linkMerge, - self.type_, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - outputSource = None - if "outputSource" in _doc: - try: - outputSource = load_field( - _doc.get("outputSource"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None, - baseuri, - loadingOptions, - lc=_doc.get("outputSource") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputSource`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputSource") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputSource` field is not valid because:", - SourceLine(_doc, "outputSource", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputSource` field is not valid because:", - SourceLine(_doc, "outputSource", str), - [e], - detailed_message=f"the `outputSource` field with value `{val}` " - "is not valid because:", - ) - ) - linkMerge = None - if "linkMerge" in _doc: - try: - linkMerge = load_field( - _doc.get("linkMerge"), - union_of_None_type_or_LinkMergeMethodLoader, - baseuri, - loadingOptions, - lc=_doc.get("linkMerge") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `linkMerge`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("linkMerge") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [e], - detailed_message=f"the `linkMerge` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `outputSource`, `linkMerge`, `type`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - outputSource=outputSource, - linkMerge=linkMerge, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.outputSource is not None: - u = save_relative_uri(self.outputSource, self.id, False, 1, relative_uris) - r["outputSource"] = u - if self.linkMerge is not None: - r["linkMerge"] = save( - self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | str = None, - outputSource: None | Sequence[str] | str = None, - linkMerge: LinkMergeMethod | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "outputSource", - "linkMerge", - "type", - ] - ) - - -@mypyc_attr(native_class=True) -class WorkflowStepInput(Saveable): - """ - The input of a workflow step connects an upstream parameter (from the - workflow inputs, or the outputs of other workflows steps) with the input - parameters of the process specified by the `run` field. Only input parameters - declared by the target process will be passed through at runtime to the process - though additional parameters may be specified (for use within `valueFrom` - expressions for instance) - unconnected or unused parameters do not represent an - error condition. - - ## Input object - - A WorkflowStepInput object must contain an `id` field in the form - `#fieldname` or `#prefix/fieldname`. When the `id` field contains a slash - `/` the field name consists of the characters following the final slash - (the prefix portion may contain one or more slashes to indicate scope). - This defines a field of the workflow step input object with the value of - the `source` parameter(s). - - ## Merging - - To merge multiple inbound data links, - [MultipleInputFeatureRequirement](#MultipleInputFeatureRequirement) must be specified - in the workflow or workflow step requirements. - - If the sink parameter is an array, or named in a [workflow - scatter](#WorkflowStep) operation, there may be multiple inbound data links - listed in the `source` field. The values from the input links are merged - depending on the method specified in the `linkMerge` field. If not - specified, the default method is "merge_nested". - - * **merge_nested** - - The input must be an array consisting of exactly one entry for each - input link. If "merge_nested" is specified with a single link, the value - from the link must be wrapped in a single-item list. - - * **merge_flattened** - - 1. The source and sink parameters must be compatible types, or the source - type must be compatible with single element from the "items" type of - the destination array parameter. - 2. Source parameters which are arrays are concatenated. - Source parameters which are single element types are appended as - single elements. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStepInput): - return bool( - self.id == other.id - and self.source == other.source - and self.linkMerge == other.linkMerge - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.label == other.label - and self.default == other.default - and self.valueFrom == other.valueFrom - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.source, - self.linkMerge, - self.loadContents, - self.loadListing, - self.label, - self.default, - self.valueFrom, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - source = None - if "source" in _doc: - try: - source = load_field( - _doc.get("source"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None, - baseuri, - loadingOptions, - lc=_doc.get("source") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `source`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("source") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `source` field is not valid because:", - SourceLine(_doc, "source", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -21853,28 +17984,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `source` field is not valid because:", - SourceLine(_doc, "source", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `source` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - linkMerge = None - if "linkMerge" in _doc: + streamable = None + if "streamable" in _doc: try: - linkMerge = load_field( - _doc.get("linkMerge"), - union_of_None_type_or_LinkMergeMethodLoader, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("linkMerge") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `linkMerge`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -21882,13 +18013,13 @@ def fromDoc( ) ) else: - val = _doc.get("linkMerge") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -21900,28 +18031,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `linkMerge` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - loadContents = None - if "loadContents" in _doc: + doc = None + if "doc" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -21929,13 +18060,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -21947,28 +18078,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - loadListing = None - if "loadListing" in _doc: + format = None + if "format" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, - lc=_doc.get("loadListing") + lc=_doc.get("format") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": + if str(e) == "missing required field `format`": _errors__.append( ValidationException( str(e), @@ -21976,13 +18107,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadListing") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -21994,28 +18125,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `loadListing` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("loadContents") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( str(e), @@ -22023,13 +18154,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("loadContents") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -22041,28 +18172,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `loadContents` field with value `{val}` " "is not valid because:", ) ) - default = None - if "default" in _doc: + loadListing = None + if "loadListing" in _doc: try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, baseuri, loadingOptions, - lc=_doc.get("default") + lc=_doc.get("loadListing") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `default`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -22070,13 +18201,13 @@ def fromDoc( ) ) else: - val = _doc.get("default") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -22088,28 +18219,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `default` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " "is not valid because:", ) ) - valueFrom = None - if "valueFrom" in _doc: + default = None + if "default" in _doc: try: - valueFrom = load_field( - _doc.get("valueFrom"), - union_of_None_type_or_strtype_or_ExpressionLoader, + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, baseuri, loadingOptions, - lc=_doc.get("valueFrom") + lc=_doc.get("default") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `valueFrom`": + if str(e) == "missing required field `default`": _errors__.append( ValidationException( str(e), @@ -22117,13 +18248,13 @@ def fromDoc( ) ) else: - val = _doc.get("valueFrom") + val = _doc.get("default") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -22135,205 +18266,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), [e], - detailed_message=f"the `valueFrom` field with value `{val}` " + detailed_message=f"the `default` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `source`, `linkMerge`, `loadContents`, `loadListing`, `label`, `default`, `valueFrom`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - source=source, - linkMerge=linkMerge, - loadContents=loadContents, - loadListing=loadListing, - label=label, - default=default, - valueFrom=valueFrom, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.source is not None: - u = save_relative_uri(self.source, self.id, False, 2, relative_uris) - r["source"] = u - if self.linkMerge is not None: - r["linkMerge"] = save( - self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.valueFrom is not None: - r["valueFrom"] = save( - self.valueFrom, top=False, base_url=self.id, relative_uris=relative_uris + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") ) - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - source: None | Sequence[str] | str = None, - linkMerge: LinkMergeMethod | None = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - label: None | str = None, - default: CWLObjectType | None = None, - valueFrom: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id - self.source = source - self.linkMerge = linkMerge - self.loadContents = loadContents - self.loadListing = loadListing - self.label = label - self.default = default - self.valueFrom = valueFrom - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "source", - "linkMerge", - "loadContents", - "loadListing", - "label", - "default", - "valueFrom", - ] - ) - - -@mypyc_attr(native_class=True) -class WorkflowStepOutput(Saveable): - """ - Associate an output parameter of the underlying process with a workflow - parameter. The workflow parameter (given in the `id` field) be may be used - as a `source` to connect with input parameters of other workflow steps, or - with an output parameter of the process. - - A unique identifier for this workflow output parameter. This is - the identifier to use in the `source` field of `WorkflowStepInput` - to connect the output value to downstream parameters. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStepOutput): - return bool(self.id == other.id) - return False - - def __hash__(self) -> int: - return hash((self.id)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + inputBinding = None + if "inputBinding" in _doc: try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_InputBindingLoader, baseuri, loadingOptions, - lc=_doc.get("id") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -22341,13 +18343,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -22359,22 +18361,13 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -22383,14 +18376,16 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`".format(k), + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`, `inputBinding`".format( + k + ), SourceLine(_doc, k, str), ) ) @@ -22399,6 +18394,16 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + loadContents=loadContents, + loadListing=loadListing, + default=default, + type_=type_, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -22419,6 +18424,60 @@ def save( if self.id is not None: u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) # top refers to the directory level if top: @@ -22431,6 +18490,16 @@ def save( def __init__( self, id: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + inputBinding: InputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -22442,87 +18511,57 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding - attrs: ClassVar[Collection[str]] = frozenset(["id"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "loadContents", + "loadListing", + "default", + "type", + "inputBinding", + ] + ) @mypyc_attr(native_class=True) -class WorkflowStep(Saveable): +class ExpressionTool(Saveable): """ - A workflow step is an executable element of a workflow. It specifies the - underlying process implementation (such as `CommandLineTool` or another - `Workflow`) in the `run` field and connects the input and output parameters - of the underlying process to workflow parameters. - - # Scatter/gather - - To use scatter/gather, - [ScatterFeatureRequirement](#ScatterFeatureRequirement) must be specified - in the workflow or workflow step requirements. - - A "scatter" operation specifies that the associated workflow step or - subworkflow should execute separately over a list of input elements. Each - job making up a scatter operation is independent and may be executed - concurrently. - - The `scatter` field specifies one or more input parameters which will be - scattered. An input parameter may be listed more than once. The declared - type of each input parameter is implicitly becomes an array of items of the - input parameter type. If a parameter is listed more than once, it becomes - a nested array. As a result, upstream parameters which are connected to - scattered parameters must be arrays. - - All output parameter types are also implicitly wrapped in arrays. Each job - in the scatter results in an entry in the output array. - - If any scattered parameter runtime value is an empty array, all outputs are - set to empty arrays and no work is done for the step, according to - applicable scattering rules. - - If `scatter` declares more than one input parameter, `scatterMethod` - describes how to decompose the input into a discrete set of jobs. - - * **dotproduct** specifies that each of the input arrays are aligned and one - element taken from each array to construct each job. It is an error - if all input arrays are not the same length. - - * **nested_crossproduct** specifies the Cartesian product of the inputs, - producing a job for every combination of the scattered inputs. The - output must be nested arrays for each level of scattering, in the - order that the input arrays are listed in the `scatter` field. - - * **flat_crossproduct** specifies the Cartesian product of the inputs, - producing a job for every combination of the scattered inputs. The - output arrays must be flattened to a single level, but otherwise listed in the - order that the input arrays are listed in the `scatter` field. - - # Subworkflows - - To specify a nested workflow as part of a workflow step, - [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be - specified in the workflow or workflow step requirements. - - It is a fatal error if a workflow directly or indirectly invokes itself as - a subworkflow (recursive workflows are not allowed). + An ExpressionTool is a type of Process object that can be run by itself or as a Workflow step. It executes a pure Javascript expression that has access to the same input parameters as a workflow. It is meant to be used sparingly as a way to isolate complex Javascript expressions that need to operate on input data and produce some result; perhaps just a rearrangement of the inputs. No Docker software container is required or allowed. """ id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStep): + if isinstance(other, ExpressionTool): return bool( self.id == other.id and self.label == other.label and self.doc == other.doc - and self.in_ == other.in_ - and self.out == other.out + and self.inputs == other.inputs + and self.outputs == other.outputs and self.requirements == other.requirements and self.hints == other.hints - and self.run == other.run - and self.scatter == other.scatter - and self.scatterMethod == other.scatterMethod + and self.cwlVersion == other.cwlVersion + and self.class_ == other.class_ + and self.expression == other.expression ) return False @@ -22532,13 +18571,13 @@ def __hash__(self) -> int: self.id, self.label, self.doc, - self.in_, - self.out, + self.inputs, + self.outputs, self.requirements, self.hints, - self.run, - self.scatter, - self.scatterMethod, + self.cwlVersion, + self.class_, + self.expression, ) ) @@ -22559,9 +18598,9 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), - uri_strtype_True_False_None_None, + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("id") @@ -22608,14 +18647,30 @@ def fromDoc( if docRoot is not None: id = docRoot else: - id = "" - _errors__.append(ValidationException("missing id")) + id = "_:" + str(_uuid__.uuid4()) else: baseuri = id + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_ExpressionTool_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -22662,7 +18717,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -22707,21 +18762,21 @@ def fromDoc( ) ) try: - if _doc.get("in") is None: - raise ValidationException("missing required field `in`", None, []) + if _doc.get("inputs") is None: + raise ValidationException("missing required field `inputs`", None, []) - in_ = load_field( - _doc.get("in"), - idmap_in__array_of_WorkflowStepInputLoader, + inputs = _load_field( + _doc.get("inputs"), + idmap_inputs_array_of_WorkflowInputParameterLoader, baseuri, loadingOptions, - lc=_doc.get("in") + lc=_doc.get("inputs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `in`": + if str(e) == "missing required field `inputs`": _errors__.append( ValidationException( str(e), @@ -22729,13 +18784,13 @@ def fromDoc( ) ) else: - val = _doc.get("in") + val = _doc.get("inputs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `in` field is not valid because:", - SourceLine(_doc, "in", str), + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -22747,29 +18802,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `in` field is not valid because:", - SourceLine(_doc, "in", str), + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), [e], - detailed_message=f"the `in` field with value `{val}` " + detailed_message=f"the `inputs` field with value `{val}` " "is not valid because:", ) ) try: - if _doc.get("out") is None: - raise ValidationException("missing required field `out`", None, []) + if _doc.get("outputs") is None: + raise ValidationException("missing required field `outputs`", None, []) - out = load_field( - _doc.get("out"), - uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None, + outputs = _load_field( + _doc.get("outputs"), + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, baseuri, loadingOptions, - lc=_doc.get("out") + lc=_doc.get("outputs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `out`": + if str(e) == "missing required field `outputs`": _errors__.append( ValidationException( str(e), @@ -22777,13 +18832,13 @@ def fromDoc( ) ) else: - val = _doc.get("out") + val = _doc.get("outputs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `out` field is not valid because:", - SourceLine(_doc, "out", str), + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -22795,19 +18850,19 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `out` field is not valid because:", - SourceLine(_doc, "out", str), + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), [e], - detailed_message=f"the `out` field with value `{val}` " + detailed_message=f"the `outputs` field with value `{val}` " "is not valid because:", ) ) requirements = None if "requirements" in _doc: try: - requirements = load_field( + requirements = _load_field( _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, baseuri, loadingOptions, lc=_doc.get("requirements") @@ -22852,9 +18907,9 @@ def fromDoc( hints = None if "hints" in _doc: try: - hints = load_field( + hints = _load_field( _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_Any_type, + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, baseuri, loadingOptions, lc=_doc.get("hints") @@ -22896,71 +18951,21 @@ def fromDoc( "is not valid because:", ) ) - - subscope_baseuri = expand_url('run', baseuri, loadingOptions, True) - try: - if _doc.get("run") is None: - raise ValidationException("missing required field `run`", None, []) - - run = load_field( - _doc.get("run"), - uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None, - subscope_baseuri, - loadingOptions, - lc=_doc.get("run") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `run`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("run") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), - [e], - detailed_message=f"the `run` field with value `{val}` " - "is not valid because:", - ) - ) - scatter = None - if "scatter" in _doc: + cwlVersion = None + if "cwlVersion" in _doc: try: - scatter = load_field( - _doc.get("scatter"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None, + cwlVersion = _load_field( + _doc.get("cwlVersion"), + uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("scatter") + lc=_doc.get("cwlVersion") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `scatter`": + if str(e) == "missing required field `cwlVersion`": _errors__.append( ValidationException( str(e), @@ -22968,13 +18973,13 @@ def fromDoc( ) ) else: - val = _doc.get("scatter") + val = _doc.get("cwlVersion") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `scatter` field is not valid because:", - SourceLine(_doc, "scatter", str), + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -22986,60 +18991,61 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `scatter` field is not valid because:", - SourceLine(_doc, "scatter", str), + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), [e], - detailed_message=f"the `scatter` field with value `{val}` " + detailed_message=f"the `cwlVersion` field with value `{val}` " "is not valid because:", ) ) - scatterMethod = None - if "scatterMethod" in _doc: - try: - scatterMethod = load_field( - _doc.get("scatterMethod"), - uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("scatterMethod") - ) + try: + if _doc.get("expression") is None: + raise ValidationException("missing required field `expression`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + expression = _load_field( + _doc.get("expression"), + ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("expression") + ) - if str(e) == "missing required field `scatterMethod`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `expression`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("expression") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `expression` field is not valid because:", + SourceLine(_doc, "expression", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("scatterMethod") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `scatterMethod` field is not valid because:", - SourceLine(_doc, "scatterMethod", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `scatterMethod` field is not valid because:", - SourceLine(_doc, "scatterMethod", str), - [e], - detailed_message=f"the `scatterMethod` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `expression` field is not valid because:", + SourceLine(_doc, "expression", str), + [e], + detailed_message=f"the `expression` field with value `{val}` " + "is not valid because:", ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -23048,14 +19054,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `in`, `out`, `requirements`, `hints`, `run`, `scatter`, `scatterMethod`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `class`, `expression`".format( k ), SourceLine(_doc, k, str), @@ -23068,13 +19074,12 @@ def fromDoc( id=id, label=label, doc=doc, - in_=in_, - out=out, + inputs=inputs, + outputs=outputs, requirements=requirements, hints=hints, - run=run, - scatter=scatter, - scatterMethod=scatterMethod, + cwlVersion=cwlVersion, + expression=expression, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -23095,6 +19100,16 @@ def save( if self.id is not None: u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, self.id, False, None, relative_uris) + r["class"] = u if self.label is not None: r["label"] = save( self.label, top=False, base_url=self.id, relative_uris=relative_uris @@ -23103,13 +19118,14 @@ def save( r["doc"] = save( self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.in_ is not None: - r["in"] = save( - self.in_, top=False, base_url=self.id, relative_uris=relative_uris + if self.inputs is not None: + r["inputs"] = save( + self.inputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputs is not None: + r["outputs"] = save( + self.outputs, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.out is not None: - u = save_relative_uri(self.out, self.id, True, None, relative_uris) - r["out"] = u if self.requirements is not None: r["requirements"] = save( self.requirements, @@ -23121,17 +19137,16 @@ def save( r["hints"] = save( self.hints, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.run is not None: - u = save_relative_uri(self.run, self.id, False, None, relative_uris) - r["run"] = u - if self.scatter is not None: - u = save_relative_uri(self.scatter, self.id, False, 0, relative_uris) - r["scatter"] = u - if self.scatterMethod is not None: - u = save_relative_uri( - self.scatterMethod, self.id, False, None, relative_uris + if self.cwlVersion is not None: + u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) + r["cwlVersion"] = u + if self.expression is not None: + r["expression"] = save( + self.expression, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) - r["scatterMethod"] = u # top refers to the directory level if top: @@ -23143,16 +19158,15 @@ def save( def __init__( self, - id: str, - in_: Sequence[WorkflowStepInput], - out: Sequence[WorkflowStepOutput | str], - run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any] = None, - scatter: None | Sequence[str] | str = None, - scatterMethod: None | ScatterMethod = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23164,115 +19178,69 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) self.label = label self.doc = doc - self.in_ = in_ - self.out = out + self.inputs = inputs + self.outputs = outputs self.requirements = requirements self.hints = hints - self.run = run - self.scatter = scatter - self.scatterMethod = scatterMethod + self.cwlVersion = cwlVersion + self.class_: Final[str] = "ExpressionTool" + self.expression = expression attrs: ClassVar[Collection[str]] = frozenset( [ "id", "label", "doc", - "in", - "out", + "inputs", + "outputs", "requirements", "hints", - "run", - "scatter", - "scatterMethod", + "cwlVersion", + "class", + "expression", ] ) @mypyc_attr(native_class=True) -class Workflow(Saveable): +class WorkflowOutputParameter(Saveable): """ - A workflow describes a set of **steps** and the **dependencies** between - those steps. When a step produces output that will be consumed by a - second step, the first step is a dependency of the second step. - - When there is a dependency, the workflow engine must execute the preceding - step and wait for it to successfully produce output before executing the - dependent step. If two steps are defined in the workflow graph that - are not directly or indirectly dependent, these steps are **independent**, - and may execute in any order or execute concurrently. A workflow is - complete when all steps have been executed. - - Dependencies between parameters are expressed using the `source` field on - [workflow step input parameters](#WorkflowStepInput) and [workflow output - parameters](#WorkflowOutputParameter). - - The `source` field expresses the dependency of one parameter on another - such that when a value is associated with the parameter specified by - `source`, that value is propagated to the destination parameter. When all - data links inbound to a given step are fulfilled, the step is ready to - execute. - - ## Workflow success and failure - - A completed step must result in one of `success`, `temporaryFailure` or - `permanentFailure` states. An implementation may choose to retry a step - execution which resulted in `temporaryFailure`. An implementation may - choose to either continue running other steps of a workflow, or terminate - immediately upon `permanentFailure`. - - * If any step of a workflow execution results in `permanentFailure`, then - the workflow status is `permanentFailure`. - - * If one or more steps result in `temporaryFailure` and all other steps - complete `success` or are not executed, then the workflow status is - `temporaryFailure`. - - * If all workflow steps are executed and complete with `success`, then the - workflow status is `success`. - - # Extensions - - [ScatterFeatureRequirement](#ScatterFeatureRequirement) and - [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) are - available as standard [extensions](#Extensions_and_Metadata) to core - workflow semantics. + Describe an output parameter of a workflow. The parameter must be connected to one or more parameters defined in the workflow that will provide the value of the output parameter. It is legal to connect a WorkflowInputParameter to a WorkflowOutputParameter. """ id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, Workflow): - return bool( - self.id == other.id - and self.label == other.label - and self.doc == other.doc - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.cwlVersion == other.cwlVersion - and self.class_ == other.class_ - and self.steps == other.steps + if isinstance(other, WorkflowOutputParameter): + return bool( + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format + and self.outputSource == other.outputSource + and self.linkMerge == other.linkMerge + and self.type_ == other.type_ ) return False def __hash__(self) -> int: return hash( ( - self.id, self.label, + self.secondaryFiles, + self.streamable, self.doc, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.cwlVersion, - self.class_, - self.steps, + self.id, + self.format, + self.outputSource, + self.linkMerge, + self.type_, ) ) @@ -23293,9 +19261,9 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, + uri_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("id") @@ -23342,29 +19310,14 @@ def fromDoc( if docRoot is not None: id = docRoot else: - id = "_:" + str(_uuid__.uuid4()) + id = "" + _errors__.append(ValidationException("missing id")) else: baseuri = id - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_Workflow_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -23408,21 +19361,21 @@ def fromDoc( "is not valid because:", ) ) - doc = None - if "doc" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -23430,13 +19383,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -23448,124 +19401,122 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_WorkflowInputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) - - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_WorkflowOutputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputs") - ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [e], - detailed_message=f"the `outputs` field with value `{val}` " - "is not valid because:", + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - requirements = None - if "requirements" in _doc: + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, - lc=_doc.get("requirements") + lc=_doc.get("format") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `requirements`": + if str(e) == "missing required field `format`": _errors__.append( ValidationException( str(e), @@ -23573,13 +19524,13 @@ def fromDoc( ) ) else: - val = _doc.get("requirements") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -23591,28 +19542,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `requirements` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) - hints = None - if "hints" in _doc: + outputSource = None + if "outputSource" in _doc: try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + outputSource = _load_field( + _doc.get("outputSource"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None, baseuri, loadingOptions, - lc=_doc.get("hints") + lc=_doc.get("outputSource") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `hints`": + if str(e) == "missing required field `outputSource`": _errors__.append( ValidationException( str(e), @@ -23620,13 +19571,13 @@ def fromDoc( ) ) else: - val = _doc.get("hints") + val = _doc.get("outputSource") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), + "the `outputSource` field is not valid because:", + SourceLine(_doc, "outputSource", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -23638,28 +19589,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), + "the `outputSource` field is not valid because:", + SourceLine(_doc, "outputSource", str), [e], - detailed_message=f"the `hints` field with value `{val}` " + detailed_message=f"the `outputSource` field with value `{val}` " "is not valid because:", ) ) - cwlVersion = None - if "cwlVersion" in _doc: + linkMerge = None + if "linkMerge" in _doc: try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, + linkMerge = _load_field( + _doc.get("linkMerge"), + union_of_None_type_or_LinkMergeMethodLoader, baseuri, loadingOptions, - lc=_doc.get("cwlVersion") + lc=_doc.get("linkMerge") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `cwlVersion`": + if str(e) == "missing required field `linkMerge`": _errors__.append( ValidationException( str(e), @@ -23667,13 +19618,13 @@ def fromDoc( ) ) else: - val = _doc.get("cwlVersion") + val = _doc.get("linkMerge") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -23685,29 +19636,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " + detailed_message=f"the `linkMerge` field with value `{val}` " "is not valid because:", ) ) try: - if _doc.get("steps") is None: - raise ValidationException("missing required field `steps`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - steps = load_field( - _doc.get("steps"), - idmap_steps_union_of_array_of_WorkflowStepLoader, + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, - lc=_doc.get("steps") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `steps`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -23715,13 +19666,13 @@ def fromDoc( ) ) else: - val = _doc.get("steps") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `steps` field is not valid because:", - SourceLine(_doc, "steps", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -23733,10 +19684,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `steps` field is not valid because:", - SourceLine(_doc, "steps", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `steps` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) @@ -23748,14 +19699,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `class`, `steps`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `outputSource`, `linkMerge`, `type`".format( k ), SourceLine(_doc, k, str), @@ -23767,13 +19718,13 @@ def fromDoc( _constructed = cls( id=id, label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, doc=doc, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - cwlVersion=cwlVersion, - steps=steps, + format=format, + outputSource=outputSource, + linkMerge=linkMerge, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -23794,47 +19745,41 @@ def save( if self.id is not None: u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) - r["class"] = u if self.label is not None: r["label"] = save( self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, + if self.streamable is not None: + r["streamable"] = save( + self.streamable, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.steps is not None: - r["steps"] = save( - self.steps, top=False, base_url=self.id, relative_uris=relative_uris + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.outputSource is not None: + u = save_relative_uri(self.outputSource, self.id, False, 1, relative_uris) + r["outputSource"] = u + if self.linkMerge is not None: + r["linkMerge"] = save( + self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris ) # top refers to the directory level @@ -23847,15 +19792,15 @@ def save( def __init__( self, - inputs: Sequence[WorkflowInputParameter], - outputs: Sequence[WorkflowOutputParameter], - steps: Sequence[WorkflowStep], - id: None | str = None, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: CWLVersion | None = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -23867,48 +19812,88 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.class_: Final[str] = "Workflow" - self.steps = steps + self.id = id + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ - "id", "label", + "secondaryFiles", + "streamable", "doc", - "inputs", - "outputs", - "requirements", - "hints", - "cwlVersion", - "class", - "steps", + "id", + "format", + "outputSource", + "linkMerge", + "type", ] ) @mypyc_attr(native_class=True) -class SubworkflowFeatureRequirement(Saveable): +class WorkflowStepInput(Saveable): """ - Indicates that the workflow platform must support nested workflows in - the `run` field of [WorkflowStep](#WorkflowStep). + The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input parameters of the process specified by the ``run`` field. Only input parameters declared by the target process will be passed through at runtime to the process though additional parameters may be specified (for use within ``valueFrom`` expressions for instance) - unconnected or unused parameters do not represent an error condition. + + Input object + ------------ + + A WorkflowStepInput object must contain an ``id`` field in the form ``#fieldname`` or ``#prefix/fieldname``. When the ``id`` field contains a slash ``/`` the field name consists of the characters following the final slash (the prefix portion may contain one or more slashes to indicate scope). This defines a field of the workflow step input object with the value of the ``source`` parameter(s). + + Merging + ------- + + To merge multiple inbound data links, `MultipleInputFeatureRequirement <#MultipleInputFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. + + If the sink parameter is an array, or named in a `workflow scatter <#WorkflowStep>`__ operation, there may be multiple inbound data links listed in the ``source`` field. The values from the input links are merged depending on the method specified in the ``linkMerge`` field. If not specified, the default method is "merge_nested". + + * **merge_nested** + + The input must be an array consisting of exactly one entry for each input link. If "merge_nested" is specified with a single link, the value from the link must be wrapped in a single-item list. + + * **merge_flattened** + + 1. The source and sink parameters must be compatible types, or the source type must be compatible with single element from the "items" type of the destination array parameter. + 2. Source parameters which are arrays are concatenated. Source parameters which are single element types are appended as single elements. """ + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, SubworkflowFeatureRequirement): - return bool(self.class_ == other.class_) + if isinstance(other, WorkflowStepInput): + return bool( + self.id == other.id + and self.source == other.source + and self.linkMerge == other.linkMerge + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.label == other.label + and self.default == other.default + and self.valueFrom == other.valueFrom + ) return False def __hash__(self) -> int: - return hash((self.class_)) + return hash( + ( + self.id, + self.source, + self.linkMerge, + self.loadContents, + self.loadListing, + self.label, + self.default, + self.valueFrom, + ) + ) @classmethod def fromDoc( @@ -23920,146 +19905,395 @@ def fromDoc( ) -> Self: _doc = copy.copy(doc) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + source = None + if "source" in _doc: + try: + source = _load_field( + _doc.get("source"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None, + baseuri, + loadingOptions, + lc=_doc.get("source") + ) - class_ = load_field( - _doc.get("class"), - uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + if str(e) == "missing required field `source`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("source") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `source` field is not valid because:", + SourceLine(_doc, "source", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `source` field is not valid because:", + SourceLine(_doc, "source", str), + [e], + detailed_message=f"the `source` field with value `{val}` " + "is not valid because:", + ) + ) + linkMerge = None + if "linkMerge" in _doc: + try: + linkMerge = _load_field( + _doc.get("linkMerge"), + union_of_None_type_or_LinkMergeMethodLoader, + baseuri, + loadingOptions, + lc=_doc.get("linkMerge") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `linkMerge`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), + str(e), + None ) ) + else: + val = _doc.get("linkMerge") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), + [e], + detailed_message=f"the `linkMerge` field with value `{val}` " + "is not valid because:", + ) + ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SubworkflowFeatureRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + if str(e) == "missing required field `loadContents`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) + loadListing = None + if "loadListing" in _doc: + try: + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, + baseuri, + loadingOptions, + lc=_doc.get("loadListing") + ) -@mypyc_attr(native_class=True) -class ScatterFeatureRequirement(Saveable): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - """ + if str(e) == "missing required field `loadListing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadListing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), + [e], + detailed_message=f"the `loadListing` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) - def __eq__(self, other: Any) -> bool: - if isinstance(other, ScatterFeatureRequirement): - return bool(self.class_ == other.class_) - return False + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - def __hash__(self) -> int: - return hash((self.class_)) + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + default = None + if "default" in _doc: + try: + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, + baseuri, + loadingOptions, + lc=_doc.get("default") + ) - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if str(e) == "missing required field `default`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("default") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [e], + detailed_message=f"the `default` field with value `{val}` " + "is not valid because:", + ) + ) + valueFrom = None + if "valueFrom" in _doc: + try: + valueFrom = _load_field( + _doc.get("valueFrom"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("valueFrom") + ) - class_ = load_field( - _doc.get("class"), - uri_ScatterFeatureRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + if str(e) == "missing required field `valueFrom`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("valueFrom") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), + [e], + detailed_message=f"the `valueFrom` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -24068,14 +20302,16 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), + "invalid field `{}`, expected one of: `id`, `source`, `linkMerge`, `loadContents`, `loadListing`, `label`, `default`, `valueFrom`".format( + k + ), SourceLine(_doc, k, str), ) ) @@ -24083,9 +20319,18 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, + source=source, + linkMerge=linkMerge, + loadContents=loadContents, + loadListing=loadListing, + label=label, + default=default, + valueFrom=valueFrom, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -24099,14 +20344,42 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.source is not None: + u = save_relative_uri(self.source, self.id, False, 2, relative_uris) + r["source"] = u + if self.linkMerge is not None: + r["linkMerge"] = save( + self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.valueFrom is not None: + r["valueFrom"] = save( + self.valueFrom, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -24118,6 +20391,14 @@ def save( def __init__( self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + label: None | str = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -24129,26 +20410,47 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ScatterFeatureRequirement" + self.id = id + self.source = source + self.linkMerge = linkMerge + self.loadContents = loadContents + self.loadListing = loadListing + self.label = label + self.default = default + self.valueFrom = valueFrom - attrs: ClassVar[Collection[str]] = frozenset(["class"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "source", + "linkMerge", + "loadContents", + "loadListing", + "label", + "default", + "valueFrom", + ] + ) @mypyc_attr(native_class=True) -class MultipleInputFeatureRequirement(Saveable): +class WorkflowStepOutput(Saveable): """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). + Associate an output parameter of the underlying process with a workflow parameter. The workflow parameter (given in the ``id`` field) be may be used as a ``source`` to connect with input parameters of other workflow steps, or with an output parameter of the process. + + A unique identifier for this workflow output parameter. This is the identifier to use in the ``source`` field of ``WorkflowStepInput`` to connect the output value to downstream parameters. """ + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, MultipleInputFeatureRequirement): - return bool(self.class_ == other.class_) + if isinstance(other, WorkflowStepOutput): + return bool(self.id == other.id) return False def __hash__(self) -> int: - return hash((self.class_)) + return hash((self.id)) @classmethod def fromDoc( @@ -24164,22 +20466,62 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) - class_ = load_field( - _doc.get("class"), - uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -24188,14 +20530,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), + "invalid field `{}`, expected one of: `id`".format(k), SourceLine(_doc, k, str), ) ) @@ -24203,9 +20545,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -24219,14 +20563,9 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u # top refers to the directory level if top: @@ -24238,6 +20577,7 @@ def save( def __init__( self, + id: str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -24249,26 +20589,79 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "MultipleInputFeatureRequirement" + self.id = id - attrs: ClassVar[Collection[str]] = frozenset(["class"]) + attrs: ClassVar[Collection[str]] = frozenset(["id"]) @mypyc_attr(native_class=True) -class StepInputExpressionRequirement(Saveable): +class WorkflowStep(schema_salad.metaschema.Documented): """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). + A workflow step is an executable element of a workflow. It specifies the underlying process implementation (such as ``CommandLineTool`` or another ``Workflow``) in the ``run`` field and connects the input and output parameters of the underlying process to workflow parameters. + + Scatter/gather + ============== + + To use scatter/gather, `ScatterFeatureRequirement <#ScatterFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. + + A "scatter" operation specifies that the associated workflow step or subworkflow should execute separately over a list of input elements. Each job making up a scatter operation is independent and may be executed concurrently. + + The ``scatter`` field specifies one or more input parameters which will be scattered. An input parameter may be listed more than once. The declared type of each input parameter is implicitly becomes an array of items of the input parameter type. If a parameter is listed more than once, it becomes a nested array. As a result, upstream parameters which are connected to scattered parameters must be arrays. + + All output parameter types are also implicitly wrapped in arrays. Each job in the scatter results in an entry in the output array. + + If any scattered parameter runtime value is an empty array, all outputs are set to empty arrays and no work is done for the step, according to applicable scattering rules. + + If ``scatter`` declares more than one input parameter, ``scatterMethod`` describes how to decompose the input into a discrete set of jobs. + + * **dotproduct** specifies that each of the input arrays are aligned and one element taken from each array to construct each job. It is an error if all input arrays are not the same length. + + * **nested_crossproduct** specifies the Cartesian product of the inputs, producing a job for every combination of the scattered inputs. The output must be nested arrays for each level of scattering, in the order that the input arrays are listed in the ``scatter`` field. + + * **flat_crossproduct** specifies the Cartesian product of the inputs, producing a job for every combination of the scattered inputs. The output arrays must be flattened to a single level, but otherwise listed in the order that the input arrays are listed in the ``scatter`` field. + + Subworkflows + ============ + + To specify a nested workflow as part of a workflow step, `SubworkflowFeatureRequirement <#SubworkflowFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. + + It is a fatal error if a workflow directly or indirectly invokes itself as a subworkflow (recursive workflows are not allowed). """ + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, StepInputExpressionRequirement): - return bool(self.class_ == other.class_) + if isinstance(other, WorkflowStep): + return bool( + self.id == other.id + and self.label == other.label + and self.doc == other.doc + and self.in_ == other.in_ + and self.out == other.out + and self.requirements == other.requirements + and self.hints == other.hints + and self.run == other.run + and self.scatter == other.scatter + and self.scatterMethod == other.scatterMethod + ) return False def __hash__(self) -> int: - return hash((self.class_)) + return hash( + ( + self.id, + self.label, + self.doc, + self.in_, + self.out, + self.requirements, + self.hints, + self.run, + self.scatter, + self.scatterMethod, + ) + ) @classmethod def fromDoc( @@ -24284,152 +20677,364 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if _doc.get("in") is None: + raise ValidationException("missing required field `in`", None, []) - class_ = load_field( - _doc.get("class"), - uri_StepInputExpressionRequirement_classLoader_False_True_None_None, + in_ = _load_field( + _doc.get("in"), + idmap_in__array_of_WorkflowStepInputLoader, baseuri, loadingOptions, - lc=_doc.get("class") + lc=_doc.get("in") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `in`": + _errors__.append( + ValidationException( + str(e), + None ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + else: + val = _doc.get("in") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `in` field is not valid because:", + SourceLine(_doc, "in", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), + "the `in` field is not valid because:", + SourceLine(_doc, "in", str), + [e], + detailed_message=f"the `in` field with value `{val}` " + "is not valid because:", ) ) + try: + if _doc.get("out") is None: + raise ValidationException("missing required field `out`", None, []) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed + out = _load_field( + _doc.get("out"), + uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("out") + ) - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" + if str(e) == "missing required field `out`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "StepInputExpressionRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class Secrets(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, Secrets): - return bool(self.class_ == other.class_ and self.secrets == other.secrets) - return False + val = _doc.get("out") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `out` field is not valid because:", + SourceLine(_doc, "out", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `out` field is not valid because:", + SourceLine(_doc, "out", str), + [e], + detailed_message=f"the `out` field with value `{val}` " + "is not valid because:", + ) + ) + requirements = None + if "requirements" in _doc: + try: + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, + baseuri, + loadingOptions, + lc=_doc.get("requirements") + ) - def __hash__(self) -> int: - return hash((self.class_, self.secrets)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) + if str(e) == "missing required field `requirements`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("requirements") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [e], + detailed_message=f"the `requirements` field with value `{val}` " + "is not valid because:", + ) + ) + hints = None + if "hints" in _doc: + try: + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_Any_type, + baseuri, + loadingOptions, + lc=_doc.get("hints") + ) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + if str(e) == "missing required field `hints`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("hints") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), + [e], + detailed_message=f"the `hints` field with value `{val}` " + "is not valid because:", + ) + ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + subscope_baseuri = _expand_url('run', baseuri, loadingOptions, True) try: - if _doc.get("secrets") is None: - raise ValidationException("missing required field `secrets`", None, []) + if _doc.get("run") is None: + raise ValidationException("missing required field `run`", None, []) - secrets = load_field( - _doc.get("secrets"), - uri_array_of_strtype_False_False_0_None, - baseuri, + run = _load_field( + _doc.get("run"), + uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_False_False_None_None, + subscope_baseuri, loadingOptions, - lc=_doc.get("secrets") + lc=_doc.get("run") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secrets`": + if str(e) == "missing required field `run`": _errors__.append( ValidationException( str(e), @@ -24437,13 +21042,13 @@ def fromDoc( ) ) else: - val = _doc.get("secrets") + val = _doc.get("run") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secrets` field is not valid because:", - SourceLine(_doc, "secrets", str), + "the `run` field is not valid because:", + SourceLine(_doc, "run", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -24455,13 +21060,107 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secrets` field is not valid because:", - SourceLine(_doc, "secrets", str), + "the `run` field is not valid because:", + SourceLine(_doc, "run", str), [e], - detailed_message=f"the `secrets` field with value `{val}` " + detailed_message=f"the `run` field with value `{val}` " "is not valid because:", ) ) + scatter = None + if "scatter" in _doc: + try: + scatter = _load_field( + _doc.get("scatter"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None, + baseuri, + loadingOptions, + lc=_doc.get("scatter") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `scatter`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("scatter") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `scatter` field is not valid because:", + SourceLine(_doc, "scatter", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `scatter` field is not valid because:", + SourceLine(_doc, "scatter", str), + [e], + detailed_message=f"the `scatter` field with value `{val}` " + "is not valid because:", + ) + ) + scatterMethod = None + if "scatterMethod" in _doc: + try: + scatterMethod = _load_field( + _doc.get("scatterMethod"), + uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("scatterMethod") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `scatterMethod`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("scatterMethod") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `scatterMethod` field is not valid because:", + SourceLine(_doc, "scatterMethod", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `scatterMethod` field is not valid because:", + SourceLine(_doc, "scatterMethod", str), + [e], + detailed_message=f"the `scatterMethod` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -24470,14 +21169,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `secrets`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `in`, `out`, `requirements`, `hints`, `run`, `scatter`, `scatterMethod`".format( k ), SourceLine(_doc, k, str), @@ -24487,10 +21186,20 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - secrets=secrets, + id=id, + label=label, + doc=doc, + in_=in_, + out=out, + requirements=requirements, + hints=hints, + run=run, + scatter=scatter, + scatterMethod=scatterMethod, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -24504,17 +21213,46 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.secrets is not None: - u = save_relative_uri(self.secrets, base_url, False, 0, relative_uris) - r["secrets"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.in_ is not None: + r["in"] = save( + self.in_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.out is not None: + u = save_relative_uri(self.out, self.id, True, None, relative_uris) + r["out"] = u + if self.requirements is not None: + r["requirements"] = save( + self.requirements, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.run is not None: + u = save_relative_uri(self.run, self.id, False, None, relative_uris) + r["run"] = u + if self.scatter is not None: + u = save_relative_uri(self.scatter, self.id, False, 0, relative_uris) + r["scatter"] = u + if self.scatterMethod is not None: + u = save_relative_uri( + self.scatterMethod, self.id, False, None, relative_uris + ) + r["scatterMethod"] = u # top refers to the directory level if top: @@ -24526,7 +21264,16 @@ def save( def __init__( self, - secrets: Sequence[str], + id: str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | Workflow | str, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any] = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: None | ScatterMethod = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -24538,18 +21285,66 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "Secrets" - self.secrets = secrets + self.id = id + self.label = label + self.doc = doc + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.run = run + self.scatter = scatter + self.scatterMethod = scatterMethod - attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "label", + "doc", + "in", + "out", + "requirements", + "hints", + "run", + "scatter", + "scatterMethod", + ] + ) @mypyc_attr(native_class=True) -class ProcessGenerator(Saveable): +class Workflow(Saveable): + """ + A workflow describes a set of **steps** and the **dependencies** between those steps. When a step produces output that will be consumed by a second step, the first step is a dependency of the second step. + + When there is a dependency, the workflow engine must execute the preceding step and wait for it to successfully produce output before executing the dependent step. If two steps are defined in the workflow graph that are not directly or indirectly dependent, these steps are **independent**, and may execute in any order or execute concurrently. A workflow is complete when all steps have been executed. + + Dependencies between parameters are expressed using the ``source`` field on `workflow step input parameters <#WorkflowStepInput>`__ and `workflow output parameters <#WorkflowOutputParameter>`__. + + The ``source`` field expresses the dependency of one parameter on another such that when a value is associated with the parameter specified by ``source``, that value is propagated to the destination parameter. When all data links inbound to a given step are fulfilled, the step is ready to execute. + + Workflow success and failure + ---------------------------- + + A completed step must result in one of ``success``, ``temporaryFailure`` or ``permanentFailure`` states. An implementation may choose to retry a step execution which resulted in ``temporaryFailure``. An implementation may choose to either continue running other steps of a workflow, or terminate immediately upon ``permanentFailure``. + + * If any step of a workflow execution results in ``permanentFailure``, then the workflow status is ``permanentFailure``. + + * If one or more steps result in ``temporaryFailure`` and all other steps complete ``success`` or are not executed, then the workflow status is ``temporaryFailure``. + + * If all workflow steps are executed and complete with ``success``, then the workflow status is ``success``. + + Extensions + ========== + + `ScatterFeatureRequirement <#ScatterFeatureRequirement>`__ and `SubworkflowFeatureRequirement <#SubworkflowFeatureRequirement>`__ are available as standard `extensions <#Extensions_and_Metadata>`__ to core workflow semantics. + + """ + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, ProcessGenerator): + if isinstance(other, Workflow): return bool( self.id == other.id and self.label == other.label @@ -24560,7 +21355,7 @@ def __eq__(self, other: Any) -> bool: and self.hints == other.hints and self.cwlVersion == other.cwlVersion and self.class_ == other.class_ - and self.run == other.run + and self.steps == other.steps ) return False @@ -24576,7 +21371,7 @@ def __hash__(self) -> int: self.hints, self.cwlVersion, self.class_, - self.run, + self.steps, ) ) @@ -24597,7 +21392,7 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -24653,22 +21448,23 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_Workflow_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -24715,7 +21511,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -24763,7 +21559,7 @@ def fromDoc( if _doc.get("inputs") is None: raise ValidationException("missing required field `inputs`", None, []) - inputs = load_field( + inputs = _load_field( _doc.get("inputs"), idmap_inputs_array_of_WorkflowInputParameterLoader, baseuri, @@ -24811,9 +21607,9 @@ def fromDoc( if _doc.get("outputs") is None: raise ValidationException("missing required field `outputs`", None, []) - outputs = load_field( + outputs = _load_field( _doc.get("outputs"), - idmap_outputs_array_of_ExpressionToolOutputParameterLoader, + idmap_outputs_array_of_WorkflowOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -24858,9 +21654,9 @@ def fromDoc( requirements = None if "requirements" in _doc: try: - requirements = load_field( + requirements = _load_field( _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, baseuri, loadingOptions, lc=_doc.get("requirements") @@ -24905,9 +21701,9 @@ def fromDoc( hints = None if "hints" in _doc: try: - hints = load_field( + hints = _load_field( _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, baseuri, loadingOptions, lc=_doc.get("hints") @@ -24952,7 +21748,7 @@ def fromDoc( cwlVersion = None if "cwlVersion" in _doc: try: - cwlVersion = load_field( + cwlVersion = _load_field( _doc.get("cwlVersion"), uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, baseuri, @@ -24996,24 +21792,22 @@ def fromDoc( "is not valid because:", ) ) - - subscope_baseuri = expand_url('run', baseuri, loadingOptions, True) try: - if _doc.get("run") is None: - raise ValidationException("missing required field `run`", None, []) + if _doc.get("steps") is None: + raise ValidationException("missing required field `steps`", None, []) - run = load_field( - _doc.get("run"), - uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None, - subscope_baseuri, + steps = _load_field( + _doc.get("steps"), + idmap_steps_union_of_array_of_WorkflowStepLoader, + baseuri, loadingOptions, - lc=_doc.get("run") + lc=_doc.get("steps") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `run`": + if str(e) == "missing required field `steps`": _errors__.append( ValidationException( str(e), @@ -25021,13 +21815,13 @@ def fromDoc( ) ) else: - val = _doc.get("run") + val = _doc.get("steps") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), + "the `steps` field is not valid because:", + SourceLine(_doc, "steps", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25039,10 +21833,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), + "the `steps` field is not valid because:", + SourceLine(_doc, "steps", str), [e], - detailed_message=f"the `run` field with value `{val}` " + detailed_message=f"the `steps` field with value `{val}` " "is not valid because:", ) ) @@ -25054,14 +21848,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `class`, `run`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `class`, `steps`".format( k ), SourceLine(_doc, k, str), @@ -25079,7 +21873,7 @@ def fromDoc( requirements=requirements, hints=hints, cwlVersion=cwlVersion, - run=run, + steps=steps, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -25101,8 +21895,10 @@ def save( u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ @@ -25138,9 +21934,10 @@ def save( if self.cwlVersion is not None: u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) r["cwlVersion"] = u - if self.run is not None: - u = save_relative_uri(self.run, self.id, False, None, relative_uris) - r["run"] = u + if self.steps is not None: + r["steps"] = save( + self.steps, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -25153,13 +21950,13 @@ def save( def __init__( self, inputs: Sequence[WorkflowInputParameter], - outputs: Sequence[ExpressionToolOutputParameter], - run: CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str, + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], id: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, cwlVersion: CWLVersion | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -25180,8 +21977,8 @@ def __init__( self.requirements = requirements self.hints = hints self.cwlVersion = cwlVersion - self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "Workflow" + self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -25194,27 +21991,25 @@ def __init__( "hints", "cwlVersion", "class", - "run", + "steps", ] ) @mypyc_attr(native_class=True) -class MPIRequirement(Saveable): +class SubworkflowFeatureRequirement(Saveable): """ - Indicates that a process requires an MPI runtime. + Indicates that the workflow platform must support nested workflows in the ``run`` field of `WorkflowStep <#WorkflowStep>`__. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, MPIRequirement): - return bool( - self.class_ == other.class_ and self.processes == other.processes - ) + if isinstance(other, SubworkflowFeatureRequirement): + return bool(self.class_ == other.class_) return False def __hash__(self) -> int: - return hash((self.class_, self.processes)) + return hash((self.class_)) @classmethod def fromDoc( @@ -25234,66 +22029,19 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("processes") is None: - raise ValidationException("missing required field `processes`", None, []) - - processes = load_field( - _doc.get("processes"), - union_of_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("processes") - ) - + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `processes`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("processes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `processes` field is not valid because:", - SourceLine(_doc, "processes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `processes` field is not valid because:", - SourceLine(_doc, "processes", str), - [e], - detailed_message=f"the `processes` field with value `{val}` " - "is not valid because:", - ) - ) + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -25302,16 +22050,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `processes`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -25319,7 +22065,6 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - processes=processes, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -25337,20 +22082,15 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.processes is not None: - r["processes"] = save( - self.processes, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -25362,7 +22102,6 @@ def save( def __init__( self, - processes: i32 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25374,40 +22113,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "MPIRequirement" - self.processes = processes + self.class_: Final[str] = "SubworkflowFeatureRequirement" - attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) @mypyc_attr(native_class=True) -class CUDARequirement(Saveable): +class ScatterFeatureRequirement(Saveable): """ - Require support for NVIDA CUDA (GPU hardware acceleration). + Indicates that the workflow platform must support the ``scatter`` and ``scatterMethod`` fields of `WorkflowStep <#WorkflowStep>`__. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CUDARequirement): - return bool( - self.class_ == other.class_ - and self.cudaComputeCapability == other.cudaComputeCapability - and self.cudaDeviceCountMax == other.cudaDeviceCountMax - and self.cudaDeviceCountMin == other.cudaDeviceCountMin - and self.cudaVersionMin == other.cudaVersionMin - ) + if isinstance(other, ScatterFeatureRequirement): + return bool(self.class_ == other.class_) return False def __hash__(self) -> int: - return hash( - ( - self.class_, - self.cudaComputeCapability, - self.cudaDeviceCountMax, - self.cudaDeviceCountMin, - self.cudaVersionMin, - ) - ) + return hash((self.class_)) @classmethod def fromDoc( @@ -25427,208 +22151,141 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_ScatterFeatureRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("cudaComputeCapability") is None: - raise ValidationException("missing required field `cudaComputeCapability`", None, []) - - cudaComputeCapability = load_field( - _doc.get("cudaComputeCapability"), - union_of_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("cudaComputeCapability") - ) - + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cudaComputeCapability`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaComputeCapability") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + raise e + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - "the `cudaComputeCapability` field is not valid because:", - SourceLine(_doc, "cudaComputeCapability", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "the `cudaComputeCapability` field is not valid because:", - SourceLine(_doc, "cudaComputeCapability", str), - [e], - detailed_message=f"the `cudaComputeCapability` field with value `{val}` " - "is not valid because:", + "invalid field `{}`, expected one of: `class`".format(k), + SourceLine(_doc, k, str), ) ) - cudaDeviceCountMax = None - if "cudaDeviceCountMax" in _doc: - try: - cudaDeviceCountMax = load_field( - _doc.get("cudaDeviceCountMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("cudaDeviceCountMax") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `cudaDeviceCountMax`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaDeviceCountMax") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cudaDeviceCountMax` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMax", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cudaDeviceCountMax` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMax", str), - [e], - detailed_message=f"the `cudaDeviceCountMax` field with value `{val}` " - "is not valid because:", - ) - ) - cudaDeviceCountMin = None - if "cudaDeviceCountMin" in _doc: - try: - cudaDeviceCountMin = load_field( - _doc.get("cudaDeviceCountMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("cudaDeviceCountMin") - ) + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u - if str(e) == "missing required field `cudaDeviceCountMin`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaDeviceCountMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cudaDeviceCountMin` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cudaDeviceCountMin` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMin", str), - [e], - detailed_message=f"the `cudaDeviceCountMin` field with value `{val}` " - "is not valid because:", - ) - ) + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ScatterFeatureRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class MultipleInputFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support multiple inbound data links listed in the ``source`` field of `WorkflowStepInput <#WorkflowStepInput>`__. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, MultipleInputFeatureRequirement): + return bool(self.class_ == other.class_) + return False + + def __hash__(self) -> int: + return hash((self.class_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] try: - if _doc.get("cudaVersionMin") is None: - raise ValidationException("missing required field `cudaVersionMin`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - cudaVersionMin = load_field( - _doc.get("cudaVersionMin"), - strtype, + class_ = _load_field( + _doc.get("class"), + uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("cudaVersionMin") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cudaVersionMin`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaVersionMin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cudaVersionMin` field is not valid because:", - SourceLine(_doc, "cudaVersionMin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cudaVersionMin` field is not valid because:", - SourceLine(_doc, "cudaVersionMin", str), - [e], - detailed_message=f"the `cudaVersionMin` field with value `{val}` " - "is not valid because:", - ) - ) + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -25637,16 +22294,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `cudaComputeCapability`, `cudaDeviceCountMax`, `cudaDeviceCountMin`, `cudaVersionMin`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -25654,10 +22309,6 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - cudaComputeCapability=cudaComputeCapability, - cudaDeviceCountMax=cudaDeviceCountMax, - cudaDeviceCountMin=cudaDeviceCountMin, - cudaVersionMin=cudaVersionMin, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -25675,41 +22326,15 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.cudaComputeCapability is not None: - r["cudaComputeCapability"] = save( - self.cudaComputeCapability, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.cudaDeviceCountMax is not None: - r["cudaDeviceCountMax"] = save( - self.cudaDeviceCountMax, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.cudaDeviceCountMin is not None: - r["cudaDeviceCountMin"] = save( - self.cudaDeviceCountMin, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.cudaVersionMin is not None: - r["cudaVersionMin"] = save( - self.cudaVersionMin, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -25721,10 +22346,6 @@ def save( def __init__( self, - cudaComputeCapability: Sequence[str] | str, - cudaVersionMin: str, - cudaDeviceCountMax: None | i32 | str = None, - cudaDeviceCountMin: None | i32 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25736,32 +22357,25 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.class_: Final[str] = "MultipleInputFeatureRequirement" - attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "cudaComputeCapability", - "cudaDeviceCountMax", - "cudaDeviceCountMin", - "cudaVersionMin", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) @mypyc_attr(native_class=True) -class ShmSize(Saveable): +class StepInputExpressionRequirement(Saveable): + """ + Indicate that the workflow platform must support the ``valueFrom`` field of `WorkflowStepInput <#WorkflowStepInput>`__. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, ShmSize): - return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) + if isinstance(other, StepInputExpressionRequirement): + return bool(self.class_ == other.class_) return False def __hash__(self) -> int: - return hash((self.class_, self.shmSize)) + return hash((self.class_)) @classmethod def fromDoc( @@ -25781,66 +22395,19 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_StepInputExpressionRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("shmSize") is None: - raise ValidationException("missing required field `shmSize`", None, []) - - shmSize = load_field( - _doc.get("shmSize"), - strtype, - baseuri, - loadingOptions, - lc=_doc.get("shmSize") - ) - + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `shmSize`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("shmSize") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `shmSize` field is not valid because:", - SourceLine(_doc, "shmSize", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `shmSize` field is not valid because:", - SourceLine(_doc, "shmSize", str), - [e], - detailed_message=f"the `shmSize` field with value `{val}` " - "is not valid because:", - ) - ) + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -25849,16 +22416,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `shmSize`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -25866,7 +22431,6 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - shmSize=shmSize, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -25884,17 +22448,15 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.shmSize is not None: - r["shmSize"] = save( - self.shmSize, top=False, base_url=base_url, relative_uris=relative_uris - ) # top refers to the directory level if top: @@ -25906,7 +22468,6 @@ def save( def __init__( self, - shmSize: str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25918,16 +22479,14 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.class_: Final[str] = "StepInputExpressionRequirement" - attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) _vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", - "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", "CWLArraySchema": "https://w3id.org/cwl/cwl#CWLArraySchema", "CWLInputFile": "https://w3id.org/cwl/cwl#CWLInputFile", "CWLObjectType": "https://w3id.org/cwl/cwl#CWLObjectType", @@ -25982,7 +22541,6 @@ def __init__( "LoadContents": "https://w3id.org/cwl/cwl#LoadContents", "LoadListingEnum": "https://w3id.org/cwl/cwl#LoadListingEnum", "LoadListingRequirement": "https://w3id.org/cwl/cwl#LoadListingRequirement", - "MPIRequirement": "http://commonwl.org/cwltool#MPIRequirement", "MapSchema": "https://w3id.org/cwl/salad#MapSchema", "MultipleInputFeatureRequirement": "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement", "NetworkAccess": "https://w3id.org/cwl/cwl#NetworkAccess", @@ -25996,7 +22554,6 @@ def __init__( "Parameter": "https://w3id.org/cwl/cwl#Parameter", "PrimitiveType": "https://w3id.org/cwl/salad#PrimitiveType", "Process": "https://w3id.org/cwl/cwl#Process", - "ProcessGenerator": "http://commonwl.org/cwltool#ProcessGenerator", "ProcessRequirement": "https://w3id.org/cwl/cwl#ProcessRequirement", "RecordField": "https://w3id.org/cwl/salad#RecordField", "RecordSchema": "https://w3id.org/cwl/salad#RecordSchema", @@ -26005,9 +22562,7 @@ def __init__( "ScatterMethod": "https://w3id.org/cwl/cwl#ScatterMethod", "SchemaDefRequirement": "https://w3id.org/cwl/cwl#SchemaDefRequirement", "SecondaryFileSchema": "https://w3id.org/cwl/cwl#SecondaryFileSchema", - "Secrets": "http://commonwl.org/cwltool#Secrets", "ShellCommandRequirement": "https://w3id.org/cwl/cwl#ShellCommandRequirement", - "ShmSize": "http://commonwl.org/cwltool#ShmSize", "Sink": "https://w3id.org/cwl/cwl#Sink", "SoftwarePackage": "https://w3id.org/cwl/cwl#SoftwarePackage", "SoftwareRequirement": "https://w3id.org/cwl/cwl#SoftwareRequirement", @@ -26050,7 +22605,6 @@ def __init__( _rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", - "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", "https://w3id.org/cwl/cwl#CWLArraySchema": "CWLArraySchema", "https://w3id.org/cwl/cwl#CWLInputFile": "CWLInputFile", "https://w3id.org/cwl/cwl#CWLObjectType": "CWLObjectType", @@ -26105,7 +22659,6 @@ def __init__( "https://w3id.org/cwl/cwl#LoadContents": "LoadContents", "https://w3id.org/cwl/cwl#LoadListingEnum": "LoadListingEnum", "https://w3id.org/cwl/cwl#LoadListingRequirement": "LoadListingRequirement", - "http://commonwl.org/cwltool#MPIRequirement": "MPIRequirement", "https://w3id.org/cwl/salad#MapSchema": "MapSchema", "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement": "MultipleInputFeatureRequirement", "https://w3id.org/cwl/cwl#NetworkAccess": "NetworkAccess", @@ -26119,7 +22672,6 @@ def __init__( "https://w3id.org/cwl/cwl#Parameter": "Parameter", "https://w3id.org/cwl/salad#PrimitiveType": "PrimitiveType", "https://w3id.org/cwl/cwl#Process": "Process", - "http://commonwl.org/cwltool#ProcessGenerator": "ProcessGenerator", "https://w3id.org/cwl/cwl#ProcessRequirement": "ProcessRequirement", "https://w3id.org/cwl/salad#RecordField": "RecordField", "https://w3id.org/cwl/salad#RecordSchema": "RecordSchema", @@ -26128,9 +22680,7 @@ def __init__( "https://w3id.org/cwl/cwl#ScatterMethod": "ScatterMethod", "https://w3id.org/cwl/cwl#SchemaDefRequirement": "SchemaDefRequirement", "https://w3id.org/cwl/cwl#SecondaryFileSchema": "SecondaryFileSchema", - "http://commonwl.org/cwltool#Secrets": "Secrets", "https://w3id.org/cwl/cwl#ShellCommandRequirement": "ShellCommandRequirement", - "http://commonwl.org/cwltool#ShmSize": "ShmSize", "https://w3id.org/cwl/cwl#Sink": "Sink", "https://w3id.org/cwl/cwl#SoftwarePackage": "SoftwarePackage", "https://w3id.org/cwl/cwl#SoftwareRequirement": "SoftwareRequirement", @@ -26173,11 +22723,11 @@ def __init__( strtype: Final[_Loader[str]] = _PrimitiveLoader(str) inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) floattype: Final[_Loader[float]] = _PrimitiveLoader(float) booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) Any_type: Final[_Loader[Any]] = _AnyLoader() -longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) PrimitiveType: TypeAlias = Literal[ "null", "boolean", "int", "long", "float", "double", "string" ] @@ -26196,15 +22746,20 @@ def __init__( """ Names of salad data types (based on Avro schema declarations). -Refer to the [Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for -detailed information. +Refer to the `Avro schema declaration documentation `__ for detailed information. null: no value + boolean: a binary value + int: 32-bit signed integer + long: 64-bit signed integer + float: single precision (32-bit) IEEE 754 floating-point number + double: double precision (64-bit) IEEE 754 floating-point number + string: Unicode character sequence """ Any_: TypeAlias = Literal["Any"] @@ -26212,14 +22767,24 @@ def __init__( """ The **Any** type validates for any non-null value. """ -RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) -RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( - RecordSchema, None, None +RecordFieldLoader: Final[_Loader[schema_salad.metaschema.RecordField]] = _RecordLoader( + schema_salad.metaschema.RecordField, None, None +) +RecordSchemaLoader: Final[_Loader[schema_salad.metaschema.RecordSchema]] = ( + _RecordLoader(schema_salad.metaschema.RecordSchema, None, None) +) +EnumSchemaLoader: Final[_Loader[schema_salad.metaschema.EnumSchema]] = _RecordLoader( + schema_salad.metaschema.EnumSchema, None, None +) +ArraySchemaLoader: Final[_Loader[schema_salad.metaschema.ArraySchema]] = _RecordLoader( + schema_salad.metaschema.ArraySchema, None, None +) +MapSchemaLoader: Final[_Loader[schema_salad.metaschema.MapSchema]] = _RecordLoader( + schema_salad.metaschema.MapSchema, None, None +) +UnionSchemaLoader: Final[_Loader[schema_salad.metaschema.UnionSchema]] = _RecordLoader( + schema_salad.metaschema.UnionSchema, None, None ) -EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) CWLType: TypeAlias = Literal[ "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" ] @@ -26239,7 +22804,9 @@ def __init__( ) """ Extends primitive types with the concept of a file and directory as a builtin type. + File: A File object + Directory: A Directory object """ CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( @@ -26317,32 +22884,20 @@ def __init__( StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( _RecordLoader(StepInputExpressionRequirement, None, None) ) -SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) -MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( - MPIRequirement, None, None -) -CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( - CUDARequirement, None, None -) -ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -26368,31 +22923,23 @@ def __init__( ScatterFeatureRequirementLoader, MultipleInputFeatureRequirementLoader, StepInputExpressionRequirementLoader, - SecretsLoader, - MPIRequirementLoader, - CUDARequirementLoader, - ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -26401,29 +22948,25 @@ def __init__( ] ] ] = _ArrayLoader( - union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader + union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_CWLObjectTypeLoader: Final[ _Loader[ CWLObjectType | None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -26434,33 +22977,29 @@ def __init__( ] = _UnionLoader( ( None_type, - array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, CWLObjectTypeLoader, ) ) -map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ +map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_CWLObjectTypeLoader: Final[ _Loader[ Mapping[ str, CWLObjectType | None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -26470,7 +23009,7 @@ def __init__( ] ] ] = _MapLoader( - union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader, + union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True, @@ -26482,22 +23021,18 @@ def __init__( CWLObjectType | None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -26506,7 +23041,7 @@ def __init__( ], ] ] -] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader +] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_CWLObjectTypeLoader CWLVersion: TypeAlias = Literal["v1.1"] CWLVersionLoader: Final[_Loader[CWLVersion]] = _EnumLoader(("v1.1",), "CWLVersion") """ @@ -26522,11 +23057,12 @@ def __init__( "LoadListingEnum", ) """ -Specify the desired behavior for loading the `listing` field of -a Directory object for use by expressions. +Specify the desired behavior for loading the ``listing`` field of a Directory object for use by expressions. no_listing: Do not load the directory listing. + shallow_listing: Only load the top level listing, do not recurse into subdirectories. + deep_listing: Load the directory listing and recursively load all subdirectories as well. """ Expression: TypeAlias = Literal["ExpressionPlaceholder"] @@ -26603,115 +23139,131 @@ def __init__( stdin: TypeAlias = Literal["stdin"] stdinLoader: Final[_Loader[stdin]] = _EnumLoader(("stdin",), "stdin") """ -Only valid as a `type` for a `CommandLineTool` input with no -`inputBinding` set. `stdin` must not be specified at the `CommandLineTool` -level. +Only valid as a ``type`` for a ``CommandLineTool`` input with no ``inputBinding`` set. ``stdin`` must not be specified at the ``CommandLineTool`` level. The following -``` -inputs: - an_input_name: - type: stdin -``` + +:: + + inputs: + an_input_name: + type: stdin + + is equivalent to -``` -inputs: - an_input_name: - type: File - streamable: true - -stdin: ${inputs.an_input_name.path} -``` + +:: + + inputs: + an_input_name: + type: File + streamable: true + + stdin: ${inputs.an_input_name.path} """ stdout: TypeAlias = Literal["stdout"] stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ -Only valid as a `type` for a `CommandLineTool` output with no -`outputBinding` set. +Only valid as a ``type`` for a ``CommandLineTool`` output with no ``outputBinding`` set. The following -``` -outputs: - an_output_name: - type: stdout -stdout: a_stdout_file -``` +:: + + outputs: + an_output_name: + type: stdout + + stdout: a_stdout_file + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: a_stdout_file - -stdout: a_stdout_file -``` - -If there is no `stdout` name provided, a random filename will be created. -For example, the following -``` -outputs: - an_output_name: - type: stdout -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: a_stdout_file + + stdout: a_stdout_file + + +If there is no ``stdout`` name provided, a random filename will be created. For example, the following + +:: + + outputs: + an_output_name: + type: stdout + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: random_stdout_filenameABCDEFG - -stdout: random_stdout_filenameABCDEFG -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: random_stdout_filenameABCDEFG + + stdout: random_stdout_filenameABCDEFG """ stderr: TypeAlias = Literal["stderr"] stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ -Only valid as a `type` for a `CommandLineTool` output with no -`outputBinding` set. +Only valid as a ``type`` for a ``CommandLineTool`` output with no ``outputBinding`` set. The following -``` -outputs: - an_output_name: - type: stderr -stderr: a_stderr_file -``` +:: + + outputs: + an_output_name: + type: stderr + + stderr: a_stderr_file + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: a_stderr_file - -stderr: a_stderr_file -``` - -If there is no `stderr` name provided, a random filename will be created. -For example, the following -``` -outputs: - an_output_name: - type: stderr -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: a_stderr_file + + stderr: a_stderr_file + + +If there is no ``stderr`` name provided, a random filename will be created. For example, the following + +:: + + outputs: + an_output_name: + type: stderr + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: random_stderr_filenameABCDEFG - -stderr: random_stderr_filenameABCDEFG -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: random_stderr_filenameABCDEFG + + stderr: random_stderr_filenameABCDEFG """ CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( CommandLineTool, None, None @@ -26738,7 +23290,7 @@ def __init__( "LinkMergeMethod", ) """ -The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). +The input link merge method, described in `WorkflowStepInput <#WorkflowStepInput>`__. """ WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( WorkflowOutputParameter, None, None @@ -26761,15 +23313,12 @@ def __init__( "ScatterMethod", ) """ -The scatter method, as described in [workflow step scatter](#WorkflowStep). +The scatter method, as described in `workflow step scatter <#WorkflowStep>`__. """ WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( WorkflowStep, None, None ) WorkflowLoader: Final[_Loader[Workflow]] = _RecordLoader(Workflow, None, None) -ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( - ProcessGenerator, None, None -) array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) union_of_None_type_or_strtype_or_array_of_strtype: Final[ _Loader[None | Sequence[str] | str] @@ -26785,12 +23334,12 @@ def __init__( ) union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _UnionLoader( @@ -26807,12 +23356,12 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] @@ -26821,21 +23370,21 @@ def __init__( ) union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _UnionLoader( @@ -26852,21 +23401,21 @@ def __init__( ) typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _TypeDSLLoader( @@ -26874,11 +23423,11 @@ def __init__( 2, "v1.1", ) -array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( - RecordFieldLoader -) +array_of_RecordFieldLoader: Final[ + _Loader[Sequence[schema_salad.metaschema.RecordField]] +] = _ArrayLoader(RecordFieldLoader) union_of_None_type_or_array_of_RecordFieldLoader: Final[ - _Loader[None | Sequence[RecordField]] + _Loader[None | Sequence[schema_salad.metaschema.RecordField]] ] = _UnionLoader( ( None_type, @@ -26886,7 +23435,7 @@ def __init__( ) ) idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ - _Loader[None | Sequence[RecordField]] + _Loader[None | Sequence[schema_salad.metaschema.RecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") Record_name: TypeAlias = Literal["record"] Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") @@ -26912,21 +23461,21 @@ def __init__( ) uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _URILoader( @@ -26952,7 +23501,13 @@ def __init__( Union_nameLoader, 2, "v1.1" ) union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ - _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + _Loader[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] ] = _UnionLoader( ( PrimitiveTypeLoader, @@ -26964,7 +23519,13 @@ def __init__( ) array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] ] ] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype @@ -26973,9 +23534,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _UnionLoader( @@ -26992,9 +23559,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _URILoader( @@ -27008,9 +23581,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _TypeDSLLoader( @@ -27040,11 +23619,13 @@ def __init__( uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( - ( - None_type, - inttype, - inttype, +union_of_None_type_or_inttype_or_longtype: Final[_Loader[None | i32 | i64]] = ( + _UnionLoader( + ( + None_type, + inttype, + longtype, + ) ) ) union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( @@ -27382,26 +23963,22 @@ def __init__( "id", "type", ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -27412,29 +23989,25 @@ def __init__( ] = _UnionLoader( ( None_type, - array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader: Final[ +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -27443,29 +24016,25 @@ def __init__( ] ] ] = _IdMapLoader( - union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader, + union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -27491,33 +24060,25 @@ def __init__( ScatterFeatureRequirementLoader, MultipleInputFeatureRequirementLoader, StepInputExpressionRequirementLoader, - SecretsLoader, - MPIRequirementLoader, - CUDARequirementLoader, - ShmSizeLoader, Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -27526,29 +24087,25 @@ def __init__( ] ] ] = _ArrayLoader( - union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type + union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ None | Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -27559,30 +24116,26 @@ def __init__( ] = _UnionLoader( ( None_type, - array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type: Final[ +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ None | Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -27591,7 +24144,7 @@ def __init__( ] ] ] = _IdMapLoader( - union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_ShmSizeLoader_or_Any_type, + union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, "class", "None", ) @@ -28169,13 +24722,13 @@ def __init__( uri_ResourceRequirement_classLoader_False_True_None_None: Final[ _Loader[ResourceRequirement_class] ] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) -union_of_None_type_or_inttype_or_inttype_or_ExpressionLoader: Final[ - _Loader[None | i32 | str] +union_of_None_type_or_inttype_or_longtype_or_ExpressionLoader: Final[ + _Loader[None | i32 | i64 | str] ] = _UnionLoader( ( None_type, inttype, - inttype, + longtype, ExpressionLoader, ) ) @@ -28213,11 +24766,11 @@ def __init__( uri_ToolTimeLimit_classLoader_False_True_None_None: Final[ _Loader[ToolTimeLimit_class] ] = _URILoader(ToolTimeLimit_classLoader, False, True, None, None) -union_of_inttype_or_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = ( +union_of_inttype_or_longtype_or_ExpressionLoader: Final[_Loader[i32 | i64 | str]] = ( _UnionLoader( ( inttype, - inttype, + longtype, ExpressionLoader, ) ) @@ -28304,21 +24857,20 @@ def __init__( idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ _Loader[None | Sequence[Any]] ] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ - _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] -] = _UnionLoader( +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader: ( + Final[_Loader[CommandLineTool | ExpressionTool | Workflow | str]] +) = _UnionLoader( ( strtype, CommandLineToolLoader, ExpressionToolLoader, WorkflowLoader, - ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ - _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow | str] +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_False_False_None_None: Final[ + _Loader[CommandLineTool | ExpressionTool | Workflow | str] ] = _URILoader( - union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, False, False, None, @@ -28400,47 +24952,25 @@ def __init__( uri_StepInputExpressionRequirement_classLoader_False_True_None_None: Final[ _Loader[StepInputExpressionRequirement_class] ] = _URILoader(StepInputExpressionRequirement_classLoader, False, True, None, None) -uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( - strtype, False, True, None, None -) -uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( - array_of_strtype, False, False, 0, None -) -union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( - ( - inttype, - ExpressionLoader, - ) -) -union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( - _UnionLoader( - ( - strtype, - array_of_strtype, - ) - ) -) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ - _Loader[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | Workflow] ] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, WorkflowLoader, - ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ - _Loader[Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow]] -] = _ArrayLoader( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader: ( + Final[_Loader[Sequence[CommandLineTool | ExpressionTool | Workflow]]] +) = _ArrayLoader( + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader: Final[ +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader: Final[ _Loader[ CommandLineTool | ExpressionTool - | ProcessGenerator - | Sequence[CommandLineTool | ExpressionTool | ProcessGenerator | Workflow] + | Sequence[CommandLineTool | ExpressionTool | Workflow] | Workflow ] ] = _UnionLoader( @@ -28448,8 +24978,7 @@ def __init__( CommandLineToolLoader, ExpressionToolLoader, WorkflowLoader, - ProcessGeneratorLoader, - array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, ) ) @@ -28457,7 +24986,6 @@ def __init__( ( booltype, inttype, - longtype, floattype, strtype, FileLoader, @@ -28467,7 +24995,7 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | str" ) Sink: TypeAlias = WorkflowStepInput @@ -28478,29 +25006,25 @@ def __init__( CommandOutputParameter | ExpressionToolOutputParameter | WorkflowOutputParameter ) ProcessRequirement: TypeAlias = ( - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse ) -Process: TypeAlias = CommandLineTool | ExpressionTool | ProcessGenerator | Workflow +Process: TypeAlias = CommandLineTool | ExpressionTool | Workflow CommandInputSchema: TypeAlias = ( CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema ) @@ -28517,7 +25041,6 @@ def __init__( InputFormat: TypeAlias = InputParameter | InputRecordField OutputFormat: TypeAlias = OutputParameter | OutputRecordField Parameter: TypeAlias = InputParameter | OutputParameter -Documented: TypeAlias = IOSchema | Parameter | Process | RecordField | WorkflowStep IdentifierRequired: TypeAlias = ( Parameter | WorkflowStep | WorkflowStepInput | WorkflowStepOutput ) @@ -28536,7 +25059,7 @@ def load_document( if loadingOptions is None: loadingOptions = LoadingOptions() result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, doc, baseuri, loadingOptions, @@ -28555,7 +25078,7 @@ def load_document_with_metadata( if loadingOptions is None: loadingOptions = LoadingOptions(fileuri=baseuri) return _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, doc, baseuri, loadingOptions, @@ -28576,7 +25099,7 @@ def load_document_by_string( loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, result, uri, loadingOptions, @@ -28599,7 +25122,7 @@ def load_document_by_yaml( loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader, yaml, uri, loadingOptions, diff --git a/src/cwl_utils/parser/cwl_v1_1_utils.py b/src/cwl_utils/parser/cwl_v1_1_utils.py index c64bb9ec..9d2de45f 100644 --- a/src/cwl_utils/parser/cwl_v1_1_utils.py +++ b/src/cwl_utils/parser/cwl_v1_1_utils.py @@ -9,6 +9,8 @@ from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException +from schema_salad.metaschema import ArraySchema, EnumSchema, RecordSchema +from schema_salad.runtime import save, shortname, LoadingOptions, file_uri from schema_salad.sourceline import SourceLine, add_lc_filename from schema_salad.utils import aslist, json_dumps, yaml_no_ts @@ -63,22 +65,22 @@ def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, + loading_options: LoadingOptions, ) -> BasicOutputTypeSchemas: match schema_type: - case cwl.ArraySchema(): + case ArraySchema(): return cwl.OutputArraySchema.fromDoc( schema_type.save(), loading_options.baseuri, loading_options, ) - case cwl.EnumSchema(): + case EnumSchema(): return cwl.OutputEnumSchema.fromDoc( schema_type.save(), loading_options.baseuri, loading_options, ) - case cwl.RecordSchema(): + case RecordSchema(): return cwl.OutputRecordSchema.fromDoc( schema_type.save(), loading_options.baseuri, @@ -95,7 +97,7 @@ def in_output_type_schema_to_output_type_schema( | BasicOutputTypeSchemas | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] ), - loading_options: cwl.LoadingOptions, + loading_options: LoadingOptions, ) -> OutputTypeSchemas: if is_sequence(schema_type): return [ @@ -109,14 +111,14 @@ def in_output_type_schema_to_output_type_schema( def _compare_type(type1: Any, type2: Any) -> bool: match (type1, type1): - case cwl.ArraySchema() as t1, cwl.ArraySchema() as t2: + case ArraySchema() as t1, ArraySchema() as t2: return _compare_type(t1.items, t2.items) - case cwl.RecordSchema(), cwl.RecordSchema(): + case RecordSchema(), RecordSchema(): fields1 = { - cwl.shortname(field.name): field.type_ for field in (type1.fields or {}) + shortname(field.name): field.type_ for field in (type1.fields or {}) } fields2 = { - cwl.shortname(field.name): field.type_ for field in (type2.fields or {}) + shortname(field.name): field.type_ for field in (type2.fields or {}) } if fields1.keys() != fields2.keys(): return False @@ -134,9 +136,9 @@ def _compare_type(type1: Any, type2: Any) -> bool: def _inputfile_load( doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, - loadingOptions: cwl.LoadingOptions, + loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, cwl.LoadingOptions]: +) -> tuple[Any, LoadingOptions]: loader = cwl.CWLInputFileLoader match doc: case str(): @@ -150,9 +152,7 @@ def _inputfile_load( yaml = yaml_no_ts() result = yaml.load(textIO) add_lc_filename(result, doc_url) - loadingOptions = cwl.LoadingOptions( - copyfrom=loadingOptions, fileuri=doc_url - ) + loadingOptions = LoadingOptions(copyfrom=loadingOptions, fileuri=doc_url) _inputfile_load( result, doc_url, @@ -166,7 +166,7 @@ def _inputfile_load( if mf in doc: addl_metadata[mf] = doc[mf] - loadingOptions = cwl.LoadingOptions( + loadingOptions = LoadingOptions( copyfrom=loadingOptions, baseuri=baseuri, addl_metadata=addl_metadata, @@ -306,13 +306,13 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None: def load_inputfile( doc: Any, baseuri: str | None = None, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.1 input file from a serialized YAML string or a YAML object.""" if baseuri is None: - baseuri = cwl.file_uri(str(Path.cwd())) + "/" + baseuri = file_uri(str(Path.cwd())) + "/" if loadingOptions is None: - loadingOptions = cwl.LoadingOptions() + loadingOptions = LoadingOptions() result, metadata = _inputfile_load( doc, @@ -325,14 +325,14 @@ def load_inputfile( def load_inputfile_by_string( string: Any, uri: str, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.1 input file from a serialized YAML string.""" result = yaml_no_ts().load(string) add_lc_filename(result, uri) if loadingOptions is None: - loadingOptions = cwl.LoadingOptions(fileuri=uri) + loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _inputfile_load( result, @@ -345,13 +345,13 @@ def load_inputfile_by_string( def load_inputfile_by_yaml( yaml: Any, uri: str, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.1 input file from a YAML object.""" add_lc_filename(yaml, uri) if loadingOptions is None: - loadingOptions = cwl.LoadingOptions(fileuri=uri) + loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _inputfile_load( yaml, @@ -420,7 +420,7 @@ def type_for_step_output( raise ValidationException( "param {} not found in {}.".format( sourcename, - yaml_dumps(cwl.save(step)), + yaml_dumps(save(step)), ) ) @@ -437,7 +437,9 @@ def type_for_source( ): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] - params = param_for_source_id(process, sourcenames, parent, scatter_context) + params = cwl_utils.parser.utils.param_for_source_id( + process, sourcenames, parent, scatter_context + ) if not isinstance(params, MutableSequence): new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: @@ -515,92 +517,3 @@ def type_for_source( type_="array", ) return final_type - - -def param_for_source_id( - process: cwl.Process, - sourcenames: str | Sequence[str], - parent: cwl.Workflow | None = None, - scatter_context: list[tuple[int, str] | None] | None = None, -) -> ( - cwl_utils.parser.InputParameter - | cwl_utils.parser.OutputParameter - | MutableSequence[ - cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter - ] -): - """Find the process input parameter that matches one of the given sourcenames.""" - if isinstance(sourcenames, str): - sourcenames = [sourcenames] - params: MutableSequence[ - cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter - ] = [] - for sourcename in sourcenames: - if not isinstance(process, cwl.Workflow): - for param in process.inputs: - if param.id.split("#")[-1] == sourcename.split("#")[-1]: - params.append(param) - if scatter_context is not None: - scatter_context.append(None) - targets = [process] - if parent: - targets.append(parent) - for target in targets: - if isinstance(target, cwl.Workflow): - for inp in target.inputs: - if inp.id.split("#")[-1] == sourcename.split("#")[-1]: - params.append(inp) - if scatter_context is not None: - scatter_context.append(None) - for step in target.steps: - if ( - "/".join(sourcename.split("#")[-1].split("/")[:-1]) - == step.id.split("#")[-1] - and step.out - ): - step_run = cwl_utils.parser.utils.load_step(step) - cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - for outp in step.out: - outp_id = outp if isinstance(outp, str) else outp.id - if ( - outp_id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - if step_run and step_run.outputs: - for output in step_run.outputs: - if ( - output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - params.append(output) - if scatter_context is not None: - match step.scatter: - case str(): - scatter_context.append( - ( - 1, - step.scatterMethod - or "dotproduct", - ) - ) - case Sequence(): - scatter_context.append( - ( - len(step.scatter), - step.scatterMethod - or "dotproduct", - ) - ) - case _: - scatter_context.append(None) - if len(params) == 1: - return params[0] - elif len(params) > 1: - return params - raise WorkflowException( - "param {} not found in {}\n{}.".format( - sourcename, - yaml_dumps(cwl.save(process)), - (f" or\n {yaml_dumps(cwl.save(parent))}" if parent is not None else ""), - ) - ) diff --git a/src/cwl_utils/parser/cwl_v1_2.py b/src/cwl_utils/parser/cwl_v1_2.py index 61b6b602..9a5a175d 100644 --- a/src/cwl_utils/parser/cwl_v1_2.py +++ b/src/cwl_utils/parser/cwl_v1_2.py @@ -2,452 +2,63 @@ # This file was autogenerated using schema-salad-tool --codegen=python # The code itself is released under the Apache 2.0 license and the help text is # subject to the license of the original schema. - from __future__ import annotations -import copy -import logging import os -import pathlib import sys -import tempfile -import uuid as _uuid__ # pylint: disable=unused-import # noqa: F401 -import xml.sax # nosec -from abc import ABCMeta, abstractmethod -from collections.abc import Collection # pylint: disable=unused-import # noqa: F401 -from collections.abc import MutableMapping, MutableSequence, Sequence -from io import StringIO -from itertools import chain -from mypy_extensions import i32, i64, mypyc_attr -from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401 -from typing import Any, Final, Generic, TypeAlias, TypeVar, cast -from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit -from urllib.request import pathname2url - -from rdflib import Graph -from rdflib.plugins.parsers.notation3 import BadSyntax -from ruamel.yaml.comments import CommentedMap - -from schema_salad.exceptions import SchemaSaladException, ValidationException -from schema_salad.fetcher import DefaultFetcher, Fetcher, MemoryCachingFetcher -from schema_salad.sourceline import SourceLine, add_lc_filename -from schema_salad.utils import CacheType, yaml_no_ts # requires schema-salad v8.2+ +import uuid as _uuid__ +from collections.abc import Collection +from typing import ClassVar + +from schema_salad.runtime import ( + Saveable, + file_uri, + parse_errors, + prefix_url, + save, + save_relative_uri, +) if sys.version_info >= (3, 11): from typing import Self else: from typing_extensions import Self -_vocab: Final[dict[str, str]] = {} -_rvocab: Final[dict[str, str]] = {} - -_logger: Final = logging.getLogger("salad") - - -IdxType: TypeAlias = MutableMapping[str, tuple[Any, "LoadingOptions"]] -E = TypeVar("E", bound=str) -S = TypeVar("S", bound="Saveable") -T = TypeVar("T", covariant=True) - - -@mypyc_attr(native_class=True) -class LoadingOptions: - idx: Final[IdxType] - fileuri: Final[str | None] - baseuri: Final[str] - namespaces: Final[MutableMapping[str, str]] - schemas: Final[MutableSequence[str]] - original_doc: Final[Any | None] - addl_metadata: Final[MutableMapping[str, Any]] - fetcher: Final[Fetcher] - vocab: Final[dict[str, str]] - rvocab: Final[dict[str, str]] - cache: Final[CacheType] - imports: Final[list[str]] - includes: Final[list[str]] - no_link_check: Final[bool | None] - container: Final[str | None] - - def __init__( - self, - fetcher: Fetcher | None = None, - namespaces: dict[str, str] | None = None, - schemas: list[str] | None = None, - fileuri: str | None = None, - copyfrom: LoadingOptions | None = None, - original_doc: Any | None = None, - addl_metadata: dict[str, str] | None = None, - baseuri: str | None = None, - idx: IdxType | None = None, - imports: list[str] | None = None, - includes: list[str] | None = None, - no_link_check: bool | None = None, - container: str | None = None, - ) -> None: - """Create a LoadingOptions object.""" - self.original_doc = original_doc - - if idx is not None: - temp_idx = idx - else: - temp_idx = copyfrom.idx if copyfrom is not None else {} - self.idx = temp_idx - - if fileuri is not None: - temp_fileuri: str | None = fileuri - else: - temp_fileuri = copyfrom.fileuri if copyfrom is not None else None - self.fileuri = temp_fileuri - - if baseuri is not None: - temp_baseuri = baseuri - else: - temp_baseuri = copyfrom.baseuri if copyfrom is not None else "" - self.baseuri = temp_baseuri - - if namespaces is not None: - temp_namespaces: MutableMapping[str, str] = namespaces - else: - temp_namespaces = copyfrom.namespaces if copyfrom is not None else {} - self.namespaces = temp_namespaces - - if schemas is not None: - temp_schemas: MutableSequence[str] = schemas - else: - temp_schemas = copyfrom.schemas if copyfrom is not None else [] - self.schemas = temp_schemas - - if addl_metadata is not None: - temp_addl_metadata: MutableMapping[str, Any] = addl_metadata - else: - temp_addl_metadata = copyfrom.addl_metadata if copyfrom is not None else {} - self.addl_metadata = temp_addl_metadata - - if imports is not None: - temp_imports = imports - else: - temp_imports = copyfrom.imports if copyfrom is not None else [] - self.imports = temp_imports - - if includes is not None: - temp_includes = includes - else: - temp_includes = copyfrom.includes if copyfrom is not None else [] - self.includes = temp_includes - - if no_link_check is not None: - temp_no_link_check: bool | None = no_link_check - else: - temp_no_link_check = copyfrom.no_link_check if copyfrom is not None else False - self.no_link_check = temp_no_link_check - - if container is not None: - temp_container: str | None = container - else: - temp_container = copyfrom.container if copyfrom is not None else None - self.container = temp_container - - if fetcher is not None: - temp_fetcher = fetcher - elif copyfrom is not None: - temp_fetcher = copyfrom.fetcher - else: - import requests - from cachecontrol.caches import SeparateBodyFileCache - from cachecontrol.wrapper import CacheControl - - root = pathlib.Path(os.environ.get("HOME", tempfile.gettempdir())) - session = CacheControl( - requests.Session(), - cache=SeparateBodyFileCache(root / ".cache" / "salad"), - ) - temp_fetcher = DefaultFetcher({}, session) - self.fetcher = temp_fetcher - - self.cache = self.fetcher.cache if isinstance(self.fetcher, MemoryCachingFetcher) else {} - - if self.namespaces != {}: - temp_vocab = _vocab.copy() - temp_rvocab = _rvocab.copy() - for k, v in self.namespaces.items(): - temp_vocab[k] = v - temp_rvocab[v] = k - else: - temp_vocab = _vocab - temp_rvocab = _rvocab - self.vocab = temp_vocab - self.rvocab = temp_rvocab - - @property - def graph(self) -> Graph: - """Generate a merged rdflib.Graph from all entries in self.schemas.""" - graph = Graph() - if not self.schemas: - return graph - key: Final = str(hash(tuple(self.schemas))) - if key in self.cache: - return cast(Graph, self.cache[key]) - for schema in self.schemas: - fetchurl = ( - self.fetcher.urljoin(self.fileuri, schema) - if self.fileuri is not None - else pathlib.Path(schema).resolve().as_uri() - ) - if fetchurl not in self.cache or self.cache[fetchurl] is True: - _logger.debug("Getting external schema %s", fetchurl) - try: - content = self.fetcher.fetch_text(fetchurl) - except Exception as e: - _logger.warning("Could not load extension schema %s: %s", fetchurl, str(e)) - continue - newGraph = Graph() - err_msg = "unknown error" - for fmt in ["xml", "turtle"]: - try: - newGraph.parse(data=content, format=fmt, publicID=str(fetchurl)) - self.cache[fetchurl] = newGraph - graph += newGraph - break - except (xml.sax.SAXParseException, TypeError, BadSyntax) as e: - err_msg = str(e) - else: - _logger.warning("Could not load extension schema %s: %s", fetchurl, err_msg) - self.cache[key] = graph - return graph - - -@mypyc_attr(native_class=True) -class Saveable(metaclass=ABCMeta): - """Mark classes than have a save() and fromDoc() function.""" - - @classmethod - @abstractmethod - def fromDoc( - cls, - _doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None, - ) -> Self: - """Construct this object from the result of yaml.load().""" - - @abstractmethod - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - """Convert this object to a JSON/YAML friendly dictionary.""" - - -def load_field( - val: Any | None, - fieldtype: _Loader[T], - baseuri: str, - loadingOptions: LoadingOptions, - lc: Any | None = None, -) -> T: - """Load field.""" - if isinstance(val, MutableMapping): - if "$import" in val: - if loadingOptions.fileuri is None: - raise SchemaSaladException("Cannot load $import without fileuri") - url1: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$import"]) - result, metadata = _document_load_by_url( - fieldtype, - url1, - loadingOptions, - ) - loadingOptions.imports.append(url1) - return result - if "$include" in val: - if loadingOptions.fileuri is None: - raise SchemaSaladException("Cannot load $import without fileuri") - url2: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$include"]) - val = loadingOptions.fetcher.fetch_text(url2) - loadingOptions.includes.append(url2) - return fieldtype.load(val, baseuri, loadingOptions, lc=lc) +import schema_salad.metaschema +import copy +from abc import ABCMeta, abstractmethod +from collections.abc import MutableSequence, Sequence, MutableMapping +from io import StringIO +from itertools import chain +from typing import Literal, TypeVar # pylint: disable=unused-import # noqa: F401 +from collections.abc import Mapping +from typing import TypeAlias # pylint: disable=unused-import # noqa: F401 +from typing import Any, Final, cast, Generic +from urllib.parse import urldefrag, urlsplit, urlunsplit + +from mypy_extensions import i32, i64 # pylint: disable=unused-import # noqa: F401 +from mypy_extensions import mypyc_attr +from ruamel.yaml.comments import CommentedMap -save_type: TypeAlias = ( - None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str +from schema_salad.exceptions import ValidationException, SchemaSaladException +from schema_salad.runtime import ( + LoadingOptions, + convert_typing, + extract_type, + SaveableType, + FieldType, + EnumFieldType, ) +from schema_salad.sourceline import SourceLine, add_lc_filename +from schema_salad.utils import yaml_no_ts # requires schema-salad v8.2+ - -def extract_type(val_type: type[Any]) -> str: - """Take a type of value, and extracts the value as a string.""" - val_str: Final = str(val_type) - return val_str.split("'")[1] - - -def convert_typing(val_type: str) -> str: - """Normalize type names to schema-salad types.""" - if "None" in val_type: - return "null" - if "CommentedSeq" in val_type or "list" in val_type: - return "array" - if "CommentedMap" in val_type or "dict" in val_type: - return "object" - if "False" in val_type or "True" in val_type: - return "boolean" - return val_type - - -def parse_errors(error_message: str) -> tuple[str, str, str]: - """Parse error messages from several loaders into one error message.""" - if not error_message.startswith("Expected"): - return error_message, "", "" - vals: Final = error_message.split("\n") - if len(vals) == 1: - return error_message, "", "" - types1: Final = set() - for val in vals: - individual_vals = val.split(" ") - if val == "": - continue - if individual_vals[1] == "one": - individual_vals = val.split("(")[1].split(",") - for t in individual_vals: - types1.add(t.strip(" ").strip(")\n")) - elif individual_vals[2] == "").replace("'", "")) - elif individual_vals[0] == "Value": - types1.add(individual_vals[-1].strip(".")) - else: - types1.add(individual_vals[1].replace(",", "")) - types2: Final = {val for val in types1 if val != "NoneType"} - if "str" in types2: - types3 = {convert_typing(val) for val in types2 if "'" not in val} - else: - types3 = types2 - to_print = "" - for val in types3: - if "'" in val: - to_print = "value" if len(types3) == 1 else "values" - - if to_print == "": - to_print = "type" if len(types3) == 1 else "types" - - verb_tensage: Final = "is" if len(types3) == 1 else "are" - - return str(types3).replace("{", "(").replace("}", ")").replace("'", ""), to_print, verb_tensage - - -def save( - val: Any, - top: bool = True, - base_url: str = "", - relative_uris: bool = True, -) -> save_type: - if isinstance(val, Saveable): - return val.save(top=top, base_url=base_url, relative_uris=relative_uris) - if isinstance(val, MutableSequence): - return [save(v, top=False, base_url=base_url, relative_uris=relative_uris) for v in val] - if isinstance(val, MutableMapping): - newdict: Final = {} - for key in val: - newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris) - return newdict - if val is None or isinstance(val, (i32, i64, float, bool, str)): - return val - raise Exception("Not Saveable: %s" % type(val)) - - -def save_with_metadata( - val: Any, - valLoadingOpts: LoadingOptions, - top: bool = True, - base_url: str = "", - relative_uris: bool = True, -) -> save_type: - """Save and set $namespaces, $schemas, $base and any other metadata fields at the top level.""" - saved_val: Final = save(val, top, base_url, relative_uris) - newdict: MutableMapping[str, Any] = {} - if isinstance(saved_val, MutableSequence): - newdict = {"$graph": saved_val} - elif isinstance(saved_val, MutableMapping): - newdict = saved_val - - if valLoadingOpts.namespaces: - newdict["$namespaces"] = valLoadingOpts.namespaces - if valLoadingOpts.schemas: - newdict["$schemas"] = valLoadingOpts.schemas - if valLoadingOpts.baseuri: - newdict["$base"] = valLoadingOpts.baseuri - for k, v in valLoadingOpts.addl_metadata.items(): - if k not in newdict: - newdict[k] = v - - return newdict - - -def expand_url( - url: str, - base_url: str, - loadingOptions: LoadingOptions, - scoped_id: bool = False, - vocab_term: bool = False, - scoped_ref: int | None = None, -) -> str: - if url in ("@id", "@type"): - return url - - if vocab_term and url in loadingOptions.vocab: - return url - - if bool(loadingOptions.vocab) and ":" in url: - prefix: Final = url.split(":")[0] - if prefix in loadingOptions.vocab: - url = loadingOptions.vocab[prefix] + url[len(prefix) + 1 :] - - split1: Final = urlsplit(url) - - if ( - (bool(split1.scheme) and split1.scheme in loadingOptions.fetcher.supported_schemes()) - or url.startswith("$(") - or url.startswith("${") - ): - pass - elif scoped_id and not bool(split1.fragment): - splitbase1: Final = urlsplit(base_url) - frg: str - if bool(splitbase1.fragment): - frg = splitbase1.fragment + "/" + split1.path - else: - frg = split1.path - pt: Final = splitbase1.path if splitbase1.path != "" else "/" - url = urlunsplit((splitbase1.scheme, splitbase1.netloc, pt, splitbase1.query, frg)) - elif scoped_ref is not None and not bool(split1.fragment): - splitbase2: Final = urlsplit(base_url) - sp = splitbase2.fragment.split("/") - n = scoped_ref - while n > 0 and len(sp) > 0: - sp.pop() - n -= 1 - sp.append(url) - url = urlunsplit( - ( - splitbase2.scheme, - splitbase2.netloc, - splitbase2.path, - splitbase2.query, - "/".join(sp), - ) - ) - else: - url = loadingOptions.fetcher.urljoin(base_url, url) - - if vocab_term: - split2: Final = urlsplit(url) - if bool(split2.scheme): - if url in loadingOptions.rvocab: - return loadingOptions.rvocab[url] - else: - raise ValidationException(f"Term {url!r} not in vocabulary") - - return url +_vocab: Final[dict[str, str]] = {} +_rvocab: Final[dict[str, str]] = {} @mypyc_attr(native_class=True) -class _Loader(Generic[T], metaclass=ABCMeta): +class _Loader(Generic[FieldType], metaclass=ABCMeta): @abstractmethod def load( self, @@ -456,7 +67,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: ... + ) -> FieldType: ... @mypyc_attr(native_class=True) @@ -475,8 +86,8 @@ def load( @mypyc_attr(native_class=True) -class _PrimitiveLoader(_Loader[T]): - def __init__(self, tp: type[T]) -> None: +class _PrimitiveLoader(_Loader[FieldType]): + def __init__(self, tp: type[FieldType]) -> None: self.tp: Final = tp def load( @@ -486,7 +97,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if not isinstance(doc, self.tp): raise ValidationException(f"Expected a {self.tp} but got {doc.__class__.__name__}") return doc @@ -496,8 +107,8 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _ArrayLoader(_Loader[Sequence[T]]): - def __init__(self, items: _Loader[T]) -> None: +class _ArrayLoader(_Loader[Sequence[FieldType]]): + def __init__(self, items: _Loader[FieldType]) -> None: self.items: Final = items def load( @@ -507,7 +118,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> list[T]: + ) -> list[FieldType]: if not isinstance(doc, MutableSequence): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -518,7 +129,7 @@ def load( fields: Final[list[str]] = [] for i in range(0, len(doc)): try: - lf = load_field( + lf = _load_field( doc[i], _UnionLoader([self, self.items]), baseuri, loadingOptions, lc=lc ) flatten = loadingOptions.container != "@list" @@ -554,10 +165,10 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _MapLoader(_Loader[Mapping[str, T]]): +class _MapLoader(_Loader[Mapping[str, FieldType]]): def __init__( self, - values: _Loader[T], + values: _Loader[FieldType], name: str | None = None, container: str | None = None, no_link_check: bool | None = None, @@ -574,7 +185,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> dict[str, T]: + ) -> dict[str, FieldType]: if not isinstance(doc, MutableMapping): raise ValidationException(f"Expected a map, was {type(doc)}") if self.container is not None or self.no_link_check is not None: @@ -585,7 +196,7 @@ def load( errors: Final[list[SchemaSaladException]] = [] for k, v in doc.items(): try: - lf = load_field(v, self.values, baseuri, loadingOptions, lc) + lf = _load_field(v, self.values, baseuri, loadingOptions, lc) r[k] = lf except ValidationException as e: errors.append(e.with_sourceline(SourceLine(doc, k, str))) @@ -598,7 +209,7 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _EnumLoader(_Loader[E]): +class _EnumLoader(_Loader[EnumFieldType]): def __init__(self, symbols: Sequence[str], name: str) -> None: self.symbols: Final = symbols self.name: Final = name @@ -610,9 +221,9 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> E: + ) -> EnumFieldType: if doc in self.symbols: - return cast(E, doc) + return cast(EnumFieldType, doc) raise ValidationException(f"Expected one of {self.symbols}") def __repr__(self) -> str: @@ -620,8 +231,8 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _SecondaryDSLLoader(_Loader[T]): - def __init__(self, inner: _Loader[T]) -> None: +class _SecondaryDSLLoader(_Loader[FieldType]): + def __init__(self, inner: _Loader[FieldType]) -> None: self.inner: Final = inner def load( @@ -631,7 +242,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: r: Final[list[dict[str, Any]]] = [] match doc: case MutableSequence() as dlist: @@ -694,10 +305,10 @@ def load( @mypyc_attr(native_class=True) -class _RecordLoader(_Loader[S]): +class _RecordLoader(_Loader[SaveableType]): def __init__( self, - classtype: type[S], + classtype: type[SaveableType], container: str | None = None, no_link_check: bool | None = None, ) -> None: @@ -712,7 +323,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> S: + ) -> SaveableType: if not isinstance(doc, MutableMapping): raise ValidationException( f"Value is a {convert_typing(extract_type(type(doc)))}, " @@ -751,12 +362,12 @@ def load( @mypyc_attr(native_class=True) -class _UnionLoader(_Loader[T]): - def __init__(self, alternates: Sequence[_Loader[T]], name: str | None = None) -> None: +class _UnionLoader(_Loader[FieldType]): + def __init__(self, alternates: Sequence[_Loader[FieldType]], name: str | None = None) -> None: self.alternates = alternates self.name: Final = name - def add_loaders(self, loaders: Sequence[_Loader[T]]) -> None: + def add_loaders(self, loaders: Sequence[_Loader[FieldType]]) -> None: self.alternates = tuple(loader for loader in chain(self.alternates, loaders)) def load( @@ -766,7 +377,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: errors: Final = [] if lc is None: @@ -842,10 +453,10 @@ def __repr__(self) -> str: @mypyc_attr(native_class=True) -class _URILoader(_Loader[T]): +class _URILoader(_Loader[FieldType]): def __init__( self, - inner: _Loader[T], + inner: _Loader[FieldType], scoped_id: bool, vocab_term: bool, scoped_ref: int | None, @@ -864,7 +475,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if self.no_link_check is not None: loadingOptions = LoadingOptions( copyfrom=loadingOptions, no_link_check=self.no_link_check @@ -875,7 +486,7 @@ def load( for i in decl: if isinstance(i, str): newdoc.append( - expand_url( + _expand_url( i, baseuri, loadingOptions, @@ -888,7 +499,7 @@ def load( newdoc.append(i) doc = newdoc case str(decl): - doc = expand_url( + doc = _expand_url( decl, baseuri, loadingOptions, @@ -912,8 +523,13 @@ def load( @mypyc_attr(native_class=True) -class _TypeDSLLoader(_Loader[T]): - def __init__(self, inner: _Loader[T], refScope: int | None, salad_version: str) -> None: +class _TypeDSLLoader(_Loader[FieldType]): + def __init__( + self, + inner: _Loader[FieldType], + refScope: int | None, + salad_version: str, + ) -> None: self.inner: Final = inner self.refScope: Final = refScope self.salad_version: Final = salad_version @@ -939,14 +555,35 @@ def resolve( # To show the error message with the original type return doc else: - items = expand_url(rest, baseuri, loadingOptions, False, True, self.refScope) + items = _expand_url( + rest, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) else: items = self.resolve(rest, baseuri, loadingOptions) if isinstance(items, str): - items = expand_url(items, baseuri, loadingOptions, False, True, self.refScope) + items = _expand_url( + items, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) expanded: dict[str, Any] | str = {"type": "array", "items": items} else: - expanded = expand_url(doc_, baseuri, loadingOptions, False, True, self.refScope) + expanded = _expand_url( + doc_, + baseuri, + loadingOptions, + False, + True, + self.refScope, + ) if optional: return ["null", expanded] @@ -960,7 +597,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if isinstance(doc, MutableSequence): r: Final[list[Any]] = [] for d in doc: @@ -982,9 +619,10 @@ def load( return self.inner.load(doc, baseuri, loadingOptions, lc=lc) -@mypyc_attr(native_class=True) -class _IdMapLoader(_Loader[T]): - def __init__(self, inner: _Loader[T], mapSubject: str, mapPredicate: str | None) -> None: +class _IdMapLoader(_Loader[FieldType]): + def __init__( + self, inner: _Loader[FieldType], mapSubject: str, mapPredicate: str | None + ) -> None: self.inner: Final = inner self.mapSubject: Final = mapSubject self.mapPredicate: Final = mapPredicate @@ -996,7 +634,7 @@ def load( loadingOptions: LoadingOptions, docRoot: str | None = None, lc: Any | None = None, - ) -> T: + ) -> FieldType: if isinstance(doc, MutableMapping): r: Final[list[Any]] = [] for k in doc.keys(): @@ -1023,12 +661,12 @@ def load( def _document_load( - loader: _Loader[T], + loader: _Loader[FieldType], doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[T, LoadingOptions]: +) -> tuple[FieldType, LoadingOptions]: if isinstance(doc, str): return _document_load_by_url( loader, @@ -1093,11 +731,11 @@ def _document_load( def _document_load_by_url( - loader: _Loader[T], + loader: _Loader[FieldType], url: str, loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[T, LoadingOptions]: +) -> tuple[FieldType, LoadingOptions]: if url in loadingOptions.idx: return loadingOptions.idx[url] @@ -1123,79 +761,101 @@ def _document_load_by_url( return loadingOptions.idx[url] -def file_uri(path: str, split_frag: bool = False) -> str: - """Transform a file path into a URL with file scheme.""" - if path.startswith("file://"): - return path - if split_frag: - pathsp: Final = path.split("#", 2) - frag = "#" + quote(str(pathsp[1])) if len(pathsp) == 2 else "" - urlpath = pathname2url(str(pathsp[0])) - else: - urlpath = pathname2url(path) - frag = "" - if urlpath.startswith("//"): - return f"file:{urlpath}{frag}" - return f"file://{urlpath}{frag}" - - -def prefix_url(url: str, namespaces: dict[str, str]) -> str: - """Expand short forms into full URLs using the given namespace dictionary.""" - for k, v in namespaces.items(): - if url.startswith(v): - return k + ":" + url[len(v) :] - return url +def _expand_url( + url: str, + base_url: str, + loadingOptions: LoadingOptions, + scoped_id: bool = False, + vocab_term: bool = False, + scoped_ref: int | None = None, +) -> str: + if url in ("@id", "@type"): + return url + + vocab = _vocab | loadingOptions.vocab + if vocab_term and url in vocab: + return url + if bool(vocab) and ":" in url: + prefix: Final = url.split(":")[0] + if prefix in vocab: + url = vocab[prefix] + url[len(prefix) + 1 :] -def save_relative_uri( - uri: Any, - base_url: str, - scoped_id: bool, - ref_scope: int | None, - relative_uris: bool, -) -> Any: - """Convert any URI to a relative one, obeying the scoping rules.""" - if isinstance(uri, MutableSequence): - return [save_relative_uri(u, base_url, scoped_id, ref_scope, relative_uris) for u in uri] - elif isinstance(uri, str): - if not relative_uris or uri == base_url: - return uri - urisplit: Final = urlsplit(uri) - basesplit: Final = urlsplit(base_url) - if urisplit.scheme == basesplit.scheme and urisplit.netloc == basesplit.netloc: - if urisplit.path != basesplit.path: - p = os.path.relpath(urisplit.path, os.path.dirname(basesplit.path)) - if urisplit.fragment: - p = p + "#" + urisplit.fragment - return p - - basefrag = basesplit.fragment + "/" - if ref_scope: - sp = basefrag.split("/") - i = 0 - while i < ref_scope: - sp.pop() - i += 1 - basefrag = "/".join(sp) - - if urisplit.fragment.startswith(basefrag): - return urisplit.fragment[len(basefrag) :] - return urisplit.fragment - return uri + split1: Final = urlsplit(url) + + if ( + (bool(split1.scheme) and split1.scheme in loadingOptions.fetcher.supported_schemes()) + or url.startswith("$(") + or url.startswith("${") + ): + pass + elif scoped_id and not bool(split1.fragment): + splitbase1: Final = urlsplit(base_url) + frg: str + if bool(splitbase1.fragment): + frg = splitbase1.fragment + "/" + split1.path + else: + frg = split1.path + pt: Final = splitbase1.path if splitbase1.path != "" else "/" + url = urlunsplit((splitbase1.scheme, splitbase1.netloc, pt, splitbase1.query, frg)) + elif scoped_ref is not None and not bool(split1.fragment): + splitbase2: Final = urlsplit(base_url) + sp = splitbase2.fragment.split("/") + n = scoped_ref + while n > 0 and len(sp) > 0: + sp.pop() + n -= 1 + sp.append(url) + url = urlunsplit( + ( + splitbase2.scheme, + splitbase2.netloc, + splitbase2.path, + splitbase2.query, + "/".join(sp), + ) + ) else: - return save(uri, top=False, base_url=base_url, relative_uris=relative_uris) + url = loadingOptions.fetcher.urljoin(base_url, url) + + if vocab_term: + split2: Final = urlsplit(url) + if bool(split2.scheme): + if url in (rvocab := _rvocab | loadingOptions.rvocab): + return rvocab[url] + else: + raise ValidationException(f"Term {url!r} not in vocabulary") + return url -def shortname(inputid: str) -> str: - """ - Compute the shortname of a fully qualified identifier. - See https://w3id.org/cwl/v1.2/SchemaSalad.html#Short_names. - """ - parsed_id: Final = urlparse(inputid) - if parsed_id.fragment: - return parsed_id.fragment.split("/")[-1] - return parsed_id.path.split("/")[-1] +def _load_field( + val: Any | None, + fieldtype: _Loader[FieldType], + baseuri: str, + loadingOptions: LoadingOptions, + lc: Any | None = None, +) -> FieldType: + """Load field.""" + if isinstance(val, MutableMapping): + if "$import" in val: + if loadingOptions.fileuri is None: + raise SchemaSaladException("Cannot load $import without fileuri") + url1: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$import"]) + result, metadata = _document_load_by_url( + fieldtype, + url1, + loadingOptions, + ) + loadingOptions.imports.append(url1) + return result + if "$include" in val: + if loadingOptions.fileuri is None: + raise SchemaSaladException("Cannot load $import without fileuri") + url2: Final = loadingOptions.fetcher.urljoin(loadingOptions.fileuri, val["$include"]) + val = loadingOptions.fetcher.fetch_text(url2) + loadingOptions.includes.append(url2) + return fieldtype.load(val, baseuri, loadingOptions, lc=lc) def parser_info() -> str: @@ -1203,15 +863,211 @@ def parser_info() -> str: @mypyc_attr(native_class=True) -class RecordField(Saveable): - """ - A field of a record. - """ +class CWLArraySchema(schema_salad.metaschema.ArraySchema): + def __eq__(self, other: Any) -> bool: + if isinstance(other, CWLArraySchema): + return bool(self.items == other.items and self.type_ == other.type_) + return False + + def __hash__(self) -> int: + return hash((self.items, self.type_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) + + items = _load_field( + _doc.get("items"), + uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `items`, `type`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + items=items, + type_=type_, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.items is not None: + u = save_relative_uri(self.items, base_url, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + items: CWLArraySchema | CWLRecordSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | PrimitiveType | schema_salad.metaschema.EnumSchema | str] | schema_salad.metaschema.EnumSchema | str, + type_: Array_name, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.items = items + self.type_ = type_ + attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + + +@mypyc_attr(native_class=True) +class CWLRecordField(schema_salad.metaschema.RecordField): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, RecordField): + if isinstance(other, CWLRecordField): return bool( self.doc == other.doc and self.name == other.name @@ -1239,7 +1095,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_strtype_True_False_None_None, baseuri, @@ -1295,7 +1151,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -1343,9 +1199,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2, + typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -1395,7 +1251,7 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] @@ -1455,7 +1311,7 @@ def save( def __init__( self, name: str, - type_: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + type_: CWLArraySchema | CWLRecordSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | PrimitiveType | schema_salad.metaschema.EnumSchema | str] | schema_salad.metaschema.EnumSchema | str, doc: None | Sequence[str] | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -1476,9 +1332,9 @@ def __init__( @mypyc_attr(native_class=True) -class RecordSchema(Saveable): +class CWLRecordSchema(schema_salad.metaschema.RecordSchema): def __eq__(self, other: Any) -> bool: - if isinstance(other, RecordSchema): + if isinstance(other, CWLRecordSchema): return bool(self.fields == other.fields and self.type_ == other.type_) return False @@ -1502,9 +1358,9 @@ def fromDoc( fields = None if "fields" in _doc: try: - fields = load_field( + fields = _load_field( _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader, + idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader, baseuri, loadingOptions, lc=_doc.get("fields") @@ -1550,7 +1406,7 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), typedsl_Record_nameLoader_2, baseuri, @@ -1602,7 +1458,7 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] @@ -1657,7 +1513,7 @@ def save( def __init__( self, type_: Record_name, - fields: None | Sequence[RecordField] = None, + fields: None | Sequence[CWLRecordField] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -1676,25 +1532,69 @@ def __init__( @mypyc_attr(native_class=True) -class EnumSchema(Saveable): +class File(Saveable): """ - Define an enumerated type. + Represents a file (or group of files when ``secondaryFiles`` is provided) that will be accessible by tools using standard POSIX file system call API such as open(2) and read(2). - """ + Files are represented as objects with ``class`` of ``File``. File objects have a number of properties that provide metadata about the file. - name: str + The ``location`` property of a File is a IRI that uniquely identifies the file. Implementations must support the ``file://`` IRI scheme and may support other schemes such as ``http://`` and ``https://``. The value of ``location`` may also be a relative reference, in which case it must be resolved relative to the IRI of the document it appears in. Alternately to ``location``, implementations must also accept the ``path`` property on File, which must be a filesystem path available on the same host as the CWL runner (for inputs) or the runtime environment of a command line tool execution (for command line tool outputs). + + If no ``location`` or ``path`` is specified, a file object must specify ``contents`` with the UTF-8 text content of the file. This is a "file literal". File literals do not correspond to external resources, but are created on disk with ``contents`` with when needed for executing a tool. Where appropriate, expressions can return file literals to define new files on a runtime. The maximum size of ``contents`` is 64 kilobytes. + + The ``basename`` property defines the filename on disk where the file is staged. This may differ from the resource name. If not provided, ``basename`` must be computed from the last path part of ``location`` and made available to expressions. + + The ``secondaryFiles`` property is a list of File or Directory objects that must be staged in the same directory as the primary file. It is an error for file names to be duplicated in ``secondaryFiles``. + + The ``size`` property is the size in bytes of the File. It must be computed from the resource and made available to expressions. The ``checksum`` field contains a cryptographic hash of the file content for use it verifying file contents. Implementations may, at user option, enable or disable computation of the ``checksum`` field for performance or other reasons. However, the ability to compute output checksums is required to pass the CWL conformance test suite. + + When executing a CommandLineTool, the files and secondary files may be staged to an arbitrary directory, but must use the value of ``basename`` for the filename. The ``path`` property must be file path in the context of the tool execution runtime (local to the compute node, or within the executing container). All computed properties should be available to expressions. File literals also must be staged and ``path`` must be set. + + When collecting CommandLineTool outputs, ``glob`` matching returns file paths (with the ``path`` property) and the derived properties. This can all be modified by ``outputEval``. Alternately, if the file ``cwl.output.json`` is present in the output, ``outputBinding`` is ignored. + + File objects in the output must provide either a ``location`` IRI or a ``path`` property in the context of the tool execution runtime (local to the compute node, or within the executing container). + + When evaluating an ExpressionTool, file objects must be referenced via ``location`` (the expression tool does not have access to files on disk so ``path`` is meaningless) or as file literals. It is legal to return a file object with an existing ``location`` but a different ``basename``. The ``loadContents`` field of ExpressionTool inputs behaves the same as on CommandLineTool inputs, however it is not meaningful on the outputs. + + An ExpressionTool may forward file references from input to output by using the same value for ``location``. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, EnumSchema): + if isinstance(other, File): return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ + self.class_ == other.class_ + and self.location == other.location + and self.path == other.path + and self.basename == other.basename + and self.dirname == other.dirname + and self.nameroot == other.nameroot + and self.nameext == other.nameext + and self.checksum == other.checksum + and self.size == other.size + and self.secondaryFiles == other.secondaryFiles + and self.format == other.format + and self.contents == other.contents ) return False def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_)) + return hash( + ( + self.class_, + self.location, + self.path, + self.basename, + self.dirname, + self.nameroot, + self.nameext, + self.checksum, + self.size, + self.secondaryFiles, + self.format, + self.contents, + ) + ) @classmethod def fromDoc( @@ -1710,21 +1610,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_File_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + location = None + if "location" in _doc: + try: + location = _load_field( + _doc.get("location"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("location") + ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `location`": _errors__.append( ValidationException( str(e), @@ -1732,13 +1649,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("location") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -1750,340 +1667,499 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `location` field with value `{val}` " "is not valid because:", ) ) + path = None + if "path" in _doc: + try: + path = _load_field( + _doc.get("path"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("path") + ) - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `path`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("path") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [e], + detailed_message=f"the `path` field with value `{val}` " + "is not valid because:", + ) + ) + basename = None + if "basename" in _doc: + try: + basename = _load_field( + _doc.get("basename"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("basename") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `basename`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + val = _doc.get("basename") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [e], + detailed_message=f"the `basename` field with value `{val}` " + "is not valid because:", + ) + ) + dirname = None + if "dirname" in _doc: + try: + dirname = _load_field( + _doc.get("dirname"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("dirname") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `dirname`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("dirname") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `dirname` field is not valid because:", + SourceLine(_doc, "dirname", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `dirname` field is not valid because:", + SourceLine(_doc, "dirname", str), + [e], + detailed_message=f"the `dirname` field with value `{val}` " + "is not valid because:", + ) + ) + nameroot = None + if "nameroot" in _doc: + try: + nameroot = _load_field( + _doc.get("nameroot"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("nameroot") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `nameroot`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`".format( - k - ), - SourceLine(_doc, k, str), + val = _doc.get("nameroot") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `nameroot` field is not valid because:", + SourceLine(_doc, "nameroot", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset(["name", "symbols", "type"]) - - -@mypyc_attr(native_class=True) -class ArraySchema(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, ArraySchema): - return bool(self.items == other.items and self.type_ == other.type_) - return False - - def __hash__(self) -> int: - return hash((self.items, self.type_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) + else: + _errors__.append( + ValidationException( + "the `nameroot` field is not valid because:", + SourceLine(_doc, "nameroot", str), + [e], + detailed_message=f"the `nameroot` field with value `{val}` " + "is not valid because:", + ) + ) + nameext = None + if "nameext" in _doc: + try: + nameext = _load_field( + _doc.get("nameext"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("nameext") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `nameext`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", + val = _doc.get("nameext") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `nameext` field is not valid because:", + SourceLine(_doc, "nameext", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + _errors__.append( + ValidationException( + "the `nameext` field is not valid because:", + SourceLine(_doc, "nameext", str), + [e], + detailed_message=f"the `nameext` field with value `{val}` " + "is not valid because:", + ) + ) + checksum = None + if "checksum" in _doc: + try: + checksum = _load_field( + _doc.get("checksum"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("checksum") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `checksum`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: + val = _doc.get("checksum") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `checksum` field is not valid because:", + SourceLine(_doc, "checksum", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `checksum` field is not valid because:", + SourceLine(_doc, "checksum", str), + [e], + detailed_message=f"the `checksum` field with value `{val}` " + "is not valid because:", + ) + ) + size = None + if "size" in _doc: + try: + size = _load_field( + _doc.get("size"), + union_of_None_type_or_inttype_or_longtype, + baseuri, + loadingOptions, + lc=_doc.get("size") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `size`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("size") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `size` field is not valid because:", + SourceLine(_doc, "size", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `size` field is not valid because:", + SourceLine(_doc, "size", str), + [e], + detailed_message=f"the `size` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `secondaryFiles`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + contents = None + if "contents" in _doc: + try: + contents = _load_field( + _doc.get("contents"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("contents") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `contents`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("contents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `contents` field is not valid because:", + SourceLine(_doc, "contents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `contents` field is not valid because:", + SourceLine(_doc, "contents", str), + [e], + detailed_message=f"the `contents` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: if not k: _errors__.append( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`".format( + "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `dirname`, `nameroot`, `nameext`, `checksum`, `size`, `secondaryFiles`, `format`, `contents`".format( k ), SourceLine(_doc, k, str), @@ -2093,8 +2169,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - items=items, - type_=type_, + location=location, + path=path, + basename=basename, + dirname=dirname, + nameroot=nameroot, + nameext=nameext, + checksum=checksum, + size=size, + secondaryFiles=secondaryFiles, + format=format, + contents=contents, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2111,26 +2196,82 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.location is not None: + u = save_relative_uri(self.location, base_url, False, None, relative_uris) + r["location"] = u + if self.path is not None: + u = save_relative_uri(self.path, base_url, False, None, relative_uris) + r["path"] = u + if self.basename is not None: + r["basename"] = save( + self.basename, top=False, base_url=base_url, relative_uris=relative_uris ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - + if self.dirname is not None: + r["dirname"] = save( + self.dirname, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.nameroot is not None: + r["nameroot"] = save( + self.nameroot, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.nameext is not None: + r["nameext"] = save( + self.nameext, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.checksum is not None: + r["checksum"] = save( + self.checksum, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.size is not None: + r["size"] = save( + self.size, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.format is not None: + u = save_relative_uri(self.format, base_url, True, None, relative_uris) + r["format"] = u + if self.contents is not None: + r["contents"] = save( + self.contents, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + def __init__( self, - items: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Array_name, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + dirname: None | str = None, + nameroot: None | str = None, + nameext: None | str = None, + checksum: None | str = None, + size: None | i32 | i64 = None, + secondaryFiles: None | Sequence[Directory | File] = None, + format: None | str = None, + contents: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2142,21 +2283,77 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ + self.class_: Final[str] = "File" + self.location = location + self.path = path + self.basename = basename + self.dirname = dirname + self.nameroot = nameroot + self.nameext = nameext + self.checksum = checksum + self.size = size + self.secondaryFiles = secondaryFiles + self.format = format + self.contents = contents - attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "class", + "location", + "path", + "basename", + "dirname", + "nameroot", + "nameext", + "checksum", + "size", + "secondaryFiles", + "format", + "contents", + ] + ) @mypyc_attr(native_class=True) -class MapSchema(Saveable): +class Directory(Saveable): + """ + Represents a directory to present to a command line tool. + + Directories are represented as objects with ``class`` of ``Directory``. Directory objects have a number of properties that provide metadata about the directory. + + The ``location`` property of a Directory is a IRI that uniquely identifies the directory. Implementations must support the file:// IRI scheme and may support other schemes such as http://. Alternately to ``location``, implementations must also accept the ``path`` property on Directory, which must be a filesystem path available on the same host as the CWL runner (for inputs) or the runtime environment of a command line tool execution (for command line tool outputs). + + A Directory object may have a ``listing`` field. This is a list of File and Directory objects that are contained in the Directory. For each entry in ``listing``, the ``basename`` property defines the name of the File or Subdirectory when staged to disk. If ``listing`` is not provided, the implementation must have some way of fetching the Directory listing at runtime based on the ``location`` field. + + If a Directory does not have ``location``, it is a Directory literal. A Directory literal must provide ``listing``. Directory literals must be created on disk at runtime as needed. + + The resources in a Directory literal do not need to have any implied relationship in their ``location``. For example, a Directory listing may contain two files located on different hosts. It is the responsibility of the runtime to ensure that those files are staged to disk appropriately. Secondary files associated with files in ``listing`` must also be staged to the same Directory. + + When executing a CommandLineTool, Directories must be recursively staged first and have local values of ``path`` assigned. + + Directory objects in CommandLineTool output must provide either a ``location`` IRI or a ``path`` property in the context of the tool execution runtime (local to the compute node, or within the executing container). + + An ExpressionTool may forward file references from input to output by using the same value for ``location``. + + Name conflicts (the same ``basename`` appearing multiple times in ``listing`` or in any entry in ``secondaryFiles`` in the listing) is a fatal error. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, MapSchema): - return bool(self.type_ == other.type_ and self.values == other.values) + if isinstance(other, Directory): + return bool( + self.class_ == other.class_ + and self.location == other.location + and self.path == other.path + and self.basename == other.basename + and self.listing == other.listing + ) return False def __hash__(self) -> int: - return hash((self.type_, self.values)) + return hash( + (self.class_, self.location, self.path, self.basename, self.listing) + ) @classmethod def fromDoc( @@ -2173,117 +2370,226 @@ def fromDoc( _doc.lc.filename = doc.lc.filename _errors__ = [] try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Map_nameLoader_2, + class_ = _load_field( + _doc.get("class"), + uri_Directory_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) + raise e + location = None + if "location" in _doc: + try: + location = _load_field( + _doc.get("location"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("location") ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `location`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + val = _doc.get("location") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("values") is None: - raise ValidationException("missing required field `values`", None, []) - - values = load_field( - _doc.get("values"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("values") - ) + else: + _errors__.append( + ValidationException( + "the `location` field is not valid because:", + SourceLine(_doc, "location", str), + [e], + detailed_message=f"the `location` field with value `{val}` " + "is not valid because:", + ) + ) + path = None + if "path" in _doc: + try: + path = _load_field( + _doc.get("path"), + uri_union_of_None_type_or_strtype_False_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("path") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `values`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("values") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `path`": _errors__.append( ValidationException( - "the `values` field is not valid because:", - SourceLine(_doc, "values", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `values` field is not valid because:", - SourceLine(_doc, "values", str), - [e], - detailed_message=f"the `values` field with value `{val}` " - "is not valid because:", + val = _doc.get("path") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `type`, `values`".format( + else: + _errors__.append( + ValidationException( + "the `path` field is not valid because:", + SourceLine(_doc, "path", str), + [e], + detailed_message=f"the `path` field with value `{val}` " + "is not valid because:", + ) + ) + basename = None + if "basename" in _doc: + try: + basename = _load_field( + _doc.get("basename"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("basename") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `basename`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("basename") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `basename` field is not valid because:", + SourceLine(_doc, "basename", str), + [e], + detailed_message=f"the `basename` field with value `{val}` " + "is not valid because:", + ) + ) + listing = None + if "listing" in _doc: + try: + listing = _load_field( + _doc.get("listing"), + union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, + baseuri, + loadingOptions, + lc=_doc.get("listing") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `listing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("listing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [e], + detailed_message=f"the `listing` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `listing`".format( k ), SourceLine(_doc, k, str), @@ -2293,8 +2599,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - type_=type_, - values=values, + location=location, + path=path, + basename=basename, + listing=listing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2311,13 +2619,30 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.location is not None: + u = save_relative_uri(self.location, base_url, False, None, relative_uris) + r["location"] = u + if self.path is not None: + u = save_relative_uri(self.path, base_url, False, None, relative_uris) + r["path"] = u + if self.basename is not None: + r["basename"] = save( + self.basename, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.listing is not None: + r["listing"] = save( + self.listing, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.values is not None: - u = save_relative_uri(self.values, base_url, False, 2, relative_uris) - r["values"] = u # top refers to the directory level if top: @@ -2329,8 +2654,10 @@ def save( def __init__( self, - type_: Map_name, - values: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, + location: None | str = None, + path: None | str = None, + basename: None | str = None, + listing: None | Sequence[Directory | File] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2342,21 +2669,26 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.type_ = type_ - self.values = values + self.class_: Final[str] = "Directory" + self.location = location + self.path = path + self.basename = basename + self.listing = listing - attrs: ClassVar[Collection[str]] = frozenset(["type", "values"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["class", "location", "path", "basename", "listing"] + ) @mypyc_attr(native_class=True) -class UnionSchema(Saveable): +class InputBinding(Saveable): def __eq__(self, other: Any) -> bool: - if isinstance(other, UnionSchema): - return bool(self.names == other.names and self.type_ == other.type_) + if isinstance(other, InputBinding): + return bool(self.loadContents == other.loadContents) return False def __hash__(self) -> int: - return hash((self.names, self.type_)) + return hash((self.loadContents)) @classmethod def fromDoc( @@ -2372,133 +2704,83 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("names") is None: - raise ValidationException("missing required field `names`", None, []) - - names = load_field( - _doc.get("names"), - uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("names") - ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `names`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("names") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( - "the `names` field is not valid because:", - SourceLine(_doc, "names", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None + ) + ) + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "the `names` field is not valid because:", - SourceLine(_doc, "names", str), - [e], - detailed_message=f"the `names` field with value `{val}` " - "is not valid because:", + "invalid field `{}`, expected one of: `loadContents`".format( + k + ), + SourceLine(_doc, k, str), ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Union_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `names`, `type`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - names=names, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + loadContents=loadContents, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed def save( self, top: bool = False, base_url: str = "", relative_uris: bool = True @@ -2511,12 +2793,12 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.names is not None: - u = save_relative_uri(self.names, base_url, False, 2, relative_uris) - r["names"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -2529,8 +2811,7 @@ def save( def __init__( self, - names: ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | Sequence[ArraySchema | EnumSchema | MapSchema | PrimitiveType | RecordSchema | UnionSchema | str] | UnionSchema | str, - type_: Union_name, + loadContents: None | bool = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -2542,21 +2823,44 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.names = names - self.type_ = type_ + self.loadContents = loadContents - attrs: ClassVar[Collection[str]] = frozenset(["names", "type"]) + attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) @mypyc_attr(native_class=True) -class CWLArraySchema(ArraySchema): +class InputRecordField(CWLRecordField): + name: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLArraySchema): - return bool(self.items == other.items and self.type_ == other.type_) + if isinstance(other, InputRecordField): + return bool( + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.format == other.format + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + ) return False def __hash__(self) -> int: - return hash((self.items, self.type_)) + return hash( + ( + self.doc, + self.name, + self.type_, + self.label, + self.secondaryFiles, + self.streamable, + self.format, + self.loadContents, + self.loadListing, + ) + ) @classmethod def fromDoc( @@ -2572,61 +2876,116 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `name`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Array_nameLoader_2, + typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -2668,131 +3027,68 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - items=items, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.items is not None: - u = save_relative_uri(self.items, base_url, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - items: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, - type_: Array_name, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset(["items", "type"]) - - -@mypyc_attr(native_class=True) -class CWLRecordField(RecordField): - name: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLRecordField): - return bool( - self.doc == other.doc - and self.name == other.name - and self.type_ == other.type_ - ) - return False - - def __hash__(self) -> int: - return hash((self.doc, self.name, self.type_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - name = None - if "name" in _doc: + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: try: - name = load_field( - _doc.get("name"), - uri_strtype_True_False_None_None, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -2800,13 +3096,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -2818,37 +3114,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "" - _errors__.append(ValidationException("missing name")) - else: - baseuri = name - doc = None - if "doc" in _doc: + streamable = None + if "streamable" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -2856,13 +3143,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -2874,77 +3161,170 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `format`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `loadContents`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) + loadListing = None + if "loadListing" in _doc: + try: + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, + baseuri, + loadingOptions, + lc=_doc.get("loadListing") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `loadListing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadListing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), + [e], + detailed_message=f"the `loadListing` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `loadContents`, `loadListing`".format( k ), SourceLine(_doc, k, str), @@ -2957,6 +3337,12 @@ def fromDoc( name=name, doc=doc, type_=type_, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + format=format, + loadContents=loadContents, + loadListing=loadListing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -2985,6 +3371,41 @@ def save( r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.format is not None: + u = save_relative_uri(self.format, self.name, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) # top refers to the directory level if top: @@ -2997,8 +3418,14 @@ def save( def __init__( self, name: str, - type_: CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] | str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -3013,19 +3440,45 @@ def __init__( self.doc = doc self.name = name self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing - attrs: ClassVar[Collection[str]] = frozenset(["doc", "name", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "doc", + "name", + "type", + "label", + "secondaryFiles", + "streamable", + "format", + "loadContents", + "loadListing", + ] + ) @mypyc_attr(native_class=True) -class CWLRecordSchema(RecordSchema): +class InputRecordSchema(CWLRecordSchema): + name: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, CWLRecordSchema): - return bool(self.fields == other.fields and self.type_ == other.type_) + if isinstance(other, InputRecordSchema): + return bool( + self.fields == other.fields + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.name == other.name + ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_)) + return hash((self.fields, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -3041,12 +3494,67 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `name`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name fields = None if "fields" in _doc: try: - fields = load_field( + fields = _load_field( _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CWLRecordFieldLoader, + idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader, baseuri, loadingOptions, lc=_doc.get("fields") @@ -3092,7 +3600,7 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), typedsl_Record_nameLoader_2, baseuri, @@ -3136,22 +3644,116 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -3161,11 +3763,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + name=name, fields=fields, type_=type_, + label=label, + doc=doc, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -3179,13 +3785,24 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u if self.fields is not None: r["fields"] = save( - self.fields, top=False, base_url=base_url, relative_uris=relative_uris + self.fields, top=False, base_url=self.name, relative_uris=relative_uris ) if self.type_ is not None: r["type"] = save( - self.type_, top=False, base_url=base_url, relative_uris=relative_uris + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -3199,7 +3816,10 @@ def save( def __init__( self, type_: Record_name, - fields: None | Sequence[CWLRecordField] = None, + fields: None | Sequence[InputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -3213,117 +3833,32 @@ def __init__( self.loadingOptions = LoadingOptions() self.fields = fields self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - attrs: ClassVar[Collection[str]] = frozenset(["fields", "type"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["fields", "type", "label", "doc", "name"] + ) @mypyc_attr(native_class=True) -class File(Saveable): - """ - Represents a file (or group of files when `secondaryFiles` is provided) that - will be accessible by tools using standard POSIX file system call API such as - open(2) and read(2). - - Files are represented as objects with `class` of `File`. File objects have - a number of properties that provide metadata about the file. - - The `location` property of a File is a IRI that uniquely identifies the - file. Implementations must support the `file://` IRI scheme and may support - other schemes such as `http://` and `https://`. The value of `location` may also be a - relative reference, in which case it must be resolved relative to the IRI - of the document it appears in. Alternately to `location`, implementations - must also accept the `path` property on File, which must be a filesystem - path available on the same host as the CWL runner (for inputs) or the - runtime environment of a command line tool execution (for command line tool - outputs). - - If no `location` or `path` is specified, a file object must specify - `contents` with the UTF-8 text content of the file. This is a "file - literal". File literals do not correspond to external resources, but are - created on disk with `contents` with when needed for executing a tool. - Where appropriate, expressions can return file literals to define new files - on a runtime. The maximum size of `contents` is 64 kilobytes. - - The `basename` property defines the filename on disk where the file is - staged. This may differ from the resource name. If not provided, - `basename` must be computed from the last path part of `location` and made - available to expressions. - - The `secondaryFiles` property is a list of File or Directory objects that - must be staged in the same directory as the primary file. It is an error - for file names to be duplicated in `secondaryFiles`. - - The `size` property is the size in bytes of the File. It must be computed - from the resource and made available to expressions. The `checksum` field - contains a cryptographic hash of the file content for use it verifying file - contents. Implementations may, at user option, enable or disable - computation of the `checksum` field for performance or other reasons. - However, the ability to compute output checksums is required to pass the - CWL conformance test suite. - - When executing a CommandLineTool, the files and secondary files may be - staged to an arbitrary directory, but must use the value of `basename` for - the filename. The `path` property must be file path in the context of the - tool execution runtime (local to the compute node, or within the executing - container). All computed properties should be available to expressions. - File literals also must be staged and `path` must be set. - - When collecting CommandLineTool outputs, `glob` matching returns file paths - (with the `path` property) and the derived properties. This can all be - modified by `outputEval`. Alternately, if the file `cwl.output.json` is - present in the output, `outputBinding` is ignored. - - File objects in the output must provide either a `location` IRI or a `path` - property in the context of the tool execution runtime (local to the compute - node, or within the executing container). - - When evaluating an ExpressionTool, file objects must be referenced via - `location` (the expression tool does not have access to files on disk so - `path` is meaningless) or as file literals. It is legal to return a file - object with an existing `location` but a different `basename`. The - `loadContents` field of ExpressionTool inputs behaves the same as on - CommandLineTool inputs, however it is not meaningful on the outputs. - - An ExpressionTool may forward file references from input to output by using - the same value for `location`. - - """ +class InputEnumSchema(schema_salad.metaschema.EnumSchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, File): + if isinstance(other, InputEnumSchema): return bool( - self.class_ == other.class_ - and self.location == other.location - and self.path == other.path - and self.basename == other.basename - and self.dirname == other.dirname - and self.nameroot == other.nameroot - and self.nameext == other.nameext - and self.checksum == other.checksum - and self.size == other.size - and self.secondaryFiles == other.secondaryFiles - and self.format == other.format - and self.contents == other.contents + self.name == other.name + and self.symbols == other.symbols + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc ) return False def __hash__(self) -> int: - return hash( - ( - self.class_, - self.location, - self.path, - self.basename, - self.dirname, - self.nameroot, - self.nameext, - self.checksum, - self.size, - self.secondaryFiles, - self.format, - self.contents, - ) - ) + return hash((self.name, self.symbols, self.type_, self.label, self.doc)) @classmethod def fromDoc( @@ -3339,37 +3874,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_File_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - location = None - if "location" in _doc: + name = None + if "name" in _doc: try: - location = load_field( - _doc.get("location"), - uri_union_of_None_type_or_strtype_False_False_None_None, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("location") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `location`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -3377,13 +3896,13 @@ def fromDoc( ) ) else: - val = _doc.get("location") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3395,169 +3914,132 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `location` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - path = None - if "path" in _doc: - try: - path = load_field( - _doc.get("path"), - uri_union_of_None_type_or_strtype_False_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("path") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + try: + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) - if str(e) == "missing required field `path`": + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("symbols") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `symbols`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("symbols") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("path") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), - [e], - detailed_message=f"the `path` field with value `{val}` " - "is not valid because:", - ) + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) - basename = None - if "basename" in _doc: - try: - basename = load_field( - _doc.get("basename"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("basename") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `basename`": + ) + else: _errors__.append( ValidationException( - str(e), - None + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [e], + detailed_message=f"the `symbols` field with value `{val}` " + "is not valid because:", ) ) - else: - val = _doc.get("basename") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), - [e], - detailed_message=f"the `basename` field with value `{val}` " - "is not valid because:", - ) - ) - dirname = None - if "dirname" in _doc: - try: - dirname = load_field( - _doc.get("dirname"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("dirname") - ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + type_ = _load_field( + _doc.get("type"), + typedsl_Enum_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) - if str(e) == "missing required field `dirname`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("dirname") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `dirname` field is not valid because:", - SourceLine(_doc, "dirname", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `dirname` field is not valid because:", - SourceLine(_doc, "dirname", str), - [e], - detailed_message=f"the `dirname` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", ) - nameroot = None - if "nameroot" in _doc: + ) + label = None + if "label" in _doc: try: - nameroot = load_field( - _doc.get("nameroot"), + label = _load_field( + _doc.get("label"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("nameroot") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `nameroot`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -3565,13 +4047,13 @@ def fromDoc( ) ) else: - val = _doc.get("nameroot") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `nameroot` field is not valid because:", - SourceLine(_doc, "nameroot", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3583,28 +4065,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `nameroot` field is not valid because:", - SourceLine(_doc, "nameroot", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `nameroot` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - nameext = None - if "nameext" in _doc: + doc = None + if "doc" in _doc: try: - nameext = load_field( - _doc.get("nameext"), - union_of_None_type_or_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("nameext") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `nameext`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -3612,13 +4094,13 @@ def fromDoc( ) ) else: - val = _doc.get("nameext") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `nameext` field is not valid because:", - SourceLine(_doc, "nameext", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3630,75 +4112,163 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `nameext` field is not valid because:", - SourceLine(_doc, "nameext", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `nameext` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - checksum = None - if "checksum" in _doc: - try: - checksum = load_field( - _doc.get("checksum"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("checksum") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `checksum`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("checksum") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `checksum` field is not valid because:", - SourceLine(_doc, "checksum", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( + k + ), + SourceLine(_doc, k, str), ) - else: - _errors__.append( - ValidationException( - "the `checksum` field is not valid because:", - SourceLine(_doc, "checksum", str), - [e], - detailed_message=f"the `checksum` field with value `{val}` " - "is not valid because:", - ) - ) - size = None - if "size" in _doc: + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + name=name, + symbols=symbols, + type_=type_, + label=label, + doc=doc, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + loadingOptions.idx[name] = (_constructed, loadingOptions) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc + + attrs: ClassVar[Collection[str]] = frozenset( + ["name", "symbols", "type", "label", "doc"] + ) + + +@mypyc_attr(native_class=True) +class InputArraySchema(CWLArraySchema): + name: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, InputArraySchema): + return bool( + self.items == other.items + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.name == other.name + ) + return False + + def __hash__(self) -> int: + return hash((self.items, self.type_, self.label, self.doc, self.name)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + name = None + if "name" in _doc: try: - size = load_field( - _doc.get("size"), - union_of_None_type_or_inttype_or_inttype, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("size") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `size`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -3706,13 +4276,13 @@ def fromDoc( ) ) else: - val = _doc.get("size") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `size` field is not valid because:", - SourceLine(_doc, "size", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3724,122 +4294,179 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `size` field is not valid because:", - SourceLine(_doc, "size", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `size` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - if str(e) == "missing required field `secondaryFiles`": + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": _errors__.append( ValidationException( - str(e), - None + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", ) ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Array_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " f"{verb_tensage} {error_message}")], ) ) else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - contents = None - if "contents" in _doc: + doc = None + if "doc" in _doc: try: - contents = load_field( - _doc.get("contents"), - union_of_None_type_or_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("contents") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `contents`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -3847,13 +4474,13 @@ def fromDoc( ) ) else: - val = _doc.get("contents") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `contents` field is not valid because:", - SourceLine(_doc, "contents", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -3865,10 +4492,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `contents` field is not valid because:", - SourceLine(_doc, "contents", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `contents` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) @@ -3880,14 +4507,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `dirname`, `nameroot`, `nameext`, `checksum`, `size`, `secondaryFiles`, `format`, `contents`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -3897,20 +4524,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - location=location, - path=path, - basename=basename, - dirname=dirname, - nameroot=nameroot, - nameext=nameext, - checksum=checksum, - size=size, - secondaryFiles=secondaryFiles, - format=format, - contents=contents, + name=name, + items=items, + type_=type_, + label=label, + doc=doc, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -3924,57 +4546,23 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.location is not None: - u = save_relative_uri(self.location, base_url, False, None, relative_uris) - r["location"] = u - if self.path is not None: - u = save_relative_uri(self.path, base_url, False, None, relative_uris) - r["path"] = u - if self.basename is not None: - r["basename"] = save( - self.basename, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.dirname is not None: - r["dirname"] = save( - self.dirname, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.nameroot is not None: - r["nameroot"] = save( - self.nameroot, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.nameext is not None: - r["nameext"] = save( - self.nameext, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.checksum is not None: - r["checksum"] = save( - self.checksum, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.size is not None: - r["size"] = save( - self.size, top=False, base_url=base_url, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.items is not None: + u = save_relative_uri(self.items, self.name, False, 2, relative_uris) + r["items"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.format is not None: - u = save_relative_uri(self.format, base_url, True, None, relative_uris) - r["format"] = u - if self.contents is not None: - r["contents"] = save( - self.contents, top=False, base_url=base_url, relative_uris=relative_uris + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -3987,17 +4575,11 @@ def save( def __init__( self, - location: None | str = None, - path: None | str = None, - basename: None | str = None, - dirname: None | str = None, - nameroot: None | str = None, - nameext: None | str = None, - checksum: None | str = None, - size: None | i32 = None, - secondaryFiles: None | Sequence[Directory | File] = None, - format: None | str = None, - contents: None | str = None, + items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + type_: Array_name, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -4009,100 +4591,45 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "File" - self.location = location - self.path = path - self.basename = basename - self.dirname = dirname - self.nameroot = nameroot - self.nameext = nameext - self.checksum = checksum - self.size = size - self.secondaryFiles = secondaryFiles - self.format = format - self.contents = contents + self.items = items + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - [ - "class", - "location", - "path", - "basename", - "dirname", - "nameroot", - "nameext", - "checksum", - "size", - "secondaryFiles", - "format", - "contents", - ] + ["items", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class Directory(Saveable): - """ - Represents a directory to present to a command line tool. - - Directories are represented as objects with `class` of `Directory`. Directory objects have - a number of properties that provide metadata about the directory. - - The `location` property of a Directory is a IRI that uniquely identifies - the directory. Implementations must support the file:// IRI scheme and may - support other schemes such as http://. Alternately to `location`, - implementations must also accept the `path` property on Directory, which - must be a filesystem path available on the same host as the CWL runner (for - inputs) or the runtime environment of a command line tool execution (for - command line tool outputs). - - A Directory object may have a `listing` field. This is a list of File and - Directory objects that are contained in the Directory. For each entry in - `listing`, the `basename` property defines the name of the File or - Subdirectory when staged to disk. If `listing` is not provided, the - implementation must have some way of fetching the Directory listing at - runtime based on the `location` field. - - If a Directory does not have `location`, it is a Directory literal. A - Directory literal must provide `listing`. Directory literals must be - created on disk at runtime as needed. - - The resources in a Directory literal do not need to have any implied - relationship in their `location`. For example, a Directory listing may - contain two files located on different hosts. It is the responsibility of - the runtime to ensure that those files are staged to disk appropriately. - Secondary files associated with files in `listing` must also be staged to - the same Directory. - - When executing a CommandLineTool, Directories must be recursively staged - first and have local values of `path` assigned. - - Directory objects in CommandLineTool output must provide either a - `location` IRI or a `path` property in the context of the tool execution - runtime (local to the compute node, or within the executing container). - - An ExpressionTool may forward file references from input to output by using - the same value for `location`. - - Name conflicts (the same `basename` appearing multiple times in `listing` - or in any entry in `secondaryFiles` in the listing) is a fatal error. - - """ +class OutputRecordField(CWLRecordField): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, Directory): + if isinstance(other, OutputRecordField): return bool( - self.class_ == other.class_ - and self.location == other.location - and self.path == other.path - and self.basename == other.basename - and self.listing == other.listing + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.format == other.format ) return False def __hash__(self) -> int: return hash( - (self.class_, self.location, self.path, self.basename, self.listing) + ( + self.doc, + self.name, + self.type_, + self.label, + self.secondaryFiles, + self.streamable, + self.format, + ) ) @classmethod @@ -4119,37 +4646,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_Directory_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - location = None - if "location" in _doc: + name = None + if "name" in _doc: try: - location = load_field( - _doc.get("location"), - uri_union_of_None_type_or_strtype_False_False_None_None, + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("location") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `location`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -4157,13 +4668,13 @@ def fromDoc( ) ) else: - val = _doc.get("location") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4175,28 +4686,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `location` field is not valid because:", - SourceLine(_doc, "location", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `location` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - path = None - if "path" in _doc: + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: try: - path = load_field( - _doc.get("path"), - uri_union_of_None_type_or_strtype_False_False_None_None, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("path") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `path`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -4204,13 +4724,13 @@ def fromDoc( ) ) else: - val = _doc.get("path") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4222,28 +4742,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `path` field is not valid because:", - SourceLine(_doc, "path", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `path` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - basename = None - if "basename" in _doc: + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: try: - basename = load_field( - _doc.get("basename"), + label = _load_field( + _doc.get("label"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("basename") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `basename`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -4251,13 +4819,13 @@ def fromDoc( ) ) else: - val = _doc.get("basename") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4269,28 +4837,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `basename` field is not valid because:", - SourceLine(_doc, "basename", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `basename` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - listing = None - if "listing" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - listing = load_field( - _doc.get("listing"), - union_of_None_type_or_array_of_union_of_FileLoader_or_DirectoryLoader, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("listing") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `listing`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -4298,13 +4866,13 @@ def fromDoc( ) ) else: - val = _doc.get("listing") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4316,170 +4884,89 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `listing` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `streamable`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `location`, `path`, `basename`, `listing`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - location=location, - path=path, - basename=basename, - listing=listing, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.location is not None: - u = save_relative_uri(self.location, base_url, False, None, relative_uris) - r["location"] = u - if self.path is not None: - u = save_relative_uri(self.path, base_url, False, None, relative_uris) - r["path"] = u - if self.basename is not None: - r["basename"] = save( - self.basename, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.listing is not None: - r["listing"] = save( - self.listing, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - location: None | str = None, - path: None | str = None, - basename: None | str = None, - listing: None | Sequence[Directory | File] = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "Directory" - self.location = location - self.path = path - self.basename = basename - self.listing = listing - - attrs: ClassVar[Collection[str]] = frozenset( - ["class", "location", "path", "basename", "listing"] - ) - - -@mypyc_attr(native_class=True) -class InputBinding(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, InputBinding): - return bool(self.loadContents == other.loadContents) - return False - - def __hash__(self) -> int: - return hash((self.loadContents)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadContents`": - _errors__.append( - ValidationException( - str(e), - None + str(e), + None ) ) else: - val = _doc.get("loadContents") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4491,10 +4978,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) @@ -4506,14 +4993,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `loadContents`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`".format( k ), SourceLine(_doc, k, str), @@ -4523,10 +5010,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - loadContents=loadContents, + name=name, + doc=doc, + type_=type_, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + format=format, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -4540,13 +5034,38 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, top=False, - base_url=base_url, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.name, relative_uris=relative_uris, ) + if self.format is not None: + u = save_relative_uri(self.format, self.name, True, None, relative_uris) + r["format"] = u # top refers to the directory level if top: @@ -4558,7 +5077,13 @@ def save( def __init__( self, - loadContents: None | bool = None, + name: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -4570,44 +5095,36 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format - attrs: ClassVar[Collection[str]] = frozenset(["loadContents"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] + ) @mypyc_attr(native_class=True) -class InputRecordField(CWLRecordField): +class OutputRecordSchema(CWLRecordSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputRecordField): + if isinstance(other, OutputRecordSchema): return bool( - self.doc == other.doc - and self.name == other.name + self.fields == other.fields and self.type_ == other.type_ and self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.format == other.format - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing + and self.doc == other.doc + and self.name == other.name ) return False def __hash__(self) -> int: - return hash( - ( - self.doc, - self.name, - self.type_, - self.label, - self.secondaryFiles, - self.streamable, - self.format, - self.loadContents, - self.loadListing, - ) - ) + return hash((self.fields, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -4626,9 +5143,9 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), - uri_strtype_True_False_None_None, + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("name") @@ -4675,25 +5192,24 @@ def fromDoc( if docRoot is not None: name = docRoot else: - name = "" - _errors__.append(ValidationException("missing name")) + name = "_:" + str(_uuid__.uuid4()) else: baseuri = name - doc = None - if "doc" in _doc: + fields = None + if "fields" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("fields") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `fields`": _errors__.append( ValidationException( str(e), @@ -4701,13 +5217,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("fields") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -4719,10 +5235,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `fields` field with value `{val}` " "is not valid because:", ) ) @@ -4730,9 +5246,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, + typedsl_Record_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -4777,7 +5293,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -4821,209 +5337,21 @@ def fromDoc( "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadContents`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadContents") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [e], - detailed_message=f"the `loadContents` field with value `{val}` " - "is not valid because:", - ) - ) - loadListing = None - if "loadListing" in _doc: + doc = None + if "doc" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("loadListing") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -5031,13 +5359,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadListing") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -5049,10 +5377,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `loadListing` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) @@ -5064,14 +5392,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `loadContents`, `loadListing`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -5082,14 +5410,10 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - doc=doc, + fields=fields, type_=type_, label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - format=format, - loadContents=loadContents, - loadListing=loadListing, + doc=doc, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -5110,9 +5434,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=self.name, relative_uris=relative_uris ) if self.type_ is not None: r["type"] = save( @@ -5122,36 +5446,9 @@ def save( r["label"] = save( self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.format is not None: - u = save_relative_uri(self.format, self.name, True, None, relative_uris) - r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -5164,15 +5461,11 @@ def save( def __init__( self, - name: str, - type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, + type_: Record_name, + fields: None | Sequence[OutputRecordField] = None, label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5184,48 +5477,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name + self.fields = fields self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - [ - "doc", - "name", - "type", - "label", - "secondaryFiles", - "streamable", - "format", - "loadContents", - "loadListing", - ] + ["fields", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class InputRecordSchema(CWLRecordSchema): +class OutputEnumSchema(schema_salad.metaschema.EnumSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputRecordSchema): + if isinstance(other, OutputEnumSchema): return bool( - self.fields == other.fields + self.name == other.name + and self.symbols == other.symbols and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc - and self.name == other.name ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.doc, self.name)) + return hash((self.name, self.symbols, self.type_, self.label, self.doc)) @classmethod def fromDoc( @@ -5244,7 +5523,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -5296,60 +5575,61 @@ def fromDoc( name = "_:" + str(_uuid__.uuid4()) else: baseuri = name - fields = None - if "fields" in _doc: - try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_InputRecordFieldLoader, - baseuri, - loadingOptions, - lc=_doc.get("fields") - ) + try: + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("symbols") + ) - if str(e) == "missing required field `fields`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `symbols`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("symbols") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("fields") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [e], - detailed_message=f"the `fields` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [e], + detailed_message=f"the `symbols` field with value `{val}` " + "is not valid because:", ) + ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Record_nameLoader_2, + typedsl_Enum_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -5394,7 +5674,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -5441,7 +5721,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -5493,14 +5773,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( k ), SourceLine(_doc, k, str), @@ -5511,7 +5791,7 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - fields=fields, + symbols=symbols, type_=type_, label=label, doc=doc, @@ -5535,10 +5815,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris @@ -5562,11 +5841,11 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[InputRecordField] = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, - name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5578,34 +5857,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - ["fields", "type", "label", "doc", "name"] + ["name", "symbols", "type", "label", "doc"] ) @mypyc_attr(native_class=True) -class InputEnumSchema(EnumSchema): +class OutputArraySchema(CWLArraySchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, InputEnumSchema): + if isinstance(other, OutputArraySchema): return bool( - self.name == other.name - and self.symbols == other.symbols + self.items == other.items and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc + and self.name == other.name ) return False def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_, self.label, self.doc)) + return hash((self.items, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -5624,7 +5903,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -5677,21 +5956,21 @@ def fromDoc( else: baseuri = name try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None, baseuri, loadingOptions, - lc=_doc.get("symbols") + lc=_doc.get("items") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": + if str(e) == "missing required field `items`": _errors__.append( ValidationException( str(e), @@ -5699,13 +5978,13 @@ def fromDoc( ) ) else: - val = _doc.get("symbols") + val = _doc.get("items") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -5717,10 +5996,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), [e], - detailed_message=f"the `symbols` field with value `{val}` " + detailed_message=f"the `items` field with value `{val}` " "is not valid because:", ) ) @@ -5728,9 +6007,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Enum_nameLoader_2, + typedsl_Array_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -5775,7 +6054,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -5822,7 +6101,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -5874,14 +6153,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -5892,7 +6171,7 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - symbols=symbols, + items=items, type_=type_, label=label, doc=doc, @@ -5916,9 +6195,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u + if self.items is not None: + u = save_relative_uri(self.items, self.name, False, 2, relative_uris) + r["items"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris @@ -5942,11 +6221,11 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, + items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -5958,34 +6237,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.items = items self.type_ = type_ self.label = label self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "doc"] + ["items", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class InputArraySchema(CWLArraySchema): - name: str +class InlineJavascriptRequirement(Saveable): + """ + Indicates that the workflow platform must support inline Javascript expressions. If this requirement is not present, the workflow platform must not perform expression interpolation. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, InputArraySchema): + if isinstance(other, InlineJavascriptRequirement): return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - and self.name == other.name + self.class_ == other.class_ + and self.expressionLib == other.expressionLib ) return False def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.doc, self.name)) + return hash((self.class_, self.expressionLib)) @classmethod def fromDoc( @@ -6001,21 +6280,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_InlineJavascriptRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + expressionLib = None + if "expressionLib" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + expressionLib = _load_field( + _doc.get("expressionLib"), + union_of_None_type_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("expressionLib") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `expressionLib`": _errors__.append( ValidationException( str(e), @@ -6023,13 +6319,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("expressionLib") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `expressionLib` field is not valid because:", + SourceLine(_doc, "expressionLib", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6041,208 +6337,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `expressionLib` field is not valid because:", + SourceLine(_doc, "expressionLib", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `expressionLib` field with value `{val}` " "is not valid because:", ) ) @@ -6254,14 +6352,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `class`, `expressionLib`".format( k ), SourceLine(_doc, k, str), @@ -6271,15 +6369,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - items=items, - type_=type_, - label=label, - doc=doc, + expressionLib=expressionLib, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6293,23 +6386,22 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.items is not None: - u = save_relative_uri(self.items, self.name, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.expressionLib is not None: + r["expressionLib"] = save( + self.expressionLib, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -6322,11 +6414,7 @@ def save( def __init__( self, - items: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, - type_: Array_name, - label: None | str = None, - doc: None | Sequence[str] | str = None, - name: None | str = None, + expressionLib: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -6338,46 +6426,30 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.class_: Final[str] = "InlineJavascriptRequirement" + self.expressionLib = expressionLib - attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "doc", "name"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) @mypyc_attr(native_class=True) -class OutputRecordField(CWLRecordField): - name: str - +class SchemaDefRequirement(Saveable): + """ + This field consists of an array of type definitions which must be used when interpreting the ``inputs`` and ``outputs`` fields. When a ``type`` field contains a IRI, the implementation must check if the type is defined in ``schemaDefs`` and use that definition. If the type is not found in ``schemaDefs``, it is an error. The entries in ``schemaDefs`` must be processed in the order listed such that later schema definitions may refer to earlier schema definitions. + + - **Type definitions are allowed for ``enum`` and ``record`` types only.** + - Type definitions may be shared by defining them in a file and then ``$include``-ing them in the ``types`` field. + - A file can contain a list of type definitions + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputRecordField): - return bool( - self.doc == other.doc - and self.name == other.name - and self.type_ == other.type_ - and self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.format == other.format - ) + if isinstance(other, SchemaDefRequirement): + return bool(self.class_ == other.class_ and self.types == other.types) return False def __hash__(self) -> int: - return hash( - ( - self.doc, - self.name, - self.type_, - self.label, - self.secondaryFiles, - self.streamable, - self.format, - ) - ) + return hash((self.class_, self.types)) @classmethod def fromDoc( @@ -6393,125 +6465,39 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("name") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "" - _errors__.append(ValidationException("missing name")) - else: - baseuri = name - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + class_ = _load_field( + _doc.get("class"), + uri_SchemaDefRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("types") is None: + raise ValidationException("missing required field `types`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, + types = _load_field( + _doc.get("types"), + array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("types") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `types`": _errors__.append( ValidationException( str(e), @@ -6519,13 +6505,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("types") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `types` field is not valid because:", + SourceLine(_doc, "types", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6537,169 +6523,199 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `types` field is not valid because:", + SourceLine(_doc, "types", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `types` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - str(e), - None + "invalid field `{}`, expected one of: `class`, `types`".format( + k + ), + SourceLine(_doc, k, str), ) ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + types=types, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `streamable`": + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.types is not None: + r["types"] = save( + self.types, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "SchemaDefRequirement" + self.types = types + + attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + + +@mypyc_attr(native_class=True) +class SecondaryFileSchema(Saveable): + """ + Secondary files are specified using the following micro-DSL for secondary files: + + * If the value is a string, it is transformed to an object with two fields ``pattern`` and ``required`` + * By default, the value of ``required`` is ``null`` (this indicates default behavior, which may be based on the context) + * If the value ends with a question mark ``?`` the question mark is stripped off and the value of the field ``required`` is set to ``False`` + * The remaining value is assigned to the field ``pattern`` + + For implementation details and examples, please see `this section `__ in the Schema Salad specification. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, SecondaryFileSchema): + return bool( + self.pattern == other.pattern and self.required == other.required + ) + return False + + def __hash__(self) -> int: + return hash((self.pattern, self.required)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("pattern") is None: + raise ValidationException("missing required field `pattern`", None, []) + + pattern = _load_field( + _doc.get("pattern"), + union_of_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("pattern") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `pattern`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("pattern") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `pattern` field is not valid because:", + SourceLine(_doc, "pattern", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `pattern` field is not valid because:", + SourceLine(_doc, "pattern", str), + [e], + detailed_message=f"the `pattern` field with value `{val}` " + "is not valid because:", ) - format = None - if "format" in _doc: + ) + required = None + if "required" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + required = _load_field( + _doc.get("required"), + union_of_None_type_or_booltype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("required") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `required`": _errors__.append( ValidationException( str(e), @@ -6707,13 +6723,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("required") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `required` field is not valid because:", + SourceLine(_doc, "required", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -6725,10 +6741,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `required` field is not valid because:", + SourceLine(_doc, "required", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `required` field with value `{val}` " "is not valid because:", ) ) @@ -6740,14 +6756,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`".format( + "invalid field `{}`, expected one of: `pattern`, `required`".format( k ), SourceLine(_doc, k, str), @@ -6757,17 +6773,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - doc=doc, - type_=type_, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - format=format, + pattern=pattern, + required=required, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -6781,38 +6791,14 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.pattern is not None: + r["pattern"] = save( + self.pattern, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.required is not None: + r["required"] = save( + self.required, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.format is not None: - u = save_relative_uri(self.format, self.name, True, None, relative_uris) - r["format"] = u # top refers to the directory level if top: @@ -6824,14 +6810,9 @@ def save( def __init__( self, - name: str, - type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - format: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, + pattern: str, + required: None | bool | str = None, + extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: @@ -6842,36 +6823,28 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name - self.type_ = type_ - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format + self.pattern = pattern + self.required = required - attrs: ClassVar[Collection[str]] = frozenset( - ["doc", "name", "type", "label", "secondaryFiles", "streamable", "format"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) @mypyc_attr(native_class=True) -class OutputRecordSchema(CWLRecordSchema): - name: str +class LoadListingRequirement(Saveable): + """ + Specify the desired behavior for loading the ``listing`` field of a Directory object for use by expressions. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputRecordSchema): + if isinstance(other, LoadListingRequirement): return bool( - self.fields == other.fields - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - and self.name == other.name + self.class_ == other.class_ and self.loadListing == other.loadListing ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.doc, self.name)) + return hash((self.class_, self.loadListing)) @classmethod def fromDoc( @@ -6887,218 +6860,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("name") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - fields = None - if "fields" in _doc: - try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_OutputRecordFieldLoader, - baseuri, - loadingOptions, - lc=_doc.get("fields") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `fields`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("fields") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), - [e], - detailed_message=f"the `fields` field with value `{val}` " - "is not valid because:", - ) - ) try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, + class_ = _load_field( + _doc.get("class"), + uri_LoadListingRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: + raise e + loadListing = None + if "loadListing" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("loadListing") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -7106,13 +6899,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7124,10 +6917,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " "is not valid because:", ) ) @@ -7139,14 +6932,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( + "invalid field `{}`, expected one of: `class`, `loadListing`".format( k ), SourceLine(_doc, k, str), @@ -7156,15 +6949,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - fields=fields, - type_=type_, - label=label, - doc=doc, + loadListing=loadListing, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7178,24 +6966,22 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -7208,11 +6994,7 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[OutputRecordField] = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - name: None | str = None, + loadListing: LoadListingEnum | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -7224,34 +7006,28 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.class_: Final[str] = "LoadListingRequirement" + self.loadListing = loadListing - attrs: ClassVar[Collection[str]] = frozenset( - ["fields", "type", "label", "doc", "name"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) @mypyc_attr(native_class=True) -class OutputEnumSchema(EnumSchema): - name: str +class EnvironmentDef(Saveable): + """ + Define an environment variable that will be set in the runtime environment by the workflow platform when executing the command line tool. May be the result of executing an expression, such as getting a parameter from input. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputEnumSchema): + if isinstance(other, EnvironmentDef): return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc + self.envName == other.envName and self.envValue == other.envValue ) return False def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_, self.label, self.doc)) + return hash((self.envName, self.envValue)) @classmethod def fromDoc( @@ -7267,77 +7043,22 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("name") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), - [e], - detailed_message=f"the `name` field with value `{val}` " - "is not valid because:", - ) - ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) + if _doc.get("envName") is None: + raise ValidationException("missing required field `envName`", None, []) - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, + envName = _load_field( + _doc.get("envName"), + strtype, baseuri, loadingOptions, - lc=_doc.get("symbols") + lc=_doc.get("envName") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": + if str(e) == "missing required field `envName`": _errors__.append( ValidationException( str(e), @@ -7345,13 +7066,13 @@ def fromDoc( ) ) else: - val = _doc.get("symbols") + val = _doc.get("envName") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), + "the `envName` field is not valid because:", + SourceLine(_doc, "envName", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7363,29 +7084,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), + "the `envName` field is not valid because:", + SourceLine(_doc, "envName", str), [e], - detailed_message=f"the `symbols` field with value `{val}` " + detailed_message=f"the `envName` field with value `{val}` " "is not valid because:", ) ) try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + if _doc.get("envValue") is None: + raise ValidationException("missing required field `envValue`", None, []) - type_ = load_field( - _doc.get("type"), - typedsl_Enum_nameLoader_2, + envValue = _load_field( + _doc.get("envValue"), + union_of_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("type") + lc=_doc.get("envValue") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": + if str(e) == "missing required field `envValue`": _errors__.append( ValidationException( str(e), @@ -7393,13 +7114,13 @@ def fromDoc( ) ) else: - val = _doc.get("type") + val = _doc.get("envValue") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `envValue` field is not valid because:", + SourceLine(_doc, "envValue", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7411,107 +7132,13 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), + "the `envValue` field is not valid because:", + SourceLine(_doc, "envValue", str), [e], - detailed_message=f"the `type` field with value `{val}` " + detailed_message=f"the `envValue` field with value `{val}` " "is not valid because:", ) ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -7520,14 +7147,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( + "invalid field `{}`, expected one of: `envName`, `envValue`".format( k ), SourceLine(_doc, k, str), @@ -7537,15 +7164,11 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - symbols=symbols, - type_=type_, - label=label, - doc=doc, + envName=envName, + envValue=envValue, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -7559,23 +7182,13 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + if self.envName is not None: + r["envName"] = save( + self.envName, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.envValue is not None: + r["envValue"] = save( + self.envValue, top=False, base_url=base_url, relative_uris=relative_uris ) # top refers to the directory level @@ -7588,11 +7201,8 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, + envName: str, + envValue: str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -7604,34 +7214,62 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ - self.label = label - self.doc = doc + self.envName = envName + self.envValue = envValue - attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "doc"] - ) + attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) @mypyc_attr(native_class=True) -class OutputArraySchema(CWLArraySchema): - name: str +class CommandLineBinding(InputBinding): + """ + When listed under ``inputBinding`` in the input schema, the term "value" refers to the corresponding value in the input object. For binding objects listed in ``CommandLineTool.arguments``, the term "value" refers to the effective value after evaluating ``valueFrom``. + + The binding behavior when building the command line depends on the data type of the value. If there is a mismatch between the type described by the input schema and the effective value, such as resulting from an expression evaluation, an implementation must use the data type of the effective value. + + - **string**: Add ``prefix`` and the string to the command line. + + - **number**: Add ``prefix`` and decimal representation to command line. + + - **boolean**: If true, add ``prefix`` to the command line. If false, add nothing. + + - **File**: Add ``prefix`` and the value of ```File.path`` <#File>`__ to the command line. + + - **Directory**: Add ``prefix`` and the value of ```Directory.path`` <#Directory>`__ to the command line. + + - **array**: If ``itemSeparator`` is specified, add ``prefix`` and the join the array into a single string with ``itemSeparator`` separating the items. Otherwise, first add ``prefix``, then recursively process individual elements. If the array is empty, it does not add anything to command line. + + - **object**: Add ``prefix`` only, and recursively add object fields for which ``inputBinding`` is specified. + + - **null**: Add nothing. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, OutputArraySchema): + if isinstance(other, CommandLineBinding): return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - and self.name == other.name + self.loadContents == other.loadContents + and self.position == other.position + and self.prefix == other.prefix + and self.separate == other.separate + and self.itemSeparator == other.itemSeparator + and self.valueFrom == other.valueFrom + and self.shellQuote == other.shellQuote ) return False def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.doc, self.name)) + return hash( + ( + self.loadContents, + self.position, + self.prefix, + self.separate, + self.itemSeparator, + self.valueFrom, + self.shellQuote, + ) + ) @classmethod def fromDoc( @@ -7647,21 +7285,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + loadContents = None + if "loadContents" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("loadContents") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( str(e), @@ -7669,13 +7307,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("loadContents") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7687,132 +7325,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `loadContents` field with value `{val}` " "is not valid because:", ) ) - - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: + position = None + if "position" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + position = _load_field( + _doc.get("position"), + union_of_None_type_or_inttype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("position") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `position`": _errors__.append( ValidationException( str(e), @@ -7820,13 +7354,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("position") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `position` field is not valid because:", + SourceLine(_doc, "position", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7838,28 +7372,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `position` field is not valid because:", + SourceLine(_doc, "position", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `position` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + prefix = None + if "prefix" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + prefix = _load_field( + _doc.get("prefix"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("prefix") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `prefix`": _errors__.append( ValidationException( str(e), @@ -7867,13 +7401,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("prefix") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `prefix` field is not valid because:", + SourceLine(_doc, "prefix", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -7885,181 +7419,75 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `prefix` field is not valid because:", + SourceLine(_doc, "prefix", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `prefix` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: + separate = None + if "separate" in _doc: + try: + separate = _load_field( + _doc.get("separate"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("separate") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `separate`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - items=items, - type_=type_, - label=label, - doc=doc, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.items is not None: - u = save_relative_uri(self.items, self.name, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - items: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - type_: Array_name, - label: None | str = None, - doc: None | Sequence[str] | str = None, - name: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - - attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "doc", "name"] - ) - - -@mypyc_attr(native_class=True) -class InlineJavascriptRequirement(Saveable): - """ - Indicates that the workflow platform must support inline Javascript expressions. - If this requirement is not present, the workflow platform must not perform expression - interpolation. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, InlineJavascriptRequirement): - return bool( - self.class_ == other.class_ - and self.expressionLib == other.expressionLib - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.expressionLib)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_InlineJavascriptRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - expressionLib = None - if "expressionLib" in _doc: + else: + val = _doc.get("separate") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `separate` field is not valid because:", + SourceLine(_doc, "separate", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `separate` field is not valid because:", + SourceLine(_doc, "separate", str), + [e], + detailed_message=f"the `separate` field with value `{val}` " + "is not valid because:", + ) + ) + itemSeparator = None + if "itemSeparator" in _doc: try: - expressionLib = load_field( - _doc.get("expressionLib"), - union_of_None_type_or_array_of_strtype, + itemSeparator = _load_field( + _doc.get("itemSeparator"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("expressionLib") + lc=_doc.get("itemSeparator") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `expressionLib`": + if str(e) == "missing required field `itemSeparator`": _errors__.append( ValidationException( str(e), @@ -8067,13 +7495,13 @@ def fromDoc( ) ) else: - val = _doc.get("expressionLib") + val = _doc.get("itemSeparator") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `expressionLib` field is not valid because:", - SourceLine(_doc, "expressionLib", str), + "the `itemSeparator` field is not valid because:", + SourceLine(_doc, "itemSeparator", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8085,42 +7513,142 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `expressionLib` field is not valid because:", - SourceLine(_doc, "expressionLib", str), + "the `itemSeparator` field is not valid because:", + SourceLine(_doc, "itemSeparator", str), [e], - detailed_message=f"the `expressionLib` field with value `{val}` " + detailed_message=f"the `itemSeparator` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: + valueFrom = None + if "valueFrom" in _doc: + try: + valueFrom = _load_field( + _doc.get("valueFrom"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("valueFrom") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `valueFrom`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `expressionLib`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - expressionLib=expressionLib, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) + else: + val = _doc.get("valueFrom") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), + [e], + detailed_message=f"the `valueFrom` field with value `{val}` " + "is not valid because:", + ) + ) + shellQuote = None + if "shellQuote" in _doc: + try: + shellQuote = _load_field( + _doc.get("shellQuote"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("shellQuote") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `shellQuote`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("shellQuote") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `shellQuote` field is not valid because:", + SourceLine(_doc, "shellQuote", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `shellQuote` field is not valid because:", + SourceLine(_doc, "shellQuote", str), + [e], + detailed_message=f"the `shellQuote` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `loadContents`, `position`, `prefix`, `separate`, `itemSeparator`, `valueFrom`, `shellQuote`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + loadContents=loadContents, + position=position, + prefix=prefix, + separate=separate, + itemSeparator=itemSeparator, + valueFrom=valueFrom, + shellQuote=shellQuote, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) return _constructed def save( @@ -8134,17 +7662,42 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.expressionLib is not None: - r["expressionLib"] = save( - self.expressionLib, + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.position is not None: + r["position"] = save( + self.position, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.prefix is not None: + r["prefix"] = save( + self.prefix, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.separate is not None: + r["separate"] = save( + self.separate, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.itemSeparator is not None: + r["itemSeparator"] = save( + self.itemSeparator, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.valueFrom is not None: + r["valueFrom"] = save( + self.valueFrom, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.shellQuote is not None: + r["shellQuote"] = save( + self.shellQuote, top=False, base_url=base_url, relative_uris=relative_uris, @@ -8160,7 +7713,13 @@ def save( def __init__( self, - expressionLib: None | Sequence[str] = None, + loadContents: None | bool = None, + position: None | i32 | str = None, + prefix: None | str = None, + separate: None | bool = None, + itemSeparator: None | str = None, + valueFrom: None | str = None, + shellQuote: None | bool = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8172,37 +7731,53 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InlineJavascriptRequirement" - self.expressionLib = expressionLib + self.loadContents = loadContents + self.position = position + self.prefix = prefix + self.separate = separate + self.itemSeparator = itemSeparator + self.valueFrom = valueFrom + self.shellQuote = shellQuote - attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "loadContents", + "position", + "prefix", + "separate", + "itemSeparator", + "valueFrom", + "shellQuote", + ] + ) @mypyc_attr(native_class=True) -class SchemaDefRequirement(Saveable): +class CommandOutputBinding(Saveable): """ - This field consists of an array of type definitions which must be used when - interpreting the `inputs` and `outputs` fields. When a `type` field - contains a IRI, the implementation must check if the type is defined in - `schemaDefs` and use that definition. If the type is not found in - `schemaDefs`, it is an error. The entries in `schemaDefs` must be - processed in the order listed such that later schema definitions may refer - to earlier schema definitions. - - - **Type definitions are allowed for `enum` and `record` types only.** - - Type definitions may be shared by defining them in a file and then - `$include`-ing them in the `types` field. - - A file can contain a list of type definitions + Describes how to generate an output parameter based on the files produced by a CommandLineTool. + + The output parameter value is generated by applying these operations in the following order: + + - glob + - loadContents + - outputEval + - secondaryFiles """ def __eq__(self, other: Any) -> bool: - if isinstance(other, SchemaDefRequirement): - return bool(self.class_ == other.class_ and self.types == other.types) + if isinstance(other, CommandOutputBinding): + return bool( + self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.glob == other.glob + and self.outputEval == other.outputEval + ) return False def __hash__(self) -> int: - return hash((self.class_, self.types)) + return hash((self.loadContents, self.loadListing, self.glob, self.outputEval)) @classmethod def fromDoc( @@ -8218,70 +7793,194 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_SchemaDefRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("types") is None: - raise ValidationException("missing required field `types`", None, []) - - types = load_field( - _doc.get("types"), - array_of_union_of_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("types") - ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `types`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("types") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( - "the `types` field is not valid because:", - SourceLine(_doc, "types", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `types` field is not valid because:", - SourceLine(_doc, "types", str), - [e], - detailed_message=f"the `types` field with value `{val}` " - "is not valid because:", + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) + loadListing = None + if "loadListing" in _doc: + try: + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, + baseuri, + loadingOptions, + lc=_doc.get("loadListing") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `loadListing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadListing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), + [e], + detailed_message=f"the `loadListing` field with value `{val}` " + "is not valid because:", + ) + ) + glob = None + if "glob" in _doc: + try: + glob = _load_field( + _doc.get("glob"), + union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("glob") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `glob`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("glob") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `glob` field is not valid because:", + SourceLine(_doc, "glob", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `glob` field is not valid because:", + SourceLine(_doc, "glob", str), + [e], + detailed_message=f"the `glob` field with value `{val}` " + "is not valid because:", + ) + ) + outputEval = None + if "outputEval" in _doc: + try: + outputEval = _load_field( + _doc.get("outputEval"), + union_of_None_type_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputEval") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputEval`": + _errors__.append( + ValidationException( + str(e), + None ) ) + else: + val = _doc.get("outputEval") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputEval` field is not valid because:", + SourceLine(_doc, "outputEval", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputEval` field is not valid because:", + SourceLine(_doc, "outputEval", str), + [e], + detailed_message=f"the `outputEval` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -8290,14 +7989,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `types`".format( + "invalid field `{}`, expected one of: `loadContents`, `loadListing`, `glob`, `outputEval`".format( k ), SourceLine(_doc, k, str), @@ -8307,7 +8006,10 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - types=types, + loadContents=loadContents, + loadListing=loadListing, + glob=glob, + outputEval=outputEval, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -8324,17 +8026,30 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.types is not None: - r["types"] = save( - self.types, top=False, base_url=base_url, relative_uris=relative_uris + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.glob is not None: + r["glob"] = save( + self.glob, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.outputEval is not None: + r["outputEval"] = save( + self.outputEval, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -8347,7 +8062,10 @@ def save( def __init__( self, - types: Sequence[CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema], + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + glob: None | Sequence[str] | str = None, + outputEval: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8359,71 +8077,185 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SchemaDefRequirement" - self.types = types + self.loadContents = loadContents + self.loadListing = loadListing + self.glob = glob + self.outputEval = outputEval - attrs: ClassVar[Collection[str]] = frozenset(["class", "types"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["loadContents", "loadListing", "glob", "outputEval"] + ) @mypyc_attr(native_class=True) -class SecondaryFileSchema(Saveable): - """ - Secondary files are specified using the following micro-DSL for secondary files: - - * If the value is a string, it is transformed to an object with two fields - `pattern` and `required` - * By default, the value of `required` is `null` - (this indicates default behavior, which may be based on the context) - * If the value ends with a question mark `?` the question mark is - stripped off and the value of the field `required` is set to `False` - * The remaining value is assigned to the field `pattern` - - For implementation details and examples, please see - [this section](SchemaSalad.html#Domain_Specific_Language_for_secondary_files) - in the Schema Salad specification. - - """ +class CommandInputRecordField(InputRecordField): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, SecondaryFileSchema): + if isinstance(other, CommandInputRecordField): return bool( - self.pattern == other.pattern and self.required == other.required + self.doc == other.doc + and self.name == other.name + and self.type_ == other.type_ + and self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.format == other.format + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash((self.pattern, self.required)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data + return hash( + ( + self.doc, + self.name, + self.type_, + self.label, + self.secondaryFiles, + self.streamable, + self.format, + self.loadContents, + self.loadListing, + self.inputBinding, + ) + ) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `name`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "" + _errors__.append(ValidationException("missing name")) + else: + baseuri = name + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("pattern") is None: - raise ValidationException("missing required field `pattern`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - pattern = load_field( - _doc.get("pattern"), - union_of_strtype_or_ExpressionLoader, + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, - lc=_doc.get("pattern") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `pattern`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -8431,13 +8263,13 @@ def fromDoc( ) ) else: - val = _doc.get("pattern") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `pattern` field is not valid because:", - SourceLine(_doc, "pattern", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8449,28 +8281,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `pattern` field is not valid because:", - SourceLine(_doc, "pattern", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `pattern` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) - required = None - if "required" in _doc: + label = None + if "label" in _doc: try: - required = load_field( - _doc.get("required"), - union_of_None_type_or_booltype_or_ExpressionLoader, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("required") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `required`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -8478,13 +8310,13 @@ def fromDoc( ) ) else: - val = _doc.get("required") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `required` field is not valid because:", - SourceLine(_doc, "required", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8496,146 +8328,205 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `required` field is not valid because:", - SourceLine(_doc, "required", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `required` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `secondaryFiles`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `pattern`, `required`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) + else: + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - pattern=pattern, - required=required, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.pattern is not None: - r["pattern"] = save( - self.pattern, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.required is not None: - r["required"] = save( - self.required, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - pattern: str, - required: None | bool | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.pattern = pattern - self.required = required - - attrs: ClassVar[Collection[str]] = frozenset(["pattern", "required"]) - - -@mypyc_attr(native_class=True) -class LoadListingRequirement(Saveable): - """ - Specify the desired behavior for loading the `listing` field of - a Directory object for use by expressions. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, LoadListingRequirement): - return bool( - self.class_ == other.class_ and self.loadListing == other.loadListing - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.loadListing)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) - class_ = load_field( - _doc.get("class"), - uri_LoadListingRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + if str(e) == "missing required field `loadContents`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) loadListing = None if "loadListing" in _doc: try: - loadListing = load_field( + loadListing = _load_field( _doc.get("loadListing"), union_of_None_type_or_LoadListingEnumLoader, baseuri, @@ -8679,6 +8570,53 @@ def fromDoc( "is not valid because:", ) ) + inputBinding = None + if "inputBinding" in _doc: + try: + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [e], + detailed_message=f"the `inputBinding` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -8687,14 +8625,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `loadListing`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `loadContents`, `loadListing`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -8704,10 +8642,20 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - loadListing=loadListing, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) + name=name, + doc=doc, + type_=type_, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + format=format, + loadContents=loadContents, + loadListing=loadListing, + inputBinding=inputBinding, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -8721,19 +8669,57 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.format is not None: + u = save_relative_uri(self.format, self.name, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) if self.loadListing is not None: r["loadListing"] = save( self.loadListing, top=False, - base_url=base_url, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.name, relative_uris=relative_uris, ) @@ -8747,7 +8733,16 @@ def save( def __init__( self, + name: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + doc: None | Sequence[str] | str = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, loadListing: LoadListingEnum | None = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -8759,30 +8754,60 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "LoadListingRequirement" + self.doc = doc + self.name = name + self.type_ = type_ + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.loadContents = loadContents self.loadListing = loadListing + self.inputBinding = inputBinding - attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "doc", + "name", + "type", + "label", + "secondaryFiles", + "streamable", + "format", + "loadContents", + "loadListing", + "inputBinding", + ] + ) @mypyc_attr(native_class=True) -class EnvironmentDef(Saveable): - """ - Define an environment variable that will be set in the runtime environment - by the workflow platform when executing the command line tool. May be the - result of executing an expression, such as getting a parameter from input. - - """ +class CommandInputRecordSchema(InputRecordSchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, EnvironmentDef): + if isinstance(other, CommandInputRecordSchema): return bool( - self.envName == other.envName and self.envValue == other.envValue + self.fields == other.fields + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.name == other.name + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash((self.envName, self.envValue)) + return hash( + ( + self.fields, + self.type_, + self.label, + self.doc, + self.name, + self.inputBinding, + ) + ) @classmethod def fromDoc( @@ -8798,22 +8823,124 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + name = None + if "name" in _doc: + try: + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("name") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `name`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("name") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), + [e], + detailed_message=f"the `name` field with value `{val}` " + "is not valid because:", + ) + ) + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + fields = None + if "fields" in _doc: + try: + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader, + baseuri, + loadingOptions, + lc=_doc.get("fields") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `fields`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("fields") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [e], + detailed_message=f"the `fields` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("envName") is None: - raise ValidationException("missing required field `envName`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - envName = load_field( - _doc.get("envName"), - strtype, + type_ = _load_field( + _doc.get("type"), + typedsl_Record_nameLoader_2, baseuri, loadingOptions, - lc=_doc.get("envName") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `envName`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -8821,13 +8948,13 @@ def fromDoc( ) ) else: - val = _doc.get("envName") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `envName` field is not valid because:", - SourceLine(_doc, "envName", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -8839,238 +8966,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `envName` field is not valid because:", - SourceLine(_doc, "envName", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `envName` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("envValue") is None: - raise ValidationException("missing required field `envValue`", None, []) - - envValue = load_field( - _doc.get("envValue"), - union_of_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("envValue") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `envValue`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("envValue") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `envValue` field is not valid because:", - SourceLine(_doc, "envValue", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `envValue` field is not valid because:", - SourceLine(_doc, "envValue", str), - [e], - detailed_message=f"the `envValue` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `envName`, `envValue`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - envName=envName, - envValue=envValue, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.envName is not None: - r["envName"] = save( - self.envName, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.envValue is not None: - r["envValue"] = save( - self.envValue, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - envName: str, - envValue: str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.envName = envName - self.envValue = envValue - - attrs: ClassVar[Collection[str]] = frozenset(["envName", "envValue"]) - - -@mypyc_attr(native_class=True) -class CommandLineBinding(InputBinding): - """ - - When listed under `inputBinding` in the input schema, the term - "value" refers to the corresponding value in the input object. For - binding objects listed in `CommandLineTool.arguments`, the term "value" - refers to the effective value after evaluating `valueFrom`. - - The binding behavior when building the command line depends on the data - type of the value. If there is a mismatch between the type described by - the input schema and the effective value, such as resulting from an - expression evaluation, an implementation must use the data type of the - effective value. - - - **string**: Add `prefix` and the string to the command line. - - - **number**: Add `prefix` and decimal representation to command line. - - - **boolean**: If true, add `prefix` to the command line. If false, add - nothing. - - - **File**: Add `prefix` and the value of - [`File.path`](#File) to the command line. - - - **Directory**: Add `prefix` and the value of - [`Directory.path`](#Directory) to the command line. - - - **array**: If `itemSeparator` is specified, add `prefix` and the join - the array into a single string with `itemSeparator` separating the - items. Otherwise, first add `prefix`, then recursively process - individual elements. - If the array is empty, it does not add anything to command line. - - - **object**: Add `prefix` only, and recursively add object fields for - which `inputBinding` is specified. - - - **null**: Add nothing. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandLineBinding): - return bool( - self.loadContents == other.loadContents - and self.position == other.position - and self.prefix == other.prefix - and self.separate == other.separate - and self.itemSeparator == other.itemSeparator - and self.valueFrom == other.valueFrom - and self.shellQuote == other.shellQuote - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.loadContents, - self.position, - self.prefix, - self.separate, - self.itemSeparator, - self.valueFrom, - self.shellQuote, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - loadContents = None - if "loadContents" in _doc: + label = None + if "label" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -9078,13 +8995,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9096,28 +9013,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - position = None - if "position" in _doc: + doc = None + if "doc" in _doc: try: - position = load_field( - _doc.get("position"), - union_of_None_type_or_inttype_or_ExpressionLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("position") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `position`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -9125,13 +9042,13 @@ def fromDoc( ) ) else: - val = _doc.get("position") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `position` field is not valid because:", - SourceLine(_doc, "position", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9143,28 +9060,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `position` field is not valid because:", - SourceLine(_doc, "position", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `position` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - prefix = None - if "prefix" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - prefix = load_field( - _doc.get("prefix"), - union_of_None_type_or_strtype, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("prefix") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `prefix`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -9172,13 +9089,13 @@ def fromDoc( ) ) else: - val = _doc.get("prefix") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `prefix` field is not valid because:", - SourceLine(_doc, "prefix", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9190,198 +9107,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `prefix` field is not valid because:", - SourceLine(_doc, "prefix", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `prefix` field with value `{val}` " - "is not valid because:", - ) - ) - separate = None - if "separate" in _doc: - try: - separate = load_field( - _doc.get("separate"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("separate") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `separate`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("separate") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `separate` field is not valid because:", - SourceLine(_doc, "separate", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `separate` field is not valid because:", - SourceLine(_doc, "separate", str), - [e], - detailed_message=f"the `separate` field with value `{val}` " - "is not valid because:", - ) - ) - itemSeparator = None - if "itemSeparator" in _doc: - try: - itemSeparator = load_field( - _doc.get("itemSeparator"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("itemSeparator") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `itemSeparator`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("itemSeparator") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `itemSeparator` field is not valid because:", - SourceLine(_doc, "itemSeparator", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `itemSeparator` field is not valid because:", - SourceLine(_doc, "itemSeparator", str), - [e], - detailed_message=f"the `itemSeparator` field with value `{val}` " - "is not valid because:", - ) - ) - valueFrom = None - if "valueFrom" in _doc: - try: - valueFrom = load_field( - _doc.get("valueFrom"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("valueFrom") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `valueFrom`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("valueFrom") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), - [e], - detailed_message=f"the `valueFrom` field with value `{val}` " - "is not valid because:", - ) - ) - shellQuote = None - if "shellQuote" in _doc: - try: - shellQuote = load_field( - _doc.get("shellQuote"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("shellQuote") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `shellQuote`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("shellQuote") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `shellQuote` field is not valid because:", - SourceLine(_doc, "shellQuote", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `shellQuote` field is not valid because:", - SourceLine(_doc, "shellQuote", str), - [e], - detailed_message=f"the `shellQuote` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -9393,14 +9122,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `loadContents`, `position`, `prefix`, `separate`, `itemSeparator`, `valueFrom`, `shellQuote`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -9410,16 +9139,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - loadContents=loadContents, - position=position, - prefix=prefix, - separate=separate, - itemSeparator=itemSeparator, - valueFrom=valueFrom, - shellQuote=shellQuote, + name=name, + fields=fields, + type_=type_, + label=label, + doc=doc, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -9433,44 +9162,30 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - if self.position is not None: - r["position"] = save( - self.position, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.prefix is not None: - r["prefix"] = save( - self.prefix, top=False, base_url=base_url, relative_uris=relative_uris + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.separate is not None: - r["separate"] = save( - self.separate, top=False, base_url=base_url, relative_uris=relative_uris + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.itemSeparator is not None: - r["itemSeparator"] = save( - self.itemSeparator, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.valueFrom is not None: - r["valueFrom"] = save( - self.valueFrom, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.shellQuote is not None: - r["shellQuote"] = save( - self.shellQuote, + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, top=False, - base_url=base_url, + base_url=self.name, relative_uris=relative_uris, ) @@ -9484,15 +9199,14 @@ def save( def __init__( self, - loadContents: None | bool = None, - position: None | i32 | str = None, - prefix: None | str = None, - separate: None | bool = None, - itemSeparator: None | str = None, - valueFrom: None | str = None, - shellQuote: None | bool = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, + type_: Record_name, + fields: None | Sequence[CommandInputRecordField] = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, + inputBinding: CommandLineBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, ) -> None: if extension_fields: self.extension_fields = extension_fields @@ -9502,55 +9216,45 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.position = position - self.prefix = prefix - self.separate = separate - self.itemSeparator = itemSeparator - self.valueFrom = valueFrom - self.shellQuote = shellQuote + self.fields = fields + self.type_ = type_ + self.label = label + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - [ - "loadContents", - "position", - "prefix", - "separate", - "itemSeparator", - "valueFrom", - "shellQuote", - ] + ["fields", "type", "label", "doc", "name", "inputBinding"] ) @mypyc_attr(native_class=True) -class CommandOutputBinding(Saveable): - """ - Describes how to generate an output parameter based on the files produced - by a CommandLineTool. - - The output parameter value is generated by applying these operations in the - following order: - - - glob - - loadContents - - outputEval - - secondaryFiles - - """ +class CommandInputEnumSchema(InputEnumSchema): + name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputBinding): + if isinstance(other, CommandInputEnumSchema): return bool( - self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.glob == other.glob - and self.outputEval == other.outputEval + self.name == other.name + and self.symbols == other.symbols + and self.type_ == other.type_ + and self.label == other.label + and self.doc == other.doc + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash((self.loadContents, self.loadListing, self.glob, self.outputEval)) + return hash( + ( + self.name, + self.symbols, + self.type_, + self.label, + self.doc, + self.inputBinding, + ) + ) @classmethod def fromDoc( @@ -9566,21 +9270,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - loadContents = None - if "loadContents" in _doc: + name = None + if "name" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + name = _load_field( + _doc.get("name"), + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("name") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `name`": _errors__.append( ValidationException( str(e), @@ -9588,13 +9292,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("name") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9606,28 +9310,132 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `name` field is not valid because:", + SourceLine(_doc, "name", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `name` field with value `{val}` " "is not valid because:", ) ) - loadListing = None - if "loadListing" in _doc: + + if name is None: + if docRoot is not None: + name = docRoot + else: + name = "_:" + str(_uuid__.uuid4()) + else: + baseuri = name + try: + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) + + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("symbols") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `symbols`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("symbols") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), + [e], + detailed_message=f"the `symbols` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_Enum_nameLoader_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + label = None + if "label" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("loadListing") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -9635,13 +9443,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadListing") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9653,28 +9461,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `loadListing` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - glob = None - if "glob" in _doc: + doc = None + if "doc" in _doc: try: - glob = load_field( - _doc.get("glob"), - union_of_None_type_or_strtype_or_ExpressionLoader_or_array_of_strtype, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("glob") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `glob`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -9682,13 +9490,13 @@ def fromDoc( ) ) else: - val = _doc.get("glob") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `glob` field is not valid because:", - SourceLine(_doc, "glob", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9700,28 +9508,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `glob` field is not valid because:", - SourceLine(_doc, "glob", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `glob` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - outputEval = None - if "outputEval" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - outputEval = load_field( - _doc.get("outputEval"), - union_of_None_type_or_ExpressionLoader, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("outputEval") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputEval`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -9729,13 +9537,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputEval") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputEval` field is not valid because:", - SourceLine(_doc, "outputEval", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -9747,10 +9555,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputEval` field is not valid because:", - SourceLine(_doc, "outputEval", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `outputEval` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -9762,14 +9570,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `loadContents`, `loadListing`, `glob`, `outputEval`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -9779,13 +9587,16 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - loadContents=loadContents, - loadListing=loadListing, - glob=glob, - outputEval=outputEval, + name=name, + symbols=symbols, + type_=type_, + label=label, + doc=doc, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[name] = (_constructed, loadingOptions) return _constructed def save( @@ -9799,29 +9610,29 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.name is not None: + u = save_relative_uri(self.name, self.name, True, None, relative_uris) + r["name"] = u + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.glob is not None: - r["glob"] = save( - self.glob, top=False, base_url=base_url, relative_uris=relative_uris + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.outputEval is not None: - r["outputEval"] = save( - self.outputEval, + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, top=False, - base_url=base_url, + base_url=self.name, relative_uris=relative_uris, ) @@ -9835,10 +9646,12 @@ def save( def __init__( self, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - glob: None | Sequence[str] | str = None, - outputEval: None | str = None, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -9850,50 +9663,37 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.loadContents = loadContents - self.loadListing = loadListing - self.glob = glob - self.outputEval = outputEval + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols + self.type_ = type_ + self.label = label + self.doc = doc + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["loadContents", "loadListing", "glob", "outputEval"] + ["name", "symbols", "type", "label", "doc", "inputBinding"] ) @mypyc_attr(native_class=True) -class CommandInputRecordField(InputRecordField): +class CommandInputArraySchema(InputArraySchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputRecordField): + if isinstance(other, CommandInputArraySchema): return bool( - self.doc == other.doc - and self.name == other.name + self.items == other.items and self.type_ == other.type_ and self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.format == other.format - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing + and self.doc == other.doc + and self.name == other.name and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: return hash( - ( - self.doc, - self.name, - self.type_, - self.label, - self.secondaryFiles, - self.streamable, - self.format, - self.loadContents, - self.loadListing, - self.inputBinding, - ) + (self.items, self.type_, self.label, self.doc, self.name, self.inputBinding) ) @classmethod @@ -9913,9 +9713,9 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), - uri_strtype_True_False_None_None, + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("name") @@ -9962,64 +9762,64 @@ def fromDoc( if docRoot is not None: name = docRoot else: - name = "" - _errors__.append(ValidationException("missing name")) + name = "_:" + str(_uuid__.uuid4()) else: baseuri = name - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) - if str(e) == "missing required field `doc`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", ) + ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, + typedsl_Array_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -10064,7 +9864,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -10108,21 +9908,21 @@ def fromDoc( "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + doc = None + if "doc" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -10130,13 +9930,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10148,28 +9948,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("streamable") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `streamable`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -10177,13 +9977,13 @@ def fromDoc( ) ) else: - val = _doc.get("streamable") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10195,217 +9995,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `streamable` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadContents`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadContents") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [e], - detailed_message=f"the `loadContents` field with value `{val}` " - "is not valid because:", - ) - ) - loadListing = None - if "loadListing" in _doc: - try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, - baseuri, - loadingOptions, - lc=_doc.get("loadListing") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadListing`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadListing") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [e], - detailed_message=f"the `loadListing` field with value `{val}` " - "is not valid because:", - ) - ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `loadContents`, `loadListing`, `inputBinding`".format( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -10416,14 +10028,10 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - doc=doc, + items=items, type_=type_, label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - format=format, - loadContents=loadContents, - loadListing=loadListing, + doc=doc, inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, @@ -10445,10 +10053,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.items is not None: + u = save_relative_uri(self.items, self.name, False, 2, relative_uris) + r["items"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris @@ -10457,36 +10064,9 @@ def save( r["label"] = save( self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.format is not None: - u = save_relative_uri(self.format, self.name, True, None, relative_uris) - r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) if self.inputBinding is not None: r["inputBinding"] = save( @@ -10506,15 +10086,11 @@ def save( def __init__( self, - name: str, - type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, + items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, @@ -10527,58 +10103,47 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - [ - "doc", - "name", - "type", - "label", - "secondaryFiles", - "streamable", - "format", - "loadContents", - "loadListing", - "inputBinding", - ] + ["items", "type", "label", "doc", "name", "inputBinding"] ) @mypyc_attr(native_class=True) -class CommandInputRecordSchema(InputRecordSchema): +class CommandOutputRecordField(OutputRecordField): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputRecordSchema): + if isinstance(other, CommandOutputRecordField): return bool( - self.fields == other.fields + self.doc == other.doc + and self.name == other.name and self.type_ == other.type_ and self.label == other.label - and self.doc == other.doc - and self.name == other.name - and self.inputBinding == other.inputBinding + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.format == other.format + and self.outputBinding == other.outputBinding ) return False def __hash__(self) -> int: return hash( ( - self.fields, - self.type_, - self.label, self.doc, self.name, - self.inputBinding, + self.type_, + self.label, + self.secondaryFiles, + self.streamable, + self.format, + self.outputBinding, ) ) @@ -10599,9 +10164,9 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + uri_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("name") @@ -10648,24 +10213,25 @@ def fromDoc( if docRoot is not None: name = docRoot else: - name = "_:" + str(_uuid__.uuid4()) + name = "" + _errors__.append(ValidationException("missing name")) else: baseuri = name - fields = None - if "fields" in _doc: + doc = None + if "doc" in _doc: try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CommandInputRecordFieldLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("fields") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `fields`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -10673,13 +10239,13 @@ def fromDoc( ) ) else: - val = _doc.get("fields") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10691,10 +10257,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `fields` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) @@ -10702,9 +10268,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Record_nameLoader_2, + typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -10749,7 +10315,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -10793,21 +10359,21 @@ def fromDoc( "is not valid because:", ) ) - doc = None - if "doc" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -10815,13 +10381,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10833,28 +10399,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: + streamable = None + if "streamable" in _doc: try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("inputBinding") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputBinding`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -10862,13 +10428,13 @@ def fromDoc( ) ) else: - val = _doc.get("inputBinding") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -10880,10 +10446,104 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `inputBinding` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + outputBinding = None + if "outputBinding" in _doc: + try: + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), + [e], + detailed_message=f"the `outputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -10895,14 +10555,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`, `inputBinding`".format( + "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `outputBinding`".format( k ), SourceLine(_doc, k, str), @@ -10913,11 +10573,13 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - fields=fields, + doc=doc, type_=type_, label=label, - doc=doc, - inputBinding=inputBinding, + secondaryFiles=secondaryFiles, + streamable=streamable, + format=format, + outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -10938,9 +10600,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) if self.type_ is not None: r["type"] = save( @@ -10950,13 +10612,26 @@ def save( r["label"] = save( self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.name, + relative_uris=relative_uris, ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.name, + relative_uris=relative_uris, + ) + if self.format is not None: + u = save_relative_uri(self.format, self.name, True, None, relative_uris) + r["format"] = u + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, top=False, base_url=self.name, relative_uris=relative_uris, @@ -10972,12 +10647,14 @@ def save( def __init__( self, - type_: Record_name, - fields: None | Sequence[CommandInputRecordField] = None, - label: None | str = None, + name: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, doc: None | Sequence[str] | str = None, - name: None | str = None, - inputBinding: CommandLineBinding | None = None, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -10989,45 +10666,46 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.fields = fields + self.doc = doc + self.name = name self.type_ = type_ self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding - + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.format = format + self.outputBinding = outputBinding + attrs: ClassVar[Collection[str]] = frozenset( - ["fields", "type", "label", "doc", "name", "inputBinding"] + [ + "doc", + "name", + "type", + "label", + "secondaryFiles", + "streamable", + "format", + "outputBinding", + ] ) @mypyc_attr(native_class=True) -class CommandInputEnumSchema(InputEnumSchema): +class CommandOutputRecordSchema(OutputRecordSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputEnumSchema): + if isinstance(other, CommandOutputRecordSchema): return bool( - self.name == other.name - and self.symbols == other.symbols + self.fields == other.fields and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc - and self.inputBinding == other.inputBinding + and self.name == other.name ) return False def __hash__(self) -> int: - return hash( - ( - self.name, - self.symbols, - self.type_, - self.label, - self.doc, - self.inputBinding, - ) - ) + return hash((self.fields, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -11046,7 +10724,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -11098,61 +10776,60 @@ def fromDoc( name = "_:" + str(_uuid__.uuid4()) else: baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) + fields = None + if "fields" in _doc: + try: + fields = _load_field( + _doc.get("fields"), + idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, + baseuri, + loadingOptions, + lc=_doc.get("fields") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `fields`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", + val = _doc.get("fields") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `fields` field is not valid because:", + SourceLine(_doc, "fields", str), + [e], + detailed_message=f"the `fields` field with value `{val}` " + "is not valid because:", + ) ) - ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Enum_nameLoader_2, + typedsl_Record_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -11197,7 +10874,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -11244,7 +10921,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -11288,53 +10965,6 @@ def fromDoc( "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -11343,14 +10973,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`, `inputBinding`".format( + "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( k ), SourceLine(_doc, k, str), @@ -11361,11 +10991,10 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - symbols=symbols, + fields=fields, type_=type_, label=label, doc=doc, - inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -11386,9 +11015,10 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u + if self.fields is not None: + r["fields"] = save( + self.fields, top=False, base_url=self.name, relative_uris=relative_uris + ) if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris @@ -11401,13 +11031,6 @@ def save( r["doc"] = save( self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -11419,12 +11042,11 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, + type_: Record_name, + fields: None | Sequence[CommandOutputRecordField] = None, label: None | str = None, doc: None | Sequence[str] | str = None, - inputBinding: CommandLineBinding | None = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -11436,38 +11058,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols + self.fields = fields self.type_ = type_ self.label = label self.doc = doc - self.inputBinding = inputBinding + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "doc", "inputBinding"] + ["fields", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class CommandInputArraySchema(InputArraySchema): +class CommandOutputEnumSchema(OutputEnumSchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputArraySchema): + if isinstance(other, CommandOutputEnumSchema): return bool( - self.items == other.items + self.name == other.name + and self.symbols == other.symbols and self.type_ == other.type_ and self.label == other.label and self.doc == other.doc - and self.name == other.name - and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash( - (self.items, self.type_, self.label, self.doc, self.name, self.inputBinding) - ) + return hash((self.name, self.symbols, self.type_, self.label, self.doc)) @classmethod def fromDoc( @@ -11486,7 +11104,7 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -11539,21 +11157,21 @@ def fromDoc( else: baseuri = name try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) + if _doc.get("symbols") is None: + raise ValidationException("missing required field `symbols`", None, []) - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_False_True_2_None, + symbols = _load_field( + _doc.get("symbols"), + uri_array_of_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("items") + lc=_doc.get("symbols") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `items`": + if str(e) == "missing required field `symbols`": _errors__.append( ValidationException( str(e), @@ -11561,13 +11179,13 @@ def fromDoc( ) ) else: - val = _doc.get("items") + val = _doc.get("symbols") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -11579,10 +11197,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), + "the `symbols` field is not valid because:", + SourceLine(_doc, "symbols", str), [e], - detailed_message=f"the `items` field with value `{val}` " + detailed_message=f"the `symbols` field with value `{val}` " "is not valid because:", ) ) @@ -11590,9 +11208,9 @@ def fromDoc( if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Array_nameLoader_2, + typedsl_Enum_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -11637,7 +11255,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -11684,7 +11302,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -11728,69 +11346,22 @@ def fromDoc( "is not valid because:", ) ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") + ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`, `inputBinding`".format( + "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( k ), SourceLine(_doc, k, str), @@ -11801,11 +11372,10 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - items=items, + symbols=symbols, type_=type_, label=label, doc=doc, - inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -11826,9 +11396,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.items is not None: - u = save_relative_uri(self.items, self.name, False, 2, relative_uris) - r["items"] = u + if self.symbols is not None: + u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) + r["symbols"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris @@ -11841,13 +11411,6 @@ def save( r["doc"] = save( self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -11859,12 +11422,11 @@ def save( def __init__( self, - items: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | str, - type_: Array_name, + symbols: Sequence[str], + type_: Enum_name, + name: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, - name: None | str = None, - inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -11876,49 +11438,34 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.symbols = symbols self.type_ = type_ self.label = label self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "doc", "name", "inputBinding"] + ["name", "symbols", "type", "label", "doc"] ) @mypyc_attr(native_class=True) -class CommandOutputRecordField(OutputRecordField): +class CommandOutputArraySchema(OutputArraySchema): name: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputRecordField): + if isinstance(other, CommandOutputArraySchema): return bool( - self.doc == other.doc - and self.name == other.name + self.items == other.items and self.type_ == other.type_ and self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.format == other.format - and self.outputBinding == other.outputBinding + and self.doc == other.doc + and self.name == other.name ) return False def __hash__(self) -> int: - return hash( - ( - self.doc, - self.name, - self.type_, - self.label, - self.secondaryFiles, - self.streamable, - self.format, - self.outputBinding, - ) - ) + return hash((self.items, self.type_, self.label, self.doc, self.name)) @classmethod def fromDoc( @@ -11937,9 +11484,9 @@ def fromDoc( name = None if "name" in _doc: try: - name = load_field( + name = _load_field( _doc.get("name"), - uri_strtype_True_False_None_None, + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("name") @@ -11986,64 +11533,64 @@ def fromDoc( if docRoot is not None: name = docRoot else: - name = "" - _errors__.append(ValidationException("missing name")) + name = "_:" + str(_uuid__.uuid4()) else: baseuri = name - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) + try: + if _doc.get("items") is None: + raise ValidationException("missing required field `items`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + items = _load_field( + _doc.get("items"), + uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None, + baseuri, + loadingOptions, + lc=_doc.get("items") + ) - if str(e) == "missing required field `doc`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `items`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("items") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "the `items` field is not valid because:", + SourceLine(_doc, "items", str), + [e], + detailed_message=f"the `items` field with value `{val}` " + "is not valid because:", ) + ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, + typedsl_Array_nameLoader_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -12088,7 +11635,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -12132,21 +11679,21 @@ def fromDoc( "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + doc = None + if "doc" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -12154,13 +11701,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12172,173 +11719,32 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: - try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), - [e], - detailed_message=f"the `outputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `doc`, `name`, `type`, `label`, `secondaryFiles`, `streamable`, `format`, `outputBinding`".format( - k - ), - SourceLine(_doc, k, str), + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( + k + ), + SourceLine(_doc, k, str), ) ) @@ -12346,13 +11752,10 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( name=name, - doc=doc, + items=items, type_=type_, label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - format=format, - outputBinding=outputBinding, + doc=doc, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -12373,10 +11776,9 @@ def save( if self.name is not None: u = save_relative_uri(self.name, self.name, True, None, relative_uris) r["name"] = u - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.items is not None: + u = save_relative_uri(self.items, self.name, False, 2, relative_uris) + r["items"] = u if self.type_ is not None: r["type"] = save( self.type_, top=False, base_url=self.name, relative_uris=relative_uris @@ -12385,29 +11787,9 @@ def save( r["label"] = save( self.label, top=False, base_url=self.name, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.name, - relative_uris=relative_uris, - ) - if self.format is not None: - u = save_relative_uri(self.format, self.name, True, None, relative_uris) - r["format"] = u - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, - top=False, - base_url=self.name, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.name, relative_uris=relative_uris ) # top refers to the directory level @@ -12420,14 +11802,11 @@ def save( def __init__( self, - name: str, - type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, - doc: None | Sequence[str] | str = None, + items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, + type_: Array_name, label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - format: None | str = None, - outputBinding: CommandOutputBinding | None = None, + doc: None | Sequence[str] | str = None, + name: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -12439,46 +11818,59 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.doc = doc - self.name = name + self.items = items self.type_ = type_ self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.format = format - self.outputBinding = outputBinding + self.doc = doc + self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) attrs: ClassVar[Collection[str]] = frozenset( - [ - "doc", - "name", - "type", - "label", - "secondaryFiles", - "streamable", - "format", - "outputBinding", - ] + ["items", "type", "label", "doc", "name"] ) @mypyc_attr(native_class=True) -class CommandOutputRecordSchema(OutputRecordSchema): - name: str +class CommandInputParameter(Saveable): + """ + An input parameter for a CommandLineTool. + + """ + + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputRecordSchema): + if isinstance(other, CommandInputParameter): return bool( - self.fields == other.fields - and self.type_ == other.type_ - and self.label == other.label + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable and self.doc == other.doc - and self.name == other.name + and self.id == other.id + and self.format == other.format + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.default == other.default + and self.type_ == other.type_ + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: - return hash((self.fields, self.type_, self.label, self.doc, self.name)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.loadContents, + self.loadListing, + self.default, + self.type_, + self.inputBinding, + ) + ) @classmethod def fromDoc( @@ -12494,21 +11886,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + id = None + if "id" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -12516,13 +11908,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12534,36 +11926,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - if name is None: + if id is None: if docRoot is not None: - name = docRoot + id = docRoot else: - name = "_:" + str(_uuid__.uuid4()) + id = "" + _errors__.append(ValidationException("missing id")) else: - baseuri = name - fields = None - if "fields" in _doc: + baseuri = id + label = None + if "label" in _doc: try: - fields = load_field( - _doc.get("fields"), - idmap_fields_union_of_None_type_or_array_of_CommandOutputRecordFieldLoader, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("fields") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `fields`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -12571,13 +11964,13 @@ def fromDoc( ) ) else: - val = _doc.get("fields") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12589,76 +11982,75 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `fields` field is not valid because:", - SourceLine(_doc, "fields", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `fields` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Record_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - label = None - if "label" in _doc: + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -12666,13 +12058,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12684,17 +12076,17 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -12738,157 +12130,115 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `fields`, `type`, `label`, `doc`, `name`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) + else: + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) + ) + loadListing = None + if "loadListing" in _doc: + try: + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, + baseuri, + loadingOptions, + lc=_doc.get("loadListing") + ) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - name=name, - fields=fields, - type_=type_, - label=label, - doc=doc, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[name] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.fields is not None: - r["fields"] = save( - self.fields, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - type_: Record_name, - fields: None | Sequence[CommandOutputRecordField] = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - name: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.fields = fields - self.type_ = type_ - self.label = label - self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - - attrs: ClassVar[Collection[str]] = frozenset( - ["fields", "type", "label", "doc", "name"] - ) - - -@mypyc_attr(native_class=True) -class CommandOutputEnumSchema(OutputEnumSchema): - name: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputEnumSchema): - return bool( - self.name == other.name - and self.symbols == other.symbols - and self.type_ == other.type_ - and self.label == other.label - and self.doc == other.doc - ) - return False - - def __hash__(self) -> int: - return hash((self.name, self.symbols, self.type_, self.label, self.doc)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - name = None - if "name" in _doc: - try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("name") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `name`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -12896,13 +12246,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -12914,76 +12264,67 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " "is not valid because:", ) ) + default = None + if "default" in _doc: + try: + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, + baseuri, + loadingOptions, + lc=_doc.get("default") + ) - if name is None: - if docRoot is not None: - name = docRoot - else: - name = "_:" + str(_uuid__.uuid4()) - else: - baseuri = name - try: - if _doc.get("symbols") is None: - raise ValidationException("missing required field `symbols`", None, []) - - symbols = load_field( - _doc.get("symbols"), - uri_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("symbols") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `symbols`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("symbols") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `default`": _errors__.append( ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `symbols` field is not valid because:", - SourceLine(_doc, "symbols", str), - [e], - detailed_message=f"the `symbols` field with value `{val}` " - "is not valid because:", + val = _doc.get("default") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [e], + detailed_message=f"the `default` field with value `{val}` " + "is not valid because:", + ) ) - ) try: if _doc.get("type") is None: raise ValidationException("missing required field `type`", None, []) - type_ = load_field( + type_ = _load_field( _doc.get("type"), - typedsl_Enum_nameLoader_2, + typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, lc=_doc.get("type") @@ -13025,21 +12366,21 @@ def fromDoc( "is not valid because:", ) ) - label = None - if "label" in _doc: + inputBinding = None + if "inputBinding" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("inputBinding") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `inputBinding`": _errors__.append( ValidationException( str(e), @@ -13047,13 +12388,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("inputBinding") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13065,76 +12406,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `name`, `symbols`, `type`, `label`, `doc`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -13144,15 +12438,21 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - symbols=symbols, - type_=type_, + id=id, label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, doc=doc, + format=format, + loadContents=loadContents, + loadListing=loadListing, + default=default, + type_=type_, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -13166,23 +12466,62 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.symbols is not None: - u = save_relative_uri(self.symbols, self.name, True, None, relative_uris) - r["symbols"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u if self.label is not None: r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) if self.doc is not None: r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) # top refers to the directory level @@ -13195,11 +12534,17 @@ def save( def __init__( self, - symbols: Sequence[str], - type_: Enum_name, - name: None | str = None, + id: str, + type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | stdin | str, label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + inputBinding: CommandLineBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -13211,34 +12556,71 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) - self.symbols = symbols - self.type_ = type_ self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["name", "symbols", "type", "label", "doc"] + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "loadContents", + "loadListing", + "default", + "type", + "inputBinding", + ] ) @mypyc_attr(native_class=True) -class CommandOutputArraySchema(OutputArraySchema): - name: str +class CommandOutputParameter(Saveable): + """ + An output parameter for a CommandLineTool. + + """ + + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputArraySchema): + if isinstance(other, CommandOutputParameter): return bool( - self.items == other.items - and self.type_ == other.type_ - and self.label == other.label + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable and self.doc == other.doc - and self.name == other.name + and self.id == other.id + and self.format == other.format + and self.type_ == other.type_ + and self.outputBinding == other.outputBinding ) return False def __hash__(self) -> int: - return hash((self.items, self.type_, self.label, self.doc, self.name)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.type_, + self.outputBinding, + ) + ) @classmethod def fromDoc( @@ -13254,21 +12636,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - name = None - if "name" in _doc: + id = None + if "id" in _doc: try: - name = load_field( - _doc.get("name"), - uri_union_of_None_type_or_strtype_True_False_None_None, + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("name") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `name`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -13276,13 +12658,13 @@ def fromDoc( ) ) else: - val = _doc.get("name") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13294,132 +12676,131 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `name` field is not valid because:", - SourceLine(_doc, "name", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `name` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - if name is None: + if id is None: if docRoot is not None: - name = docRoot + id = docRoot else: - name = "_:" + str(_uuid__.uuid4()) + id = "" + _errors__.append(ValidationException("missing id")) else: - baseuri = name - try: - if _doc.get("items") is None: - raise ValidationException("missing required field `items`", None, []) - - items = load_field( - _doc.get("items"), - uri_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_False_True_2_None, - baseuri, - loadingOptions, - lc=_doc.get("items") - ) + baseuri = id + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `items`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("items") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) ) else: - _errors__.append( - ValidationException( - "the `items` field is not valid because:", - SourceLine(_doc, "items", str), - [e], - detailed_message=f"the `items` field with value `{val}` " - "is not valid because:", + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_Array_nameLoader_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - label = None - if "label" in _doc: + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -13427,13 +12808,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13445,17 +12826,17 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -13499,40 +12880,185 @@ def fromDoc( "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": _errors__.append( - ValidationException("mapping with implicit null key") + ValidationException( + str(e), + None + ) ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `items`, `type`, `label`, `doc`, `name`".format( - k - ), - SourceLine(_doc, k, str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + outputBinding = None + if "outputBinding" in _doc: + try: + outputBinding = _load_field( + _doc.get("outputBinding"), + union_of_None_type_or_CommandOutputBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputBinding` field is not valid because:", + SourceLine(_doc, "outputBinding", str), + [e], + detailed_message=f"the `outputBinding` field with value `{val}` " + "is not valid because:", + ) + ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`, `outputBinding`".format( + k + ), + SourceLine(_doc, k, str), ) ) if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - name=name, - items=items, - type_=type_, + id=id, label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, doc=doc, + format=format, + type_=type_, + outputBinding=outputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[name] = (_constructed, loadingOptions) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -13546,23 +13072,44 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.name is not None: - u = save_relative_uri(self.name, self.name, True, None, relative_uris) - r["name"] = u - if self.items is not None: - u = save_relative_uri(self.items, self.name, False, 2, relative_uris) - r["items"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.name, relative_uris=relative_uris - ) + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u if self.label is not None: r["label"] = save( - self.label, top=False, base_url=self.name, relative_uris=relative_uris + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) if self.doc is not None: r["doc"] = save( - self.doc, top=False, base_url=self.name, relative_uris=relative_uris + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputBinding is not None: + r["outputBinding"] = save( + self.outputBinding, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) # top refers to the directory level @@ -13575,11 +13122,14 @@ def save( def __init__( self, - items: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | str, - type_: Array_name, + id: str, + type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str, label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, doc: None | Sequence[str] | str = None, - name: None | str = None, + format: None | str = None, + outputBinding: CommandOutputBinding | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -13591,56 +13141,83 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.items = items - self.type_ = type_ self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable self.doc = doc - self.name = name if name is not None else "_:" + str(_uuid__.uuid4()) + self.id = id + self.format = format + self.type_ = type_ + self.outputBinding = outputBinding attrs: ClassVar[Collection[str]] = frozenset( - ["items", "type", "label", "doc", "name"] + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "type", + "outputBinding", + ] ) @mypyc_attr(native_class=True) -class CommandInputParameter(Saveable): +class CommandLineTool(Saveable): """ - An input parameter for a CommandLineTool. + This defines the schema of the CWL Command Line Tool Description document. + """ id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandInputParameter): + if isinstance(other, CommandLineTool): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable + self.id == other.id + and self.label == other.label and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.default == other.default - and self.type_ == other.type_ - and self.inputBinding == other.inputBinding + and self.inputs == other.inputs + and self.outputs == other.outputs + and self.requirements == other.requirements + and self.hints == other.hints + and self.cwlVersion == other.cwlVersion + and self.intent == other.intent + and self.class_ == other.class_ + and self.baseCommand == other.baseCommand + and self.arguments == other.arguments + and self.stdin == other.stdin + and self.stderr == other.stderr + and self.stdout == other.stdout + and self.successCodes == other.successCodes + and self.temporaryFailCodes == other.temporaryFailCodes + and self.permanentFailCodes == other.permanentFailCodes ) return False def __hash__(self) -> int: return hash( ( + self.id, self.label, - self.secondaryFiles, - self.streamable, self.doc, - self.id, - self.format, - self.loadContents, - self.loadListing, - self.default, - self.type_, - self.inputBinding, + self.inputs, + self.outputs, + self.requirements, + self.hints, + self.cwlVersion, + self.intent, + self.class_, + self.baseCommand, + self.arguments, + self.stdin, + self.stderr, + self.stdout, + self.successCodes, + self.temporaryFailCodes, + self.permanentFailCodes, ) ) @@ -13661,9 +13238,9 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), - uri_strtype_True_False_None_None, + uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("id") @@ -13710,14 +13287,30 @@ def fromDoc( if docRoot is not None: id = docRoot else: - id = "" - _errors__.append(ValidationException("missing id")) + id = "_:" + str(_uuid__.uuid4()) else: baseuri = id + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_CommandLineTool_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -13761,21 +13354,21 @@ def fromDoc( "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + doc = None + if "doc" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -13783,13 +13376,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13801,28 +13394,124 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) + try: + if _doc.get("inputs") is None: + raise ValidationException("missing required field `inputs`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + inputs = _load_field( + _doc.get("inputs"), + idmap_inputs_array_of_CommandInputParameterLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputs") + ) - if str(e) == "missing required field `streamable`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputs`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputs") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [e], + detailed_message=f"the `inputs` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("outputs") is None: + raise ValidationException("missing required field `outputs`", None, []) + + outputs = _load_field( + _doc.get("outputs"), + idmap_outputs_array_of_CommandOutputParameterLoader, + baseuri, + loadingOptions, + lc=_doc.get("outputs") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outputs`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outputs") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), + [e], + detailed_message=f"the `outputs` field with value `{val}` " + "is not valid because:", + ) + ) + requirements = None + if "requirements" in _doc: + try: + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, + baseuri, + loadingOptions, + lc=_doc.get("requirements") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `requirements`": _errors__.append( ValidationException( str(e), @@ -13830,13 +13519,13 @@ def fromDoc( ) ) else: - val = _doc.get("streamable") + val = _doc.get("requirements") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13848,28 +13537,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [e], - detailed_message=f"the `streamable` field with value `{val}` " + detailed_message=f"the `requirements` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + hints = None + if "hints" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("hints") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `hints`": _errors__.append( ValidationException( str(e), @@ -13877,13 +13566,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("hints") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13895,28 +13584,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `hints` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: + cwlVersion = None + if "cwlVersion" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + cwlVersion = _load_field( + _doc.get("cwlVersion"), + uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("cwlVersion") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `cwlVersion`": _errors__.append( ValidationException( str(e), @@ -13924,13 +13613,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("cwlVersion") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13942,28 +13631,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `cwlVersion` field with value `{val}` " "is not valid because:", ) ) - loadContents = None - if "loadContents" in _doc: + intent = None + if "intent" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + intent = _load_field( + _doc.get("intent"), + uri_union_of_None_type_or_array_of_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("intent") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `intent`": _errors__.append( ValidationException( str(e), @@ -13971,13 +13660,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("intent") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `intent` field is not valid because:", + SourceLine(_doc, "intent", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -13989,28 +13678,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `intent` field is not valid because:", + SourceLine(_doc, "intent", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `intent` field with value `{val}` " "is not valid because:", ) ) - loadListing = None - if "loadListing" in _doc: + baseCommand = None + if "baseCommand" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, + baseCommand = _load_field( + _doc.get("baseCommand"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("loadListing") + lc=_doc.get("baseCommand") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": + if str(e) == "missing required field `baseCommand`": _errors__.append( ValidationException( str(e), @@ -14018,13 +13707,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadListing") + val = _doc.get("baseCommand") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `baseCommand` field is not valid because:", + SourceLine(_doc, "baseCommand", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14036,28 +13725,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `baseCommand` field is not valid because:", + SourceLine(_doc, "baseCommand", str), [e], - detailed_message=f"the `loadListing` field with value `{val}` " + detailed_message=f"the `baseCommand` field with value `{val}` " "is not valid because:", ) ) - default = None - if "default" in _doc: + arguments = None + if "arguments" in _doc: try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, + arguments = _load_field( + _doc.get("arguments"), + union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, baseuri, loadingOptions, - lc=_doc.get("default") + lc=_doc.get("arguments") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `default`": + if str(e) == "missing required field `arguments`": _errors__.append( ValidationException( str(e), @@ -14065,13 +13754,13 @@ def fromDoc( ) ) else: - val = _doc.get("default") + val = _doc.get("arguments") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), + "the `arguments` field is not valid because:", + SourceLine(_doc, "arguments", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14083,76 +13772,263 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), + "the `arguments` field is not valid because:", + SourceLine(_doc, "arguments", str), [e], - detailed_message=f"the `default` field with value `{val}` " + detailed_message=f"the `arguments` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) + stdin = None + if "stdin" in _doc: + try: + stdin = _load_field( + _doc.get("stdin"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("stdin") + ) - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_stdinLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandInputRecordSchemaLoader_or_CommandInputEnumSchemaLoader_or_CommandInputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if str(e) == "missing required field `stdin`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("stdin") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `stdin` field is not valid because:", + SourceLine(_doc, "stdin", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `stdin` field is not valid because:", + SourceLine(_doc, "stdin", str), + [e], + detailed_message=f"the `stdin` field with value `{val}` " + "is not valid because:", + ) + ) + stderr = None + if "stderr" in _doc: + try: + stderr = _load_field( + _doc.get("stderr"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("stderr") + ) - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `stderr`": + _errors__.append( + ValidationException( + str(e), + None + ) ) + else: + val = _doc.get("stderr") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `stderr` field is not valid because:", + SourceLine(_doc, "stderr", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `stderr` field is not valid because:", + SourceLine(_doc, "stderr", str), + [e], + detailed_message=f"the `stderr` field with value `{val}` " + "is not valid because:", + ) + ) + stdout = None + if "stdout" in _doc: + try: + stdout = _load_field( + _doc.get("stdout"), + union_of_None_type_or_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("stdout") ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `stdout`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None + ) + ) + else: + val = _doc.get("stdout") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `stdout` field is not valid because:", + SourceLine(_doc, "stdout", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `stdout` field is not valid because:", + SourceLine(_doc, "stdout", str), + [e], + detailed_message=f"the `stdout` field with value `{val}` " + "is not valid because:", + ) + ) + successCodes = None + if "successCodes" in _doc: + try: + successCodes = _load_field( + _doc.get("successCodes"), + union_of_None_type_or_array_of_inttype, + baseuri, + loadingOptions, + lc=_doc.get("successCodes") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `successCodes`": + _errors__.append( + ValidationException( + str(e), + None ) ) else: + val = _doc.get("successCodes") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `successCodes` field is not valid because:", + SourceLine(_doc, "successCodes", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `successCodes` field is not valid because:", + SourceLine(_doc, "successCodes", str), + [e], + detailed_message=f"the `successCodes` field with value `{val}` " + "is not valid because:", + ) + ) + temporaryFailCodes = None + if "temporaryFailCodes" in _doc: + try: + temporaryFailCodes = _load_field( + _doc.get("temporaryFailCodes"), + union_of_None_type_or_array_of_inttype, + baseuri, + loadingOptions, + lc=_doc.get("temporaryFailCodes") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `temporaryFailCodes`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - inputBinding = None - if "inputBinding" in _doc: + else: + val = _doc.get("temporaryFailCodes") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `temporaryFailCodes` field is not valid because:", + SourceLine(_doc, "temporaryFailCodes", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `temporaryFailCodes` field is not valid because:", + SourceLine(_doc, "temporaryFailCodes", str), + [e], + detailed_message=f"the `temporaryFailCodes` field with value `{val}` " + "is not valid because:", + ) + ) + permanentFailCodes = None + if "permanentFailCodes" in _doc: try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_CommandLineBindingLoader, + permanentFailCodes = _load_field( + _doc.get("permanentFailCodes"), + union_of_None_type_or_array_of_inttype, baseuri, loadingOptions, - lc=_doc.get("inputBinding") + lc=_doc.get("permanentFailCodes") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inputBinding`": + if str(e) == "missing required field `permanentFailCodes`": _errors__.append( ValidationException( str(e), @@ -14160,13 +14036,13 @@ def fromDoc( ) ) else: - val = _doc.get("inputBinding") + val = _doc.get("permanentFailCodes") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `permanentFailCodes` field is not valid because:", + SourceLine(_doc, "permanentFailCodes", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14178,10 +14054,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), + "the `permanentFailCodes` field is not valid because:", + SourceLine(_doc, "permanentFailCodes", str), [e], - detailed_message=f"the `inputBinding` field with value `{val}` " + detailed_message=f"the `permanentFailCodes` field with value `{val}` " "is not valid because:", ) ) @@ -14193,14 +14069,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`, `inputBinding`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`, `baseCommand`, `arguments`, `stdin`, `stderr`, `stdout`, `successCodes`, `temporaryFailCodes`, `permanentFailCodes`".format( k ), SourceLine(_doc, k, str), @@ -14212,15 +14088,21 @@ def fromDoc( _constructed = cls( id=id, label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, doc=doc, - format=format, - loadContents=loadContents, - loadListing=loadListing, - default=default, - type_=type_, - inputBinding=inputBinding, + inputs=inputs, + outputs=outputs, + requirements=requirements, + hints=hints, + cwlVersion=cwlVersion, + intent=intent, + baseCommand=baseCommand, + arguments=arguments, + stdin=stdin, + stderr=stderr, + stdout=stdout, + successCodes=successCodes, + temporaryFailCodes=temporaryFailCodes, + permanentFailCodes=permanentFailCodes, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -14241,56 +14123,89 @@ def save( if self.id is not None: u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, self.id, False, None, relative_uris) + r["class"] = u if self.label is not None: r["label"] = save( self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.inputs is not None: + r["inputs"] = save( + self.inputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputs is not None: + r["outputs"] = save( + self.outputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.requirements is not None: + r["requirements"] = save( + self.requirements, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.cwlVersion is not None: + u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) + r["cwlVersion"] = u + if self.intent is not None: + u = save_relative_uri(self.intent, self.id, True, None, relative_uris) + r["intent"] = u + if self.baseCommand is not None: + r["baseCommand"] = save( + self.baseCommand, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris + if self.arguments is not None: + r["arguments"] = save( + self.arguments, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, + if self.stdin is not None: + r["stdin"] = save( + self.stdin, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.stderr is not None: + r["stderr"] = save( + self.stderr, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.stdout is not None: + r["stdout"] = save( + self.stdout, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.successCodes is not None: + r["successCodes"] = save( + self.successCodes, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, + if self.temporaryFailCodes is not None: + r["temporaryFailCodes"] = save( + self.temporaryFailCodes, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, + if self.permanentFailCodes is not None: + r["permanentFailCodes"] = save( + self.permanentFailCodes, top=False, base_url=self.id, relative_uris=relative_uris, @@ -14306,17 +14221,23 @@ def save( def __init__( self, - id: str, - type_: CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | Sequence[CWLType | CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema | str] | stdin | str, + inputs: Sequence[CommandInputParameter], + outputs: Sequence[CommandOutputParameter], + id: None | str = None, label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, doc: None | Sequence[str] | str = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - default: CWLObjectType | None = None, - inputBinding: CommandLineBinding | None = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + intent: None | Sequence[str] = None, + baseCommand: None | Sequence[str] | str = None, + arguments: None | Sequence[CommandLineBinding | str] = None, + stdin: None | str = None, + stderr: None | str = None, + stdout: None | str = None, + successCodes: None | Sequence[i32] = None, + temporaryFailCodes: None | Sequence[i32] = None, + permanentFailCodes: None | Sequence[i32] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -14328,68 +14249,98 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "CommandLineTool" + self.baseCommand = baseCommand + self.arguments = arguments + self.stdin = stdin + self.stderr = stderr + self.stdout = stdout + self.successCodes = successCodes + self.temporaryFailCodes = temporaryFailCodes + self.permanentFailCodes = permanentFailCodes attrs: ClassVar[Collection[str]] = frozenset( [ + "id", "label", - "secondaryFiles", - "streamable", "doc", - "id", - "format", - "loadContents", - "loadListing", - "default", - "type", - "inputBinding", + "inputs", + "outputs", + "requirements", + "hints", + "cwlVersion", + "intent", + "class", + "baseCommand", + "arguments", + "stdin", + "stderr", + "stdout", + "successCodes", + "temporaryFailCodes", + "permanentFailCodes", ] ) @mypyc_attr(native_class=True) -class CommandOutputParameter(Saveable): - """ - An output parameter for a CommandLineTool. +class DockerRequirement(Saveable): """ + Indicates that a workflow component should be run in a `Docker `__ or Docker-compatible (such as `Singularity `__ and `udocker `__) container environment and specifies how to fetch or build the image. - id: str + If a CommandLineTool lists ``DockerRequirement`` under ``hints`` (or ``requirements``), it may (or must) be run in the specified Docker container. + + The platform must first acquire or install the correct Docker image as specified by ``dockerPull``, ``dockerImport``, ``dockerLoad`` or ``dockerFile``. + + The platform must execute the tool in the container using ``docker run`` with the appropriate Docker image and tool command line. + + The workflow platform may provide input files and the designated output directory through the use of volume bind mounts. The platform should rewrite file paths in the input object to correspond to the Docker bind mounted locations. That is, the platform should rewrite values in the parameter context such as ``runtime.outdir``, ``runtime.tmpdir`` and others to be valid paths within the container. The platform must ensure that ``runtime.outdir`` and ``runtime.tmpdir`` are distinct directories. + + When running a tool contained in Docker, the workflow platform must not assume anything about the contents of the Docker container, such as the presence or absence of specific software, except to assume that the generated command line represents a valid command within the runtime environment of the container. + + A container image may specify an `ENTRYPOINT `__ and/or `CMD `__. Command line arguments will be appended after all elements of ENTRYPOINT, and will override all elements specified using CMD (in other words, CMD is only used when the CommandLineTool definition produces an empty command line). + + Use of implicit ENTRYPOINT or CMD are discouraged due to reproducibility concerns of the implicit hidden execution point (For further discussion, see `https://doi.org/10.12688/f1000research.15140.1 `__). Portable CommandLineTool wrappers in which use of a container is optional must not rely on ENTRYPOINT or CMD. CommandLineTools which do rely on ENTRYPOINT or CMD must list ``DockerRequirement`` in the ``requirements`` section. + + Interaction with other requirements + ----------------------------------- + + If `EnvVarRequirement <#EnvVarRequirement>`__ is specified alongside a DockerRequirement, the environment variables must be provided to Docker using ``--env`` or ``--env-file`` and interact with the container's preexisting environment as defined by Docker. + + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandOutputParameter): + if isinstance(other, DockerRequirement): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.type_ == other.type_ - and self.outputBinding == other.outputBinding + self.class_ == other.class_ + and self.dockerPull == other.dockerPull + and self.dockerLoad == other.dockerLoad + and self.dockerFile == other.dockerFile + and self.dockerImport == other.dockerImport + and self.dockerImageId == other.dockerImageId + and self.dockerOutputDirectory == other.dockerOutputDirectory ) return False def __hash__(self) -> int: return hash( ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.type_, - self.outputBinding, + self.class_, + self.dockerPull, + self.dockerLoad, + self.dockerFile, + self.dockerImport, + self.dockerImageId, + self.dockerOutputDirectory, ) ) @@ -14407,21 +14358,38 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_DockerRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + dockerPull = None + if "dockerPull" in _doc: try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, + dockerPull = _load_field( + _doc.get("dockerPull"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("id") + lc=_doc.get("dockerPull") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `dockerPull`": _errors__.append( ValidationException( str(e), @@ -14429,13 +14397,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("dockerPull") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `dockerPull` field is not valid because:", + SourceLine(_doc, "dockerPull", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14447,84 +14415,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `dockerPull` field is not valid because:", + SourceLine(_doc, "dockerPull", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `dockerPull` field with value `{val}` " "is not valid because:", ) ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: + dockerLoad = None + if "dockerLoad" in _doc: try: - label = load_field( - _doc.get("label"), + dockerLoad = _load_field( + _doc.get("dockerLoad"), union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("dockerLoad") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `dockerLoad`": _errors__.append( ValidationException( str(e), @@ -14532,13 +14444,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("dockerLoad") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `dockerLoad` field is not valid because:", + SourceLine(_doc, "dockerLoad", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14550,28 +14462,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `dockerLoad` field is not valid because:", + SourceLine(_doc, "dockerLoad", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `dockerLoad` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: + dockerFile = None + if "dockerFile" in _doc: try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, + dockerFile = _load_field( + _doc.get("dockerFile"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("streamable") + lc=_doc.get("dockerFile") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `streamable`": + if str(e) == "missing required field `dockerFile`": _errors__.append( ValidationException( str(e), @@ -14579,13 +14491,13 @@ def fromDoc( ) ) else: - val = _doc.get("streamable") + val = _doc.get("dockerFile") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `dockerFile` field is not valid because:", + SourceLine(_doc, "dockerFile", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14597,28 +14509,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `dockerFile` field is not valid because:", + SourceLine(_doc, "dockerFile", str), [e], - detailed_message=f"the `streamable` field with value `{val}` " + detailed_message=f"the `dockerFile` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + dockerImport = None + if "dockerImport" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + dockerImport = _load_field( + _doc.get("dockerImport"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("dockerImport") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `dockerImport`": _errors__.append( ValidationException( str(e), @@ -14626,13 +14538,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("dockerImport") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `dockerImport` field is not valid because:", + SourceLine(_doc, "dockerImport", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14644,28 +14556,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `dockerImport` field is not valid because:", + SourceLine(_doc, "dockerImport", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `dockerImport` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: + dockerImageId = None + if "dockerImageId" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + dockerImageId = _load_field( + _doc.get("dockerImageId"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("dockerImageId") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `dockerImageId`": _errors__.append( ValidationException( str(e), @@ -14673,13 +14585,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("dockerImageId") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `dockerImageId` field is not valid because:", + SourceLine(_doc, "dockerImageId", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14691,76 +14603,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `dockerImageId` field is not valid because:", + SourceLine(_doc, "dockerImageId", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `dockerImageId` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_stdoutLoader_or_stderrLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_CommandOutputRecordSchemaLoader_or_CommandOutputEnumSchemaLoader_or_CommandOutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - outputBinding = None - if "outputBinding" in _doc: + dockerOutputDirectory = None + if "dockerOutputDirectory" in _doc: try: - outputBinding = load_field( - _doc.get("outputBinding"), - union_of_None_type_or_CommandOutputBindingLoader, + dockerOutputDirectory = _load_field( + _doc.get("dockerOutputDirectory"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("outputBinding") + lc=_doc.get("dockerOutputDirectory") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputBinding`": + if str(e) == "missing required field `dockerOutputDirectory`": _errors__.append( ValidationException( str(e), @@ -14768,13 +14632,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputBinding") + val = _doc.get("dockerOutputDirectory") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `dockerOutputDirectory` field is not valid because:", + SourceLine(_doc, "dockerOutputDirectory", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -14786,10 +14650,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputBinding` field is not valid because:", - SourceLine(_doc, "outputBinding", str), + "the `dockerOutputDirectory` field is not valid because:", + SourceLine(_doc, "dockerOutputDirectory", str), [e], - detailed_message=f"the `outputBinding` field with value `{val}` " + detailed_message=f"the `dockerOutputDirectory` field with value `{val}` " "is not valid because:", ) ) @@ -14801,14 +14665,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`, `outputBinding`".format( + "invalid field `{}`, expected one of: `class`, `dockerPull`, `dockerLoad`, `dockerFile`, `dockerImport`, `dockerImageId`, `dockerOutputDirectory`".format( k ), SourceLine(_doc, k, str), @@ -14818,18 +14682,15 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - type_=type_, - outputBinding=outputBinding, + dockerPull=dockerPull, + dockerLoad=dockerLoad, + dockerFile=dockerFile, + dockerImport=dockerImport, + dockerImageId=dockerImageId, + dockerOutputDirectory=dockerOutputDirectory, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -14843,43 +14704,56 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.dockerPull is not None: + r["dockerPull"] = save( + self.dockerPull, top=False, - base_url=self.id, + base_url=base_url, relative_uris=relative_uris, ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris + if self.dockerLoad is not None: + r["dockerLoad"] = save( + self.dockerLoad, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris + if self.dockerFile is not None: + r["dockerFile"] = save( + self.dockerFile, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.outputBinding is not None: - r["outputBinding"] = save( - self.outputBinding, + if self.dockerImport is not None: + r["dockerImport"] = save( + self.dockerImport, top=False, - base_url=self.id, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.dockerImageId is not None: + r["dockerImageId"] = save( + self.dockerImageId, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.dockerOutputDirectory is not None: + r["dockerOutputDirectory"] = save( + self.dockerOutputDirectory, + top=False, + base_url=base_url, relative_uris=relative_uris, ) @@ -14893,14 +14767,12 @@ def save( def __init__( self, - id: str, - type_: CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | Sequence[CWLType | CommandOutputArraySchema | CommandOutputEnumSchema | CommandOutputRecordSchema | str] | stderr | stdout | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | str = None, - outputBinding: CommandOutputBinding | None = None, + dockerPull: None | str = None, + dockerLoad: None | str = None, + dockerFile: None | str = None, + dockerImport: None | str = None, + dockerImageId: None | str = None, + dockerOutputDirectory: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -14912,85 +14784,41 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ - self.outputBinding = outputBinding + self.class_: Final[str] = "DockerRequirement" + self.dockerPull = dockerPull + self.dockerLoad = dockerLoad + self.dockerFile = dockerFile + self.dockerImport = dockerImport + self.dockerImageId = dockerImageId + self.dockerOutputDirectory = dockerOutputDirectory attrs: ClassVar[Collection[str]] = frozenset( [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "type", - "outputBinding", + "class", + "dockerPull", + "dockerLoad", + "dockerFile", + "dockerImport", + "dockerImageId", + "dockerOutputDirectory", ] ) @mypyc_attr(native_class=True) -class CommandLineTool(Saveable): +class SoftwareRequirement(Saveable): """ - This defines the schema of the CWL Command Line Tool Description document. + A list of software packages that should be configured in the environment of the defined process. """ - id: str - def __eq__(self, other: Any) -> bool: - if isinstance(other, CommandLineTool): - return bool( - self.id == other.id - and self.label == other.label - and self.doc == other.doc - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.cwlVersion == other.cwlVersion - and self.intent == other.intent - and self.class_ == other.class_ - and self.baseCommand == other.baseCommand - and self.arguments == other.arguments - and self.stdin == other.stdin - and self.stderr == other.stderr - and self.stdout == other.stdout - and self.successCodes == other.successCodes - and self.temporaryFailCodes == other.temporaryFailCodes - and self.permanentFailCodes == other.permanentFailCodes - ) + if isinstance(other, SoftwareRequirement): + return bool(self.class_ == other.class_ and self.packages == other.packages) return False def __hash__(self) -> int: - return hash( - ( - self.id, - self.label, - self.doc, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.cwlVersion, - self.intent, - self.class_, - self.baseCommand, - self.arguments, - self.stdin, - self.stderr, - self.stdout, - self.successCodes, - self.temporaryFailCodes, - self.permanentFailCodes, - ) - ) + return hash((self.class_, self.packages)) @classmethod def fromDoc( @@ -15006,235 +14834,200 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_CommandLineTool_classLoader_False_True_None_None, + uri_SoftwareRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) + raise e + try: + if _doc.get("packages") is None: + raise ValidationException("missing required field `packages`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + packages = _load_field( + _doc.get("packages"), + idmap_packages_array_of_SoftwarePackageLoader, + baseuri, + loadingOptions, + lc=_doc.get("packages") + ) - if str(e) == "missing required field `label`": + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `packages`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("packages") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `packages` field is not valid because:", + SourceLine(_doc, "packages", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) + "the `packages` field is not valid because:", + SourceLine(_doc, "packages", str), + [e], + detailed_message=f"the `packages` field with value `{val}` " + "is not valid because:", ) - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_CommandInputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None ) - ) - else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", + "invalid field `{}`, expected one of: `class`, `packages`".format( + k + ), + SourceLine(_doc, k, str), ) ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + packages=packages, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.packages is not None: + r["packages"] = save( + self.packages, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + packages: Sequence[SoftwarePackage], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "SoftwareRequirement" + self.packages = packages + + attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + + +@mypyc_attr(native_class=True) +class SoftwarePackage(Saveable): + def __eq__(self, other: Any) -> bool: + if isinstance(other, SoftwarePackage): + return bool( + self.package == other.package + and self.version == other.version + and self.specs == other.specs + ) + return False + + def __hash__(self) -> int: + return hash((self.package, self.version, self.specs)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) + if _doc.get("package") is None: + raise ValidationException("missing required field `package`", None, []) - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_CommandOutputParameterLoader, + package = _load_field( + _doc.get("package"), + strtype, baseuri, loadingOptions, - lc=_doc.get("outputs") + lc=_doc.get("package") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputs`": + if str(e) == "missing required field `package`": _errors__.append( ValidationException( str(e), @@ -15242,13 +15035,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputs") + val = _doc.get("package") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), + "the `package` field is not valid because:", + SourceLine(_doc, "package", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15260,28 +15053,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), + "the `package` field is not valid because:", + SourceLine(_doc, "package", str), [e], - detailed_message=f"the `outputs` field with value `{val}` " + detailed_message=f"the `package` field with value `{val}` " "is not valid because:", ) ) - requirements = None - if "requirements" in _doc: + version = None + if "version" in _doc: try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, + version = _load_field( + _doc.get("version"), + union_of_None_type_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("requirements") + lc=_doc.get("version") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `requirements`": + if str(e) == "missing required field `version`": _errors__.append( ValidationException( str(e), @@ -15289,13 +15082,13 @@ def fromDoc( ) ) else: - val = _doc.get("requirements") + val = _doc.get("version") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), + "the `version` field is not valid because:", + SourceLine(_doc, "version", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15307,28 +15100,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), + "the `version` field is not valid because:", + SourceLine(_doc, "version", str), [e], - detailed_message=f"the `requirements` field with value `{val}` " + detailed_message=f"the `version` field with value `{val}` " "is not valid because:", ) ) - hints = None - if "hints" in _doc: + specs = None + if "specs" in _doc: try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, + specs = _load_field( + _doc.get("specs"), + uri_union_of_None_type_or_array_of_strtype_False_False_None_True, baseuri, loadingOptions, - lc=_doc.get("hints") + lc=_doc.get("specs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `hints`": + if str(e) == "missing required field `specs`": _errors__.append( ValidationException( str(e), @@ -15336,13 +15129,13 @@ def fromDoc( ) ) else: - val = _doc.get("hints") + val = _doc.get("specs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), + "the `specs` field is not valid because:", + SourceLine(_doc, "specs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15354,28 +15147,150 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), + "the `specs` field is not valid because:", + SourceLine(_doc, "specs", str), [e], - detailed_message=f"the `hints` field with value `{val}` " + detailed_message=f"the `specs` field with value `{val}` " "is not valid because:", ) ) - cwlVersion = None - if "cwlVersion" in _doc: + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `package`, `version`, `specs`".format( + k + ), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + package=package, + version=version, + specs=specs, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.package is not None: + r["package"] = save( + self.package, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.version is not None: + r["version"] = save( + self.version, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.specs is not None: + u = save_relative_uri(self.specs, base_url, False, None, relative_uris) + r["specs"] = u + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + package: str, + version: None | Sequence[str] = None, + specs: None | Sequence[str] = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.package = package + self.version = version + self.specs = specs + + attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) + + +@mypyc_attr(native_class=True) +class Dirent(Saveable): + """ + Define a file or subdirectory that must be staged to a particular place prior to executing the command line tool. May be the result of executing an expression, such as building a configuration file from a template. + + Usually files are staged within the `designated output directory <#Runtime_environment>`__. However, under certain circumstances, files may be staged at arbitrary locations, see discussion for ``entryname``. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, Dirent): + return bool( + self.entryname == other.entryname + and self.entry == other.entry + and self.writable == other.writable + ) + return False + + def __hash__(self) -> int: + return hash((self.entryname, self.entry, self.writable)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + entryname = None + if "entryname" in _doc: try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, + entryname = _load_field( + _doc.get("entryname"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("cwlVersion") + lc=_doc.get("entryname") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `cwlVersion`": + if str(e) == "missing required field `entryname`": _errors__.append( ValidationException( str(e), @@ -15383,13 +15298,13 @@ def fromDoc( ) ) else: - val = _doc.get("cwlVersion") + val = _doc.get("entryname") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), + "the `entryname` field is not valid because:", + SourceLine(_doc, "entryname", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15401,28 +15316,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), + "the `entryname` field is not valid because:", + SourceLine(_doc, "entryname", str), [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " + detailed_message=f"the `entryname` field with value `{val}` " "is not valid because:", ) ) - intent = None - if "intent" in _doc: + try: + if _doc.get("entry") is None: + raise ValidationException("missing required field `entry`", None, []) + + entry = _load_field( + _doc.get("entry"), + union_of_strtype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("entry") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `entry`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("entry") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `entry` field is not valid because:", + SourceLine(_doc, "entry", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `entry` field is not valid because:", + SourceLine(_doc, "entry", str), + [e], + detailed_message=f"the `entry` field with value `{val}` " + "is not valid because:", + ) + ) + writable = None + if "writable" in _doc: try: - intent = load_field( - _doc.get("intent"), - uri_union_of_None_type_or_array_of_strtype_True_False_None_None, + writable = _load_field( + _doc.get("writable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("intent") + lc=_doc.get("writable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `intent`": + if str(e) == "missing required field `writable`": _errors__.append( ValidationException( str(e), @@ -15430,13 +15393,13 @@ def fromDoc( ) ) else: - val = _doc.get("intent") + val = _doc.get("writable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `intent` field is not valid because:", - SourceLine(_doc, "intent", str), + "the `writable` field is not valid because:", + SourceLine(_doc, "writable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -15448,389 +15411,508 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `intent` field is not valid because:", - SourceLine(_doc, "intent", str), + "the `writable` field is not valid because:", + SourceLine(_doc, "writable", str), [e], - detailed_message=f"the `intent` field with value `{val}` " + detailed_message=f"the `writable` field with value `{val}` " "is not valid because:", ) ) - baseCommand = None - if "baseCommand" in _doc: - try: - baseCommand = load_field( - _doc.get("baseCommand"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("baseCommand") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `baseCommand`": + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("baseCommand") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `baseCommand` field is not valid because:", - SourceLine(_doc, "baseCommand", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `baseCommand` field is not valid because:", - SourceLine(_doc, "baseCommand", str), - [e], - detailed_message=f"the `baseCommand` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `entryname`, `entry`, `writable`".format( + k + ), + SourceLine(_doc, k, str), ) - arguments = None - if "arguments" in _doc: - try: - arguments = load_field( - _doc.get("arguments"), - union_of_None_type_or_array_of_union_of_strtype_or_ExpressionLoader_or_CommandLineBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("arguments") - ) + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + entryname=entryname, + entry=entry, + writable=writable, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `arguments`": + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.entryname is not None: + r["entryname"] = save( + self.entryname, + top=False, + base_url=base_url, + relative_uris=relative_uris, + ) + if self.entry is not None: + r["entry"] = save( + self.entry, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.writable is not None: + r["writable"] = save( + self.writable, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + entry: str, + entryname: None | str = None, + writable: None | bool = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.entryname = entryname + self.entry = entry + self.writable = writable + + attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + + +@mypyc_attr(native_class=True) +class InitialWorkDirRequirement(Saveable): + """ + Define a list of files and subdirectories that must be staged by the workflow platform prior to executing the command line tool. Normally files are staged within the designated output directory. However, when running inside containers, files may be staged at arbitrary locations, see discussion for ```Dirent.entryname`` <#Dirent>`__. Together with ``DockerRequirement.dockerOutputDirectory`` it is possible to control the locations of both input and output files when running in containers. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, InitialWorkDirRequirement): + return bool(self.class_ == other.class_ and self.listing == other.listing) + return False + + def __hash__(self) -> int: + return hash((self.class_, self.listing)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_InitialWorkDirRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("listing") is None: + raise ValidationException("missing required field `listing`", None, []) + + listing = _load_field( + _doc.get("listing"), + union_of_ExpressionLoader_or_array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader, + baseuri, + loadingOptions, + lc=_doc.get("listing") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `listing`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("listing") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("arguments") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `arguments` field is not valid because:", - SourceLine(_doc, "arguments", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `arguments` field is not valid because:", - SourceLine(_doc, "arguments", str), - [e], - detailed_message=f"the `arguments` field with value `{val}` " - "is not valid because:", - ) - ) - stdin = None - if "stdin" in _doc: - try: - stdin = load_field( - _doc.get("stdin"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("stdin") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `stdin`": _errors__.append( ValidationException( - str(e), - None + "the `listing` field is not valid because:", + SourceLine(_doc, "listing", str), + [e], + detailed_message=f"the `listing` field with value `{val}` " + "is not valid because:", ) ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("stdin") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `stdin` field is not valid because:", - SourceLine(_doc, "stdin", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `stdin` field is not valid because:", - SourceLine(_doc, "stdin", str), - [e], - detailed_message=f"the `stdin` field with value `{val}` " - "is not valid because:", - ) + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `listing`".format( + k + ), + SourceLine(_doc, k, str), ) - stderr = None - if "stderr" in _doc: - try: - stderr = load_field( - _doc.get("stderr"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("stderr") - ) + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + listing=listing, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `stderr`": + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.listing is not None: + r["listing"] = save( + self.listing, top=False, base_url=base_url, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "InitialWorkDirRequirement" + self.listing = listing + + attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + + +@mypyc_attr(native_class=True) +class EnvVarRequirement(Saveable): + """ + Define a list of environment variables which will be set in the execution environment of the tool. See ``EnvironmentDef`` for details. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, EnvVarRequirement): + return bool(self.class_ == other.class_ and self.envDef == other.envDef) + return False + + def __hash__(self) -> int: + return hash((self.class_, self.envDef)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_EnvVarRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("envDef") is None: + raise ValidationException("missing required field `envDef`", None, []) + + envDef = _load_field( + _doc.get("envDef"), + idmap_envDef_array_of_EnvironmentDefLoader, + baseuri, + loadingOptions, + lc=_doc.get("envDef") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `envDef`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("envDef") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - str(e), - None + "the `envDef` field is not valid because:", + SourceLine(_doc, "envDef", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], ) ) else: - val = _doc.get("stderr") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `stderr` field is not valid because:", - SourceLine(_doc, "stderr", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `stderr` field is not valid because:", - SourceLine(_doc, "stderr", str), - [e], - detailed_message=f"the `stderr` field with value `{val}` " - "is not valid because:", - ) - ) - stdout = None - if "stdout" in _doc: - try: - stdout = load_field( - _doc.get("stdout"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("stdout") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `stdout`": _errors__.append( ValidationException( - str(e), - None + "the `envDef` field is not valid because:", + SourceLine(_doc, "envDef", str), + [e], + detailed_message=f"the `envDef` field with value `{val}` " + "is not valid because:", ) ) + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("stdout") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `stdout` field is not valid because:", - SourceLine(_doc, "stdout", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`, `envDef`".format( + k + ), + SourceLine(_doc, k, str), ) - else: - _errors__.append( - ValidationException( - "the `stdout` field is not valid because:", - SourceLine(_doc, "stdout", str), - [e], - detailed_message=f"the `stdout` field with value `{val}` " - "is not valid because:", - ) - ) - successCodes = None - if "successCodes" in _doc: - try: - successCodes = load_field( - _doc.get("successCodes"), - union_of_None_type_or_array_of_inttype, - baseuri, - loadingOptions, - lc=_doc.get("successCodes") - ) + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + envDef=envDef, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `successCodes`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("successCodes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `successCodes` field is not valid because:", - SourceLine(_doc, "successCodes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `successCodes` field is not valid because:", - SourceLine(_doc, "successCodes", str), - [e], - detailed_message=f"the `successCodes` field with value `{val}` " - "is not valid because:", - ) - ) - temporaryFailCodes = None - if "temporaryFailCodes" in _doc: - try: - temporaryFailCodes = load_field( - _doc.get("temporaryFailCodes"), - union_of_None_type_or_array_of_inttype, - baseuri, - loadingOptions, - lc=_doc.get("temporaryFailCodes") - ) + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.envDef is not None: + r["envDef"] = save( + self.envDef, top=False, base_url=base_url, relative_uris=relative_uris + ) - if str(e) == "missing required field `temporaryFailCodes`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("temporaryFailCodes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `temporaryFailCodes` field is not valid because:", - SourceLine(_doc, "temporaryFailCodes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `temporaryFailCodes` field is not valid because:", - SourceLine(_doc, "temporaryFailCodes", str), - [e], - detailed_message=f"the `temporaryFailCodes` field with value `{val}` " - "is not valid because:", - ) - ) - permanentFailCodes = None - if "permanentFailCodes" in _doc: - try: - permanentFailCodes = load_field( - _doc.get("permanentFailCodes"), - union_of_None_type_or_array_of_inttype, - baseuri, - loadingOptions, - lc=_doc.get("permanentFailCodes") - ) + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + def __init__( + self, + envDef: Sequence[EnvironmentDef], + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "EnvVarRequirement" + self.envDef = envDef - if str(e) == "missing required field `permanentFailCodes`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("permanentFailCodes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `permanentFailCodes` field is not valid because:", - SourceLine(_doc, "permanentFailCodes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `permanentFailCodes` field is not valid because:", - SourceLine(_doc, "permanentFailCodes", str), - [e], - detailed_message=f"the `permanentFailCodes` field with value `{val}` " - "is not valid because:", - ) - ) + attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) + + +@mypyc_attr(native_class=True) +class ShellCommandRequirement(Saveable): + """ + Modify the behavior of CommandLineTool to generate a single string containing a shell command line. Each item in the ``arguments`` list must be joined into a string separated by single spaces and quoted to prevent interpretation by the shell, unless ``CommandLineBinding`` for that argument contains ``shellQuote: false``. If ``shellQuote: false`` is specified, the argument is joined into the command string without quoting, which allows the use of shell metacharacters such as ``|`` for pipes. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, ShellCommandRequirement): + return bool(self.class_ == other.class_) + return False + + def __hash__(self) -> int: + return hash((self.class_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_ShellCommandRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -15839,16 +15921,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`, `baseCommand`, `arguments`, `stdin`, `stderr`, `stdout`, `successCodes`, `temporaryFailCodes`, `permanentFailCodes`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -15856,27 +15936,9 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, - label=label, - doc=doc, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - cwlVersion=cwlVersion, - intent=intent, - baseCommand=baseCommand, - arguments=arguments, - stdin=stdin, - stderr=stderr, - stdout=stdout, - successCodes=successCodes, - temporaryFailCodes=temporaryFailCodes, - permanentFailCodes=permanentFailCodes, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -15890,94 +15952,16 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) + u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.intent is not None: - u = save_relative_uri(self.intent, self.id, True, None, relative_uris) - r["intent"] = u - if self.baseCommand is not None: - r["baseCommand"] = save( - self.baseCommand, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.arguments is not None: - r["arguments"] = save( - self.arguments, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.stdin is not None: - r["stdin"] = save( - self.stdin, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.stderr is not None: - r["stderr"] = save( - self.stderr, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.stdout is not None: - r["stdout"] = save( - self.stdout, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.successCodes is not None: - r["successCodes"] = save( - self.successCodes, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.temporaryFailCodes is not None: - r["temporaryFailCodes"] = save( - self.temporaryFailCodes, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.permanentFailCodes is not None: - r["permanentFailCodes"] = save( - self.permanentFailCodes, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) # top refers to the directory level if top: @@ -15989,23 +15973,6 @@ def save( def __init__( self, - inputs: Sequence[CommandInputParameter], - outputs: Sequence[CommandOutputParameter], - id: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: CWLVersion | None = None, - intent: None | Sequence[str] = None, - baseCommand: None | Sequence[str] | str = None, - arguments: None | Sequence[CommandLineBinding | str] = None, - stdin: None | str = None, - stderr: None | str = None, - stdout: None | str = None, - successCodes: None | Sequence[i32] = None, - temporaryFailCodes: None | Sequence[i32] = None, - permanentFailCodes: None | Sequence[i32] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -16017,116 +15984,44 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_: Final[str] = "CommandLineTool" - self.baseCommand = baseCommand - self.arguments = arguments - self.stdin = stdin - self.stderr = stderr - self.stdout = stdout - self.successCodes = successCodes - self.temporaryFailCodes = temporaryFailCodes - self.permanentFailCodes = permanentFailCodes + self.class_: Final[str] = "ShellCommandRequirement" - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "label", - "doc", - "inputs", - "outputs", - "requirements", - "hints", - "cwlVersion", - "intent", - "class", - "baseCommand", - "arguments", - "stdin", - "stderr", - "stdout", - "successCodes", - "temporaryFailCodes", - "permanentFailCodes", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) @mypyc_attr(native_class=True) -class DockerRequirement(Saveable): +class ResourceRequirement(Saveable): """ - Indicates that a workflow component should be run in a - [Docker](https://docker.com) or Docker-compatible (such as - [Singularity](https://www.sylabs.io/) and [udocker](https://github.com/indigo-dc/udocker)) container environment and - specifies how to fetch or build the image. - - If a CommandLineTool lists `DockerRequirement` under - `hints` (or `requirements`), it may (or must) be run in the specified Docker - container. - - The platform must first acquire or install the correct Docker image as - specified by `dockerPull`, `dockerImport`, `dockerLoad` or `dockerFile`. - - The platform must execute the tool in the container using `docker run` with - the appropriate Docker image and tool command line. - - The workflow platform may provide input files and the designated output - directory through the use of volume bind mounts. The platform should rewrite - file paths in the input object to correspond to the Docker bind mounted - locations. That is, the platform should rewrite values in the parameter context - such as `runtime.outdir`, `runtime.tmpdir` and others to be valid paths - within the container. The platform must ensure that `runtime.outdir` and - `runtime.tmpdir` are distinct directories. - - When running a tool contained in Docker, the workflow platform must not - assume anything about the contents of the Docker container, such as the - presence or absence of specific software, except to assume that the - generated command line represents a valid command within the runtime - environment of the container. - - A container image may specify an - [ENTRYPOINT](https://docs.docker.com/engine/reference/builder/#entrypoint) - and/or - [CMD](https://docs.docker.com/engine/reference/builder/#cmd). - Command line arguments will be appended after all elements of - ENTRYPOINT, and will override all elements specified using CMD (in - other words, CMD is only used when the CommandLineTool definition - produces an empty command line). - - Use of implicit ENTRYPOINT or CMD are discouraged due to reproducibility - concerns of the implicit hidden execution point (For further discussion, see - [https://doi.org/10.12688/f1000research.15140.1](https://doi.org/10.12688/f1000research.15140.1)). Portable - CommandLineTool wrappers in which use of a container is optional must not rely on ENTRYPOINT or CMD. - CommandLineTools which do rely on ENTRYPOINT or CMD must list `DockerRequirement` in the - `requirements` section. - - ## Interaction with other requirements - - If [EnvVarRequirement](#EnvVarRequirement) is specified alongside a - DockerRequirement, the environment variables must be provided to Docker - using `--env` or `--env-file` and interact with the container's preexisting - environment as defined by Docker. + Specify basic hardware resource requirements. + + "min" is the minimum amount of a resource that must be reserved to schedule a job. If "min" cannot be satisfied, the job should not be run. + + "max" is the maximum amount of a resource that the job shall be allocated. If a node has sufficient resources, multiple jobs may be scheduled on a single node provided each job's "max" resource requirements are met. If a job attempts to exceed its resource allocation, an implementation may deny additional resources, which may result in job failure. + + If both "min" and "max" are specified, an implementation may choose to allocate any amount between "min" and "max", with the actual allocation provided in the ``runtime`` object. + + If "min" is specified but "max" is not, then "max" == "min" If "max" is specified by "min" is not, then "min" == "max". + + It is an error if max < min. + + It is an error if the value of any of these fields is negative. + + If neither "min" nor "max" is specified for a resource, use the default values below. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, DockerRequirement): + if isinstance(other, ResourceRequirement): return bool( self.class_ == other.class_ - and self.dockerPull == other.dockerPull - and self.dockerLoad == other.dockerLoad - and self.dockerFile == other.dockerFile - and self.dockerImport == other.dockerImport - and self.dockerImageId == other.dockerImageId - and self.dockerOutputDirectory == other.dockerOutputDirectory + and self.coresMin == other.coresMin + and self.coresMax == other.coresMax + and self.ramMin == other.ramMin + and self.ramMax == other.ramMax + and self.tmpdirMin == other.tmpdirMin + and self.tmpdirMax == other.tmpdirMax + and self.outdirMin == other.outdirMin + and self.outdirMax == other.outdirMax ) return False @@ -16134,12 +16029,14 @@ def __hash__(self) -> int: return hash( ( self.class_, - self.dockerPull, - self.dockerLoad, - self.dockerFile, - self.dockerImport, - self.dockerImageId, - self.dockerOutputDirectory, + self.coresMin, + self.coresMax, + self.ramMin, + self.ramMax, + self.tmpdirMin, + self.tmpdirMax, + self.outdirMin, + self.outdirMax, ) ) @@ -16161,33 +16058,34 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_DockerRequirement_classLoader_False_True_None_None, + uri_ResourceRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - dockerPull = None - if "dockerPull" in _doc: + raise e + coresMin = None + if "coresMin" in _doc: try: - dockerPull = load_field( - _doc.get("dockerPull"), - union_of_None_type_or_strtype, + coresMin = _load_field( + _doc.get("coresMin"), + union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("dockerPull") + lc=_doc.get("coresMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerPull`": + if str(e) == "missing required field `coresMin`": _errors__.append( ValidationException( str(e), @@ -16195,13 +16093,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerPull") + val = _doc.get("coresMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerPull` field is not valid because:", - SourceLine(_doc, "dockerPull", str), + "the `coresMin` field is not valid because:", + SourceLine(_doc, "coresMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16213,28 +16111,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerPull` field is not valid because:", - SourceLine(_doc, "dockerPull", str), + "the `coresMin` field is not valid because:", + SourceLine(_doc, "coresMin", str), [e], - detailed_message=f"the `dockerPull` field with value `{val}` " + detailed_message=f"the `coresMin` field with value `{val}` " "is not valid because:", ) ) - dockerLoad = None - if "dockerLoad" in _doc: + coresMax = None + if "coresMax" in _doc: try: - dockerLoad = load_field( - _doc.get("dockerLoad"), - union_of_None_type_or_strtype, + coresMax = _load_field( + _doc.get("coresMax"), + union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("dockerLoad") + lc=_doc.get("coresMax") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerLoad`": + if str(e) == "missing required field `coresMax`": _errors__.append( ValidationException( str(e), @@ -16242,13 +16140,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerLoad") + val = _doc.get("coresMax") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerLoad` field is not valid because:", - SourceLine(_doc, "dockerLoad", str), + "the `coresMax` field is not valid because:", + SourceLine(_doc, "coresMax", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16260,28 +16158,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerLoad` field is not valid because:", - SourceLine(_doc, "dockerLoad", str), + "the `coresMax` field is not valid because:", + SourceLine(_doc, "coresMax", str), [e], - detailed_message=f"the `dockerLoad` field with value `{val}` " + detailed_message=f"the `coresMax` field with value `{val}` " "is not valid because:", ) ) - dockerFile = None - if "dockerFile" in _doc: + ramMin = None + if "ramMin" in _doc: try: - dockerFile = load_field( - _doc.get("dockerFile"), - union_of_None_type_or_strtype, + ramMin = _load_field( + _doc.get("ramMin"), + union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("dockerFile") + lc=_doc.get("ramMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerFile`": + if str(e) == "missing required field `ramMin`": _errors__.append( ValidationException( str(e), @@ -16289,13 +16187,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerFile") + val = _doc.get("ramMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerFile` field is not valid because:", - SourceLine(_doc, "dockerFile", str), + "the `ramMin` field is not valid because:", + SourceLine(_doc, "ramMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16307,28 +16205,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerFile` field is not valid because:", - SourceLine(_doc, "dockerFile", str), + "the `ramMin` field is not valid because:", + SourceLine(_doc, "ramMin", str), [e], - detailed_message=f"the `dockerFile` field with value `{val}` " + detailed_message=f"the `ramMin` field with value `{val}` " "is not valid because:", ) ) - dockerImport = None - if "dockerImport" in _doc: + ramMax = None + if "ramMax" in _doc: try: - dockerImport = load_field( - _doc.get("dockerImport"), - union_of_None_type_or_strtype, + ramMax = _load_field( + _doc.get("ramMax"), + union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("dockerImport") + lc=_doc.get("ramMax") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerImport`": + if str(e) == "missing required field `ramMax`": _errors__.append( ValidationException( str(e), @@ -16336,13 +16234,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerImport") + val = _doc.get("ramMax") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerImport` field is not valid because:", - SourceLine(_doc, "dockerImport", str), + "the `ramMax` field is not valid because:", + SourceLine(_doc, "ramMax", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16354,28 +16252,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerImport` field is not valid because:", - SourceLine(_doc, "dockerImport", str), + "the `ramMax` field is not valid because:", + SourceLine(_doc, "ramMax", str), [e], - detailed_message=f"the `dockerImport` field with value `{val}` " + detailed_message=f"the `ramMax` field with value `{val}` " "is not valid because:", ) ) - dockerImageId = None - if "dockerImageId" in _doc: + tmpdirMin = None + if "tmpdirMin" in _doc: try: - dockerImageId = load_field( - _doc.get("dockerImageId"), - union_of_None_type_or_strtype, + tmpdirMin = _load_field( + _doc.get("tmpdirMin"), + union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("dockerImageId") + lc=_doc.get("tmpdirMin") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerImageId`": + if str(e) == "missing required field `tmpdirMin`": _errors__.append( ValidationException( str(e), @@ -16383,13 +16281,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerImageId") + val = _doc.get("tmpdirMin") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerImageId` field is not valid because:", - SourceLine(_doc, "dockerImageId", str), + "the `tmpdirMin` field is not valid because:", + SourceLine(_doc, "tmpdirMin", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16401,28 +16299,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerImageId` field is not valid because:", - SourceLine(_doc, "dockerImageId", str), + "the `tmpdirMin` field is not valid because:", + SourceLine(_doc, "tmpdirMin", str), [e], - detailed_message=f"the `dockerImageId` field with value `{val}` " + detailed_message=f"the `tmpdirMin` field with value `{val}` " "is not valid because:", ) ) - dockerOutputDirectory = None - if "dockerOutputDirectory" in _doc: + tmpdirMax = None + if "tmpdirMax" in _doc: try: - dockerOutputDirectory = load_field( - _doc.get("dockerOutputDirectory"), - union_of_None_type_or_strtype, + tmpdirMax = _load_field( + _doc.get("tmpdirMax"), + union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("dockerOutputDirectory") + lc=_doc.get("tmpdirMax") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `dockerOutputDirectory`": + if str(e) == "missing required field `tmpdirMax`": _errors__.append( ValidationException( str(e), @@ -16430,13 +16328,13 @@ def fromDoc( ) ) else: - val = _doc.get("dockerOutputDirectory") + val = _doc.get("tmpdirMax") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `dockerOutputDirectory` field is not valid because:", - SourceLine(_doc, "dockerOutputDirectory", str), + "the `tmpdirMax` field is not valid because:", + SourceLine(_doc, "tmpdirMax", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16448,10 +16346,104 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `dockerOutputDirectory` field is not valid because:", - SourceLine(_doc, "dockerOutputDirectory", str), + "the `tmpdirMax` field is not valid because:", + SourceLine(_doc, "tmpdirMax", str), [e], - detailed_message=f"the `dockerOutputDirectory` field with value `{val}` " + detailed_message=f"the `tmpdirMax` field with value `{val}` " + "is not valid because:", + ) + ) + outdirMin = None + if "outdirMin" in _doc: + try: + outdirMin = _load_field( + _doc.get("outdirMin"), + union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("outdirMin") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outdirMin`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outdirMin") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outdirMin` field is not valid because:", + SourceLine(_doc, "outdirMin", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outdirMin` field is not valid because:", + SourceLine(_doc, "outdirMin", str), + [e], + detailed_message=f"the `outdirMin` field with value `{val}` " + "is not valid because:", + ) + ) + outdirMax = None + if "outdirMax" in _doc: + try: + outdirMax = _load_field( + _doc.get("outdirMax"), + union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("outdirMax") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `outdirMax`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("outdirMax") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `outdirMax` field is not valid because:", + SourceLine(_doc, "outdirMax", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `outdirMax` field is not valid because:", + SourceLine(_doc, "outdirMax", str), + [e], + detailed_message=f"the `outdirMax` field with value `{val}` " "is not valid because:", ) ) @@ -16463,14 +16455,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `dockerPull`, `dockerLoad`, `dockerFile`, `dockerImport`, `dockerImageId`, `dockerOutputDirectory`".format( + "invalid field `{}`, expected one of: `class`, `coresMin`, `coresMax`, `ramMin`, `ramMax`, `tmpdirMin`, `tmpdirMax`, `outdirMin`, `outdirMax`".format( k ), SourceLine(_doc, k, str), @@ -16480,12 +16472,14 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - dockerPull=dockerPull, - dockerLoad=dockerLoad, - dockerFile=dockerFile, - dockerImport=dockerImport, - dockerImageId=dockerImageId, - dockerOutputDirectory=dockerOutputDirectory, + coresMin=coresMin, + coresMax=coresMax, + ramMin=ramMin, + ramMax=ramMax, + tmpdirMin=tmpdirMin, + tmpdirMax=tmpdirMax, + outdirMin=outdirMin, + outdirMax=outdirMax, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -16503,51 +16497,55 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.dockerPull is not None: - r["dockerPull"] = save( - self.dockerPull, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.coresMin is not None: + r["coresMin"] = save( + self.coresMin, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.dockerLoad is not None: - r["dockerLoad"] = save( - self.dockerLoad, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.coresMax is not None: + r["coresMax"] = save( + self.coresMax, top=False, base_url=base_url, relative_uris=relative_uris ) - if self.dockerFile is not None: - r["dockerFile"] = save( - self.dockerFile, + if self.ramMin is not None: + r["ramMin"] = save( + self.ramMin, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.ramMax is not None: + r["ramMax"] = save( + self.ramMax, top=False, base_url=base_url, relative_uris=relative_uris + ) + if self.tmpdirMin is not None: + r["tmpdirMin"] = save( + self.tmpdirMin, top=False, base_url=base_url, relative_uris=relative_uris, ) - if self.dockerImport is not None: - r["dockerImport"] = save( - self.dockerImport, + if self.tmpdirMax is not None: + r["tmpdirMax"] = save( + self.tmpdirMax, top=False, base_url=base_url, relative_uris=relative_uris, ) - if self.dockerImageId is not None: - r["dockerImageId"] = save( - self.dockerImageId, + if self.outdirMin is not None: + r["outdirMin"] = save( + self.outdirMin, top=False, base_url=base_url, relative_uris=relative_uris, ) - if self.dockerOutputDirectory is not None: - r["dockerOutputDirectory"] = save( - self.dockerOutputDirectory, + if self.outdirMax is not None: + r["outdirMax"] = save( + self.outdirMax, top=False, base_url=base_url, relative_uris=relative_uris, @@ -16563,12 +16561,14 @@ def save( def __init__( self, - dockerPull: None | str = None, - dockerLoad: None | str = None, - dockerFile: None | str = None, - dockerImport: None | str = None, - dockerImageId: None | str = None, - dockerOutputDirectory: None | str = None, + coresMin: None | float | i32 | i64 | str = None, + coresMax: None | float | i32 | i64 | str = None, + ramMin: None | float | i32 | i64 | str = None, + ramMax: None | float | i32 | i64 | str = None, + tmpdirMin: None | float | i32 | i64 | str = None, + tmpdirMax: None | float | i32 | i64 | str = None, + outdirMin: None | float | i32 | i64 | str = None, + outdirMax: None | float | i32 | i64 | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -16580,42 +16580,49 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "DockerRequirement" - self.dockerPull = dockerPull - self.dockerLoad = dockerLoad - self.dockerFile = dockerFile - self.dockerImport = dockerImport - self.dockerImageId = dockerImageId - self.dockerOutputDirectory = dockerOutputDirectory + self.class_: Final[str] = "ResourceRequirement" + self.coresMin = coresMin + self.coresMax = coresMax + self.ramMin = ramMin + self.ramMax = ramMax + self.tmpdirMin = tmpdirMin + self.tmpdirMax = tmpdirMax + self.outdirMin = outdirMin + self.outdirMax = outdirMax attrs: ClassVar[Collection[str]] = frozenset( [ "class", - "dockerPull", - "dockerLoad", - "dockerFile", - "dockerImport", - "dockerImageId", - "dockerOutputDirectory", + "coresMin", + "coresMax", + "ramMin", + "ramMax", + "tmpdirMin", + "tmpdirMax", + "outdirMin", + "outdirMax", ] ) @mypyc_attr(native_class=True) -class SoftwareRequirement(Saveable): +class WorkReuse(Saveable): """ - A list of software packages that should be configured in the environment of - the defined process. + For implementations that support reusing output from past work (on the assumption that same code and same input produce same results), control whether to enable or disable the reuse behavior for a particular tool or step (to accommodate situations where that assumption is incorrect). A reused step is not executed but instead returns the same output as the original execution. + + If ``WorkReuse`` is not specified, correct tools should assume it is enabled by default. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, SoftwareRequirement): - return bool(self.class_ == other.class_ and self.packages == other.packages) + if isinstance(other, WorkReuse): + return bool( + self.class_ == other.class_ and self.enableReuse == other.enableReuse + ) return False def __hash__(self) -> int: - return hash((self.class_, self.packages)) + return hash((self.class_, self.enableReuse)) @classmethod def fromDoc( @@ -16635,34 +16642,35 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_SoftwareRequirement_classLoader_False_True_None_None, + uri_WorkReuse_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e try: - if _doc.get("packages") is None: - raise ValidationException("missing required field `packages`", None, []) + if _doc.get("enableReuse") is None: + raise ValidationException("missing required field `enableReuse`", None, []) - packages = load_field( - _doc.get("packages"), - idmap_packages_array_of_SoftwarePackageLoader, + enableReuse = _load_field( + _doc.get("enableReuse"), + union_of_booltype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("packages") + lc=_doc.get("enableReuse") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `packages`": + if str(e) == "missing required field `enableReuse`": _errors__.append( ValidationException( str(e), @@ -16670,13 +16678,13 @@ def fromDoc( ) ) else: - val = _doc.get("packages") + val = _doc.get("enableReuse") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `packages` field is not valid because:", - SourceLine(_doc, "packages", str), + "the `enableReuse` field is not valid because:", + SourceLine(_doc, "enableReuse", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16688,10 +16696,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `packages` field is not valid because:", - SourceLine(_doc, "packages", str), + "the `enableReuse` field is not valid because:", + SourceLine(_doc, "enableReuse", str), [e], - detailed_message=f"the `packages` field with value `{val}` " + detailed_message=f"the `enableReuse` field with value `{val}` " "is not valid because:", ) ) @@ -16703,14 +16711,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `packages`".format( + "invalid field `{}`, expected one of: `class`, `enableReuse`".format( k ), SourceLine(_doc, k, str), @@ -16720,7 +16728,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - packages=packages, + enableReuse=enableReuse, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -16738,16 +16746,21 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.packages is not None: - r["packages"] = save( - self.packages, top=False, base_url=base_url, relative_uris=relative_uris + if self.enableReuse is not None: + r["enableReuse"] = save( + self.enableReuse, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -16760,7 +16773,7 @@ def save( def __init__( self, - packages: Sequence[SoftwarePackage], + enableReuse: bool | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -16772,25 +16785,35 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SoftwareRequirement" - self.packages = packages + self.class_: Final[str] = "WorkReuse" + self.enableReuse = enableReuse - attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"]) + attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) @mypyc_attr(native_class=True) -class SoftwarePackage(Saveable): +class NetworkAccess(Saveable): + """ + Indicate whether a process requires outgoing IPv4/IPv6 network access. Choice of IPv4 or IPv6 is implementation and site specific, correct tools must support both. + + If ``networkAccess`` is false or not specified, tools must not assume network access, except for localhost (the loopback device). + + If ``networkAccess`` is true, the tool must be able to make outgoing connections to network resources. Resources may be on a private subnet or the public Internet. However, implementations and sites may apply their own security policies to restrict what is accessible by the tool. + + Enabling network access does not imply a publicly routable IP address or the ability to accept inbound connections. + + """ + def __eq__(self, other: Any) -> bool: - if isinstance(other, SoftwarePackage): + if isinstance(other, NetworkAccess): return bool( - self.package == other.package - and self.version == other.version - and self.specs == other.specs + self.class_ == other.class_ + and self.networkAccess == other.networkAccess ) return False def __hash__(self) -> int: - return hash((self.package, self.version, self.specs)) + return hash((self.class_, self.networkAccess)) @classmethod def fromDoc( @@ -16807,21 +16830,38 @@ def fromDoc( _doc.lc.filename = doc.lc.filename _errors__ = [] try: - if _doc.get("package") is None: - raise ValidationException("missing required field `package`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - package = load_field( - _doc.get("package"), - strtype, + class_ = _load_field( + _doc.get("class"), + uri_NetworkAccess_classLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("package") + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + try: + if _doc.get("networkAccess") is None: + raise ValidationException("missing required field `networkAccess`", None, []) + + networkAccess = _load_field( + _doc.get("networkAccess"), + union_of_booltype_or_ExpressionLoader, + baseuri, + loadingOptions, + lc=_doc.get("networkAccess") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `package`": + if str(e) == "missing required field `networkAccess`": _errors__.append( ValidationException( str(e), @@ -16829,13 +16869,13 @@ def fromDoc( ) ) else: - val = _doc.get("package") + val = _doc.get("networkAccess") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `package` field is not valid because:", - SourceLine(_doc, "package", str), + "the `networkAccess` field is not valid because:", + SourceLine(_doc, "networkAccess", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -16847,107 +16887,13 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `package` field is not valid because:", - SourceLine(_doc, "package", str), + "the `networkAccess` field is not valid because:", + SourceLine(_doc, "networkAccess", str), [e], - detailed_message=f"the `package` field with value `{val}` " + detailed_message=f"the `networkAccess` field with value `{val}` " "is not valid because:", ) ) - version = None - if "version" in _doc: - try: - version = load_field( - _doc.get("version"), - union_of_None_type_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("version") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `version`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("version") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `version` field is not valid because:", - SourceLine(_doc, "version", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `version` field is not valid because:", - SourceLine(_doc, "version", str), - [e], - detailed_message=f"the `version` field with value `{val}` " - "is not valid because:", - ) - ) - specs = None - if "specs" in _doc: - try: - specs = load_field( - _doc.get("specs"), - uri_union_of_None_type_or_array_of_strtype_False_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("specs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `specs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("specs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `specs` field is not valid because:", - SourceLine(_doc, "specs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `specs` field is not valid because:", - SourceLine(_doc, "specs", str), - [e], - detailed_message=f"the `specs` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -16956,14 +16902,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `package`, `version`, `specs`".format( + "invalid field `{}`, expected one of: `class`, `networkAccess`".format( k ), SourceLine(_doc, k, str), @@ -16973,9 +16919,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - package=package, - version=version, - specs=specs, + networkAccess=networkAccess, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -16992,17 +16936,23 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.package is not None: - r["package"] = save( - self.package, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.version is not None: - r["version"] = save( - self.version, top=False, base_url=base_url, relative_uris=relative_uris + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.networkAccess is not None: + r["networkAccess"] = save( + self.networkAccess, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) - if self.specs is not None: - u = save_relative_uri(self.specs, base_url, False, None, relative_uris) - r["specs"] = u # top refers to the directory level if top: @@ -17014,9 +16964,7 @@ def save( def __init__( self, - package: str, - version: None | Sequence[str] = None, - specs: None | Sequence[str] = None, + networkAccess: bool | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17028,38 +16976,37 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.package = package - self.version = version - self.specs = specs + self.class_: Final[str] = "NetworkAccess" + self.networkAccess = networkAccess - attrs: ClassVar[Collection[str]] = frozenset(["package", "version", "specs"]) + attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) @mypyc_attr(native_class=True) -class Dirent(Saveable): +class InplaceUpdateRequirement(Saveable): """ - Define a file or subdirectory that must be staged to a particular - place prior to executing the command line tool. May be the result - of executing an expression, such as building a configuration file - from a template. + If ``inplaceUpdate`` is true, then an implementation supporting this feature may permit tools to directly update files with ``writable: true`` in InitialWorkDirRequirement. That is, as an optimization, files may be destructively modified in place as opposed to copied and updated. + + An implementation must ensure that only one workflow step may access a writable file at a time. It is an error if a file which is writable by one workflow step file is accessed (for reading or writing) by any other workflow step running independently. However, a file which has been updated in a previous completed step may be used as input to multiple steps, provided it is read-only in every step. - Usually files are staged within the [designated output directory](#Runtime_environment). - However, under certain circumstances, files may be staged at - arbitrary locations, see discussion for `entryname`. + Workflow steps which modify a file must produce the modified file as output. Downstream steps which further process the file must use the output of previous steps, and not refer to a common input (this is necessary for both ordering and correctness). + + Workflow authors should provide this in the ``hints`` section. The intent of this feature is that workflows produce the same results whether or not InplaceUpdateRequirement is supported by the implementation, and this feature is primarily available as an optimization for particular environments. + + Users and implementers should be aware that workflows that destructively modify inputs may not be repeatable or reproducible. In particular, enabling this feature implies that WorkReuse should not be enabled. """ def __eq__(self, other: Any) -> bool: - if isinstance(other, Dirent): + if isinstance(other, InplaceUpdateRequirement): return bool( - self.entryname == other.entryname - and self.entry == other.entry - and self.writable == other.writable + self.class_ == other.class_ + and self.inplaceUpdate == other.inplaceUpdate ) return False def __hash__(self) -> int: - return hash((self.entryname, self.entry, self.writable)) + return hash((self.class_, self.inplaceUpdate)) @classmethod def fromDoc( @@ -17075,69 +17022,39 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - entryname = None - if "entryname" in _doc: - try: - entryname = load_field( - _doc.get("entryname"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("entryname") - ) + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + class_ = _load_field( + _doc.get("class"), + uri_InplaceUpdateRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) - if str(e) == "missing required field `entryname`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("entryname") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `entryname` field is not valid because:", - SourceLine(_doc, "entryname", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `entryname` field is not valid because:", - SourceLine(_doc, "entryname", str), - [e], - detailed_message=f"the `entryname` field with value `{val}` " - "is not valid because:", - ) - ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e try: - if _doc.get("entry") is None: - raise ValidationException("missing required field `entry`", None, []) + if _doc.get("inplaceUpdate") is None: + raise ValidationException("missing required field `inplaceUpdate`", None, []) - entry = load_field( - _doc.get("entry"), - union_of_strtype_or_ExpressionLoader, + inplaceUpdate = _load_field( + _doc.get("inplaceUpdate"), + booltype, baseuri, loadingOptions, - lc=_doc.get("entry") + lc=_doc.get("inplaceUpdate") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `entry`": + if str(e) == "missing required field `inplaceUpdate`": _errors__.append( ValidationException( str(e), @@ -17145,13 +17062,13 @@ def fromDoc( ) ) else: - val = _doc.get("entry") + val = _doc.get("inplaceUpdate") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `entry` field is not valid because:", - SourceLine(_doc, "entry", str), + "the `inplaceUpdate` field is not valid because:", + SourceLine(_doc, "inplaceUpdate", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17163,60 +17080,13 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `entry` field is not valid because:", - SourceLine(_doc, "entry", str), + "the `inplaceUpdate` field is not valid because:", + SourceLine(_doc, "inplaceUpdate", str), [e], - detailed_message=f"the `entry` field with value `{val}` " + detailed_message=f"the `inplaceUpdate` field with value `{val}` " "is not valid because:", ) ) - writable = None - if "writable" in _doc: - try: - writable = load_field( - _doc.get("writable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("writable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `writable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("writable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `writable` field is not valid because:", - SourceLine(_doc, "writable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `writable` field is not valid because:", - SourceLine(_doc, "writable", str), - [e], - detailed_message=f"the `writable` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -17225,14 +17095,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `entryname`, `entry`, `writable`".format( + "invalid field `{}`, expected one of: `class`, `inplaceUpdate`".format( k ), SourceLine(_doc, k, str), @@ -17242,9 +17112,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - entryname=entryname, - entry=entry, - writable=writable, + inplaceUpdate=inplaceUpdate, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -17261,21 +17129,23 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.entryname is not None: - r["entryname"] = save( - self.entryname, + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + if self.inplaceUpdate is not None: + r["inplaceUpdate"] = save( + self.inplaceUpdate, top=False, base_url=base_url, relative_uris=relative_uris, ) - if self.entry is not None: - r["entry"] = save( - self.entry, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.writable is not None: - r["writable"] = save( - self.writable, top=False, base_url=base_url, relative_uris=relative_uris - ) # top refers to the directory level if top: @@ -17287,9 +17157,7 @@ def save( def __init__( self, - entry: str, - entryname: None | str = None, - writable: None | bool = None, + inplaceUpdate: bool, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17301,27 +17169,28 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.entryname = entryname - self.entry = entry - self.writable = writable + self.class_: Final[str] = "InplaceUpdateRequirement" + self.inplaceUpdate = inplaceUpdate - attrs: ClassVar[Collection[str]] = frozenset(["entryname", "entry", "writable"]) + attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) @mypyc_attr(native_class=True) -class InitialWorkDirRequirement(Saveable): +class ToolTimeLimit(Saveable): """ - Define a list of files and subdirectories that must be staged by the workflow platform prior to executing the command line tool. - Normally files are staged within the designated output directory. However, when running inside containers, files may be staged at arbitrary locations, see discussion for [`Dirent.entryname`](#Dirent). Together with `DockerRequirement.dockerOutputDirectory` it is possible to control the locations of both input and output files when running in containers. + Set an upper limit on the execution time of a CommandLineTool. A CommandLineTool whose execution duration exceeds the time limit may be preemptively terminated and considered failed. May also be used by batch systems to make scheduling decisions. The execution duration excludes external operations, such as staging of files, pulling a docker image etc, and only counts wall-time for the execution of the command line itself. + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, InitialWorkDirRequirement): - return bool(self.class_ == other.class_ and self.listing == other.listing) + if isinstance(other, ToolTimeLimit): + return bool( + self.class_ == other.class_ and self.timelimit == other.timelimit + ) return False def __hash__(self) -> int: - return hash((self.class_, self.listing)) + return hash((self.class_, self.timelimit)) @classmethod def fromDoc( @@ -17341,34 +17210,35 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_InitialWorkDirRequirement_classLoader_False_True_None_None, + uri_ToolTimeLimit_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e try: - if _doc.get("listing") is None: - raise ValidationException("missing required field `listing`", None, []) + if _doc.get("timelimit") is None: + raise ValidationException("missing required field `timelimit`", None, []) - listing = load_field( - _doc.get("listing"), - union_of_ExpressionLoader_or_array_of_union_of_None_type_or_DirentLoader_or_ExpressionLoader_or_FileLoader_or_DirectoryLoader_or_array_of_union_of_FileLoader_or_DirectoryLoader, + timelimit = _load_field( + _doc.get("timelimit"), + union_of_inttype_or_longtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("listing") + lc=_doc.get("timelimit") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `listing`": + if str(e) == "missing required field `timelimit`": _errors__.append( ValidationException( str(e), @@ -17376,13 +17246,13 @@ def fromDoc( ) ) else: - val = _doc.get("listing") + val = _doc.get("timelimit") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), + "the `timelimit` field is not valid because:", + SourceLine(_doc, "timelimit", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17394,10 +17264,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `listing` field is not valid because:", - SourceLine(_doc, "listing", str), + "the `timelimit` field is not valid because:", + SourceLine(_doc, "timelimit", str), [e], - detailed_message=f"the `listing` field with value `{val}` " + detailed_message=f"the `timelimit` field with value `{val}` " "is not valid because:", ) ) @@ -17409,14 +17279,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `listing`".format( + "invalid field `{}`, expected one of: `class`, `timelimit`".format( k ), SourceLine(_doc, k, str), @@ -17426,7 +17296,7 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - listing=listing, + timelimit=timelimit, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -17444,16 +17314,21 @@ def save( for ef in self.extension_fields: r[ef] = self.extension_fields[ef] if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.listing is not None: - r["listing"] = save( - self.listing, top=False, base_url=base_url, relative_uris=relative_uris + if self.timelimit is not None: + r["timelimit"] = save( + self.timelimit, + top=False, + base_url=base_url, + relative_uris=relative_uris, ) # top refers to the directory level @@ -17466,7 +17341,7 @@ def save( def __init__( self, - listing: Sequence[Directory | Dirent | File | None | Sequence[Directory | File] | str] | str, + timelimit: i32 | i64 | str, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17478,27 +17353,41 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InitialWorkDirRequirement" - self.listing = listing + self.class_: Final[str] = "ToolTimeLimit" + self.timelimit = timelimit - attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"]) + attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) @mypyc_attr(native_class=True) -class EnvVarRequirement(Saveable): - """ - Define a list of environment variables which will be set in the - execution environment of the tool. See `EnvironmentDef` for details. - - """ +class ExpressionToolOutputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, EnvVarRequirement): - return bool(self.class_ == other.class_ and self.envDef == other.envDef) + if isinstance(other, ExpressionToolOutputParameter): + return bool( + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format + and self.type_ == other.type_ + ) return False def __hash__(self) -> int: - return hash((self.class_, self.envDef)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.type_, + ) + ) @classmethod def fromDoc( @@ -17514,204 +17403,345 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_EnvVarRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("envDef") is None: - raise ValidationException("missing required field `envDef`", None, []) - - envDef = load_field( - _doc.get("envDef"), - idmap_envDef_array_of_EnvironmentDefLoader, - baseuri, - loadingOptions, - lc=_doc.get("envDef") - ) + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `envDef`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("envDef") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `id`": _errors__.append( ValidationException( - "the `envDef` field is not valid because:", - SourceLine(_doc, "envDef", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": _errors__.append( ValidationException( - "the `envDef` field is not valid because:", - SourceLine(_doc, "envDef", str), - [e], - detailed_message=f"the `envDef` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `secondaryFiles`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `envDef`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) + else: + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - envDef=envDef, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.envDef is not None: - r["envDef"] = save( - self.envDef, top=False, base_url=base_url, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - envDef: Sequence[EnvironmentDef], - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "EnvVarRequirement" - self.envDef = envDef - - attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"]) - - -@mypyc_attr(native_class=True) -class ShellCommandRequirement(Saveable): - """ - Modify the behavior of CommandLineTool to generate a single string - containing a shell command line. Each item in the `arguments` list must - be joined into a string separated by single spaces and quoted to prevent - interpretation by the shell, unless `CommandLineBinding` for that argument - contains `shellQuote: false`. If `shellQuote: false` is specified, the - argument is joined into the command string without quoting, which allows - the use of shell metacharacters such as `|` for pipes. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ShellCommandRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] + if str(e) == "missing required field `format`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - class_ = load_field( - _doc.get("class"), - uri_ShellCommandRequirement_classLoader_False_True_None_None, + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, - lc=_doc.get("class") + lc=_doc.get("type") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -17720,14 +17750,16 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`".format( + k + ), SourceLine(_doc, k, str), ) ) @@ -17735,9 +17767,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -17751,14 +17791,38 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -17770,6 +17834,13 @@ def save( def __init__( self, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -17781,69 +17852,54 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ShellCommandRequirement" + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ - attrs: ClassVar[Collection[str]] = frozenset(["class"]) + attrs: ClassVar[Collection[str]] = frozenset( + ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] + ) @mypyc_attr(native_class=True) -class ResourceRequirement(Saveable): - """ - Specify basic hardware resource requirements. - - "min" is the minimum amount of a resource that must be reserved to - schedule a job. If "min" cannot be satisfied, the job should not - be run. - - "max" is the maximum amount of a resource that the job shall be - allocated. If a node has sufficient resources, multiple jobs may - be scheduled on a single node provided each job's "max" resource - requirements are met. If a job attempts to exceed its resource - allocation, an implementation may deny additional resources, which - may result in job failure. - - If both "min" and "max" are specified, an implementation may - choose to allocate any amount between "min" and "max", with the - actual allocation provided in the `runtime` object. - - If "min" is specified but "max" is not, then "max" == "min" - If "max" is specified by "min" is not, then "min" == "max". - - It is an error if max < min. - - It is an error if the value of any of these fields is negative. - - If neither "min" nor "max" is specified for a resource, use the default values below. - - """ +class WorkflowInputParameter(Saveable): + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, ResourceRequirement): + if isinstance(other, WorkflowInputParameter): return bool( - self.class_ == other.class_ - and self.coresMin == other.coresMin - and self.coresMax == other.coresMax - and self.ramMin == other.ramMin - and self.ramMax == other.ramMax - and self.tmpdirMin == other.tmpdirMin - and self.tmpdirMax == other.tmpdirMax - and self.outdirMin == other.outdirMin - and self.outdirMax == other.outdirMax + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.default == other.default + and self.type_ == other.type_ + and self.inputBinding == other.inputBinding ) return False def __hash__(self) -> int: return hash( ( - self.class_, - self.coresMin, - self.coresMax, - self.ramMin, - self.ramMax, - self.tmpdirMin, - self.tmpdirMax, - self.outdirMin, - self.outdirMax, + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.loadContents, + self.loadListing, + self.default, + self.type_, + self.inputBinding, ) ) @@ -17861,37 +17917,21 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ResourceRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - coresMin = None - if "coresMin" in _doc: + id = None + if "id" in _doc: try: - coresMin = load_field( - _doc.get("coresMin"), - union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, baseuri, loadingOptions, - lc=_doc.get("coresMin") + lc=_doc.get("id") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `coresMin`": + if str(e) == "missing required field `id`": _errors__.append( ValidationException( str(e), @@ -17899,13 +17939,13 @@ def fromDoc( ) ) else: - val = _doc.get("coresMin") + val = _doc.get("id") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `coresMin` field is not valid because:", - SourceLine(_doc, "coresMin", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17917,28 +17957,37 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `coresMin` field is not valid because:", - SourceLine(_doc, "coresMin", str), + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), [e], - detailed_message=f"the `coresMin` field with value `{val}` " + detailed_message=f"the `id` field with value `{val}` " "is not valid because:", ) ) - coresMax = None - if "coresMax" in _doc: + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: try: - coresMax = load_field( - _doc.get("coresMax"), - union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("coresMax") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `coresMax`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -17946,13 +17995,13 @@ def fromDoc( ) ) else: - val = _doc.get("coresMax") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `coresMax` field is not valid because:", - SourceLine(_doc, "coresMax", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -17964,28 +18013,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `coresMax` field is not valid because:", - SourceLine(_doc, "coresMax", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `coresMax` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - ramMin = None - if "ramMin" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - ramMin = load_field( - _doc.get("ramMin"), - union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("ramMin") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `ramMin`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -17993,13 +18042,13 @@ def fromDoc( ) ) else: - val = _doc.get("ramMin") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `ramMin` field is not valid because:", - SourceLine(_doc, "ramMin", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18011,28 +18060,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `ramMin` field is not valid because:", - SourceLine(_doc, "ramMin", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `ramMin` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - ramMax = None - if "ramMax" in _doc: + streamable = None + if "streamable" in _doc: try: - ramMax = load_field( - _doc.get("ramMax"), - union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("ramMax") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `ramMax`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -18040,13 +18089,13 @@ def fromDoc( ) ) else: - val = _doc.get("ramMax") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `ramMax` field is not valid because:", - SourceLine(_doc, "ramMax", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18058,28 +18107,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `ramMax` field is not valid because:", - SourceLine(_doc, "ramMax", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `ramMax` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - tmpdirMin = None - if "tmpdirMin" in _doc: + doc = None + if "doc" in _doc: try: - tmpdirMin = load_field( - _doc.get("tmpdirMin"), - union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("tmpdirMin") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `tmpdirMin`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -18087,13 +18136,13 @@ def fromDoc( ) ) else: - val = _doc.get("tmpdirMin") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `tmpdirMin` field is not valid because:", - SourceLine(_doc, "tmpdirMin", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18105,28 +18154,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `tmpdirMin` field is not valid because:", - SourceLine(_doc, "tmpdirMin", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `tmpdirMin` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - tmpdirMax = None - if "tmpdirMax" in _doc: + format = None + if "format" in _doc: try: - tmpdirMax = load_field( - _doc.get("tmpdirMax"), - union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, baseuri, loadingOptions, - lc=_doc.get("tmpdirMax") + lc=_doc.get("format") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `tmpdirMax`": + if str(e) == "missing required field `format`": _errors__.append( ValidationException( str(e), @@ -18134,13 +18183,13 @@ def fromDoc( ) ) else: - val = _doc.get("tmpdirMax") + val = _doc.get("format") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `tmpdirMax` field is not valid because:", - SourceLine(_doc, "tmpdirMax", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18152,28 +18201,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `tmpdirMax` field is not valid because:", - SourceLine(_doc, "tmpdirMax", str), + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), [e], - detailed_message=f"the `tmpdirMax` field with value `{val}` " + detailed_message=f"the `format` field with value `{val}` " "is not valid because:", ) ) - outdirMin = None - if "outdirMin" in _doc: + loadContents = None + if "loadContents" in _doc: try: - outdirMin = load_field( - _doc.get("outdirMin"), - union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("outdirMin") + lc=_doc.get("loadContents") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outdirMin`": + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( str(e), @@ -18181,13 +18230,13 @@ def fromDoc( ) ) else: - val = _doc.get("outdirMin") + val = _doc.get("loadContents") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outdirMin` field is not valid because:", - SourceLine(_doc, "outdirMin", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18199,28 +18248,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outdirMin` field is not valid because:", - SourceLine(_doc, "outdirMin", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [e], - detailed_message=f"the `outdirMin` field with value `{val}` " + detailed_message=f"the `loadContents` field with value `{val}` " "is not valid because:", ) ) - outdirMax = None - if "outdirMax" in _doc: + loadListing = None + if "loadListing" in _doc: try: - outdirMax = load_field( - _doc.get("outdirMax"), - union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader, + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, baseuri, loadingOptions, - lc=_doc.get("outdirMax") + lc=_doc.get("loadListing") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outdirMax`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -18228,13 +18277,13 @@ def fromDoc( ) ) else: - val = _doc.get("outdirMax") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outdirMax` field is not valid because:", - SourceLine(_doc, "outdirMax", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18246,10 +18295,152 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outdirMax` field is not valid because:", - SourceLine(_doc, "outdirMax", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `outdirMax` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " + "is not valid because:", + ) + ) + default = None + if "default" in _doc: + try: + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, + baseuri, + loadingOptions, + lc=_doc.get("default") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `default`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("default") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), + [e], + detailed_message=f"the `default` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) + + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, + baseuri, + loadingOptions, + lc=_doc.get("type") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", + ) + ) + inputBinding = None + if "inputBinding" in _doc: + try: + inputBinding = _load_field( + _doc.get("inputBinding"), + union_of_None_type_or_InputBindingLoader, + baseuri, + loadingOptions, + lc=_doc.get("inputBinding") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputBinding`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputBinding") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputBinding` field is not valid because:", + SourceLine(_doc, "inputBinding", str), + [e], + detailed_message=f"the `inputBinding` field with value `{val}` " "is not valid because:", ) ) @@ -18261,14 +18452,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `coresMin`, `coresMax`, `ramMin`, `ramMax`, `tmpdirMin`, `tmpdirMax`, `outdirMin`, `outdirMax`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`, `inputBinding`".format( k ), SourceLine(_doc, k, str), @@ -18278,17 +18469,21 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - coresMin=coresMin, - coresMax=coresMax, - ramMin=ramMin, - ramMax=ramMax, - tmpdirMin=tmpdirMin, - tmpdirMax=tmpdirMax, - outdirMin=outdirMin, - outdirMax=outdirMax, + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + loadContents=loadContents, + loadListing=loadListing, + default=default, + type_=type_, + inputBinding=inputBinding, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -18302,56 +18497,61 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.coresMin is not None: - r["coresMin"] = save( - self.coresMin, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.coresMax is not None: - r["coresMax"] = save( - self.coresMax, top=False, base_url=base_url, relative_uris=relative_uris - ) - if self.ramMin is not None: - r["ramMin"] = save( - self.ramMin, top=False, base_url=base_url, relative_uris=relative_uris + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.ramMax is not None: - r["ramMax"] = save( - self.ramMax, top=False, base_url=base_url, relative_uris=relative_uris + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) - if self.tmpdirMin is not None: - r["tmpdirMin"] = save( - self.tmpdirMin, + if self.streamable is not None: + r["streamable"] = save( + self.streamable, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.tmpdirMax is not None: - r["tmpdirMax"] = save( - self.tmpdirMax, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.outdirMin is not None: - r["outdirMin"] = save( - self.outdirMin, + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.outdirMax is not None: - r["outdirMax"] = save( - self.outdirMax, + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.inputBinding is not None: + r["inputBinding"] = save( + self.inputBinding, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) @@ -18365,74 +18565,99 @@ def save( def __init__( self, - coresMin: None | float | i32 | str = None, - coresMax: None | float | i32 | str = None, - ramMin: None | float | i32 | str = None, - ramMax: None | float | i32 | str = None, - tmpdirMin: None | float | i32 | str = None, - tmpdirMax: None | float | i32 | str = None, - outdirMin: None | float | i32 | str = None, - outdirMax: None | float | i32 | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: + id: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, + inputBinding: InputBinding | None = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ResourceRequirement" - self.coresMin = coresMin - self.coresMax = coresMax - self.ramMin = ramMin - self.ramMax = ramMax - self.tmpdirMin = tmpdirMin - self.tmpdirMax = tmpdirMax - self.outdirMin = outdirMin - self.outdirMax = outdirMax + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ + self.inputBinding = inputBinding attrs: ClassVar[Collection[str]] = frozenset( [ - "class", - "coresMin", - "coresMax", - "ramMin", - "ramMax", - "tmpdirMin", - "tmpdirMax", - "outdirMin", - "outdirMax", + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "loadContents", + "loadListing", + "default", + "type", + "inputBinding", ] ) @mypyc_attr(native_class=True) -class WorkReuse(Saveable): +class ExpressionTool(Saveable): """ - For implementations that support reusing output from past work (on - the assumption that same code and same input produce same - results), control whether to enable or disable the reuse behavior - for a particular tool or step (to accommodate situations where that - assumption is incorrect). A reused step is not executed but - instead returns the same output as the original execution. - - If `WorkReuse` is not specified, correct tools should assume it - is enabled by default. + An ExpressionTool is a type of Process object that can be run by itself or as a Workflow step. It executes a pure Javascript expression that has access to the same input parameters as a workflow. It is meant to be used sparingly as a way to isolate complex Javascript expressions that need to operate on input data and produce some result; perhaps just a rearrangement of the inputs. No Docker software container is required or allowed. """ + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkReuse): + if isinstance(other, ExpressionTool): return bool( - self.class_ == other.class_ and self.enableReuse == other.enableReuse + self.id == other.id + and self.label == other.label + and self.doc == other.doc + and self.inputs == other.inputs + and self.outputs == other.outputs + and self.requirements == other.requirements + and self.hints == other.hints + and self.cwlVersion == other.cwlVersion + and self.intent == other.intent + and self.class_ == other.class_ + and self.expression == other.expression ) return False def __hash__(self) -> int: - return hash((self.class_, self.enableReuse)) + return hash( + ( + self.id, + self.label, + self.doc, + self.inputs, + self.outputs, + self.requirements, + self.hints, + self.cwlVersion, + self.intent, + self.class_, + self.expression, + ) + ) @classmethod def fromDoc( @@ -18448,38 +18673,188 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "_:" + str(_uuid__.uuid4()) + else: + baseuri = id try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_WorkReuse_classLoader_False_True_None_None, + uri_ExpressionTool_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("enableReuse") is None: - raise ValidationException("missing required field `enableReuse`", None, []) + if _doc.get("inputs") is None: + raise ValidationException("missing required field `inputs`", None, []) - enableReuse = load_field( - _doc.get("enableReuse"), - union_of_booltype_or_ExpressionLoader, + inputs = _load_field( + _doc.get("inputs"), + idmap_inputs_array_of_WorkflowInputParameterLoader, baseuri, loadingOptions, - lc=_doc.get("enableReuse") + lc=_doc.get("inputs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `enableReuse`": + if str(e) == "missing required field `inputs`": _errors__.append( ValidationException( str(e), @@ -18487,13 +18862,13 @@ def fromDoc( ) ) else: - val = _doc.get("enableReuse") + val = _doc.get("inputs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `enableReuse` field is not valid because:", - SourceLine(_doc, "enableReuse", str), + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18505,177 +18880,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `enableReuse` field is not valid because:", - SourceLine(_doc, "enableReuse", str), + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), [e], - detailed_message=f"the `enableReuse` field with value `{val}` " + detailed_message=f"the `inputs` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `enableReuse`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - enableReuse=enableReuse, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.enableReuse is not None: - r["enableReuse"] = save( - self.enableReuse, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - enableReuse: bool | str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "WorkReuse" - self.enableReuse = enableReuse - - attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"]) - - -@mypyc_attr(native_class=True) -class NetworkAccess(Saveable): - """ - Indicate whether a process requires outgoing IPv4/IPv6 network - access. Choice of IPv4 or IPv6 is implementation and site - specific, correct tools must support both. - - If `networkAccess` is false or not specified, tools must not - assume network access, except for localhost (the loopback device). - - If `networkAccess` is true, the tool must be able to make outgoing - connections to network resources. Resources may be on a private - subnet or the public Internet. However, implementations and sites - may apply their own security policies to restrict what is - accessible by the tool. - - Enabling network access does not imply a publicly routable IP - address or the ability to accept inbound connections. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, NetworkAccess): - return bool( - self.class_ == other.class_ - and self.networkAccess == other.networkAccess - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.networkAccess)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_NetworkAccess_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e try: - if _doc.get("networkAccess") is None: - raise ValidationException("missing required field `networkAccess`", None, []) + if _doc.get("outputs") is None: + raise ValidationException("missing required field `outputs`", None, []) - networkAccess = load_field( - _doc.get("networkAccess"), - union_of_booltype_or_ExpressionLoader, + outputs = _load_field( + _doc.get("outputs"), + idmap_outputs_array_of_ExpressionToolOutputParameterLoader, baseuri, loadingOptions, - lc=_doc.get("networkAccess") + lc=_doc.get("outputs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `networkAccess`": + if str(e) == "missing required field `outputs`": _errors__.append( ValidationException( str(e), @@ -18683,13 +18910,13 @@ def fromDoc( ) ) else: - val = _doc.get("networkAccess") + val = _doc.get("outputs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `networkAccess` field is not valid because:", - SourceLine(_doc, "networkAccess", str), + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18701,192 +18928,217 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `networkAccess` field is not valid because:", - SourceLine(_doc, "networkAccess", str), + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), [e], - detailed_message=f"the `networkAccess` field with value `{val}` " + detailed_message=f"the `outputs` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: + requirements = None + if "requirements" in _doc: + try: + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, + baseuri, + loadingOptions, + lc=_doc.get("requirements") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `requirements`": _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ValidationException( + str(e), + None + ) ) - extension_fields[ex] = _doc[k] else: + val = _doc.get("requirements") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [e], + detailed_message=f"the `requirements` field with value `{val}` " + "is not valid because:", + ) + ) + hints = None + if "hints" in _doc: + try: + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, + baseuri, + loadingOptions, + lc=_doc.get("hints") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `hints`": _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `networkAccess`".format( - k - ), - SourceLine(_doc, k, str), + str(e), + None ) ) + else: + val = _doc.get("hints") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), + [e], + detailed_message=f"the `hints` field with value `{val}` " + "is not valid because:", + ) + ) + cwlVersion = None + if "cwlVersion" in _doc: + try: + cwlVersion = _load_field( + _doc.get("cwlVersion"), + uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("cwlVersion") + ) - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - networkAccess=networkAccess, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.networkAccess is not None: - r["networkAccess"] = save( - self.networkAccess, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - networkAccess: bool | str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "NetworkAccess" - self.networkAccess = networkAccess - - attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"]) - - -@mypyc_attr(native_class=True) -class InplaceUpdateRequirement(Saveable): - """ - - If `inplaceUpdate` is true, then an implementation supporting this - feature may permit tools to directly update files with `writable: - true` in InitialWorkDirRequirement. That is, as an optimization, - files may be destructively modified in place as opposed to copied - and updated. - - An implementation must ensure that only one workflow step may - access a writable file at a time. It is an error if a file which - is writable by one workflow step file is accessed (for reading or - writing) by any other workflow step running independently. - However, a file which has been updated in a previous completed - step may be used as input to multiple steps, provided it is - read-only in every step. - - Workflow steps which modify a file must produce the modified file - as output. Downstream steps which further process the file must - use the output of previous steps, and not refer to a common input - (this is necessary for both ordering and correctness). - - Workflow authors should provide this in the `hints` section. The - intent of this feature is that workflows produce the same results - whether or not InplaceUpdateRequirement is supported by the - implementation, and this feature is primarily available as an - optimization for particular environments. - - Users and implementers should be aware that workflows that - destructively modify inputs may not be repeatable or reproducible. - In particular, enabling this feature implies that WorkReuse should - not be enabled. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, InplaceUpdateRequirement): - return bool( - self.class_ == other.class_ - and self.inplaceUpdate == other.inplaceUpdate - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.inplaceUpdate)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if str(e) == "missing required field `cwlVersion`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("cwlVersion") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), + [e], + detailed_message=f"the `cwlVersion` field with value `{val}` " + "is not valid because:", + ) + ) + intent = None + if "intent" in _doc: + try: + intent = _load_field( + _doc.get("intent"), + uri_union_of_None_type_or_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("intent") + ) - class_ = load_field( - _doc.get("class"), - uri_InplaceUpdateRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e + if str(e) == "missing required field `intent`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("intent") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `intent` field is not valid because:", + SourceLine(_doc, "intent", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `intent` field is not valid because:", + SourceLine(_doc, "intent", str), + [e], + detailed_message=f"the `intent` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("inplaceUpdate") is None: - raise ValidationException("missing required field `inplaceUpdate`", None, []) + if _doc.get("expression") is None: + raise ValidationException("missing required field `expression`", None, []) - inplaceUpdate = load_field( - _doc.get("inplaceUpdate"), - booltype, + expression = _load_field( + _doc.get("expression"), + ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("inplaceUpdate") + lc=_doc.get("expression") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `inplaceUpdate`": + if str(e) == "missing required field `expression`": _errors__.append( ValidationException( str(e), @@ -18894,13 +19146,13 @@ def fromDoc( ) ) else: - val = _doc.get("inplaceUpdate") + val = _doc.get("expression") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `inplaceUpdate` field is not valid because:", - SourceLine(_doc, "inplaceUpdate", str), + "the `expression` field is not valid because:", + SourceLine(_doc, "expression", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -18912,10 +19164,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `inplaceUpdate` field is not valid because:", - SourceLine(_doc, "inplaceUpdate", str), + "the `expression` field is not valid because:", + SourceLine(_doc, "expression", str), [e], - detailed_message=f"the `inplaceUpdate` field with value `{val}` " + detailed_message=f"the `expression` field with value `{val}` " "is not valid because:", ) ) @@ -18927,14 +19179,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `inplaceUpdate`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`, `expression`".format( k ), SourceLine(_doc, k, str), @@ -18944,10 +19196,20 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - inplaceUpdate=inplaceUpdate, + id=id, + label=label, + doc=doc, + inputs=inputs, + outputs=outputs, + requirements=requirements, + hints=hints, + cwlVersion=cwlVersion, + intent=intent, + expression=expression, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -18961,206 +19223,57 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) + u = save_relative_uri(uri, self.id, False, None, relative_uris) r["class"] = u - if self.inplaceUpdate is not None: - r["inplaceUpdate"] = save( - self.inplaceUpdate, - top=False, - base_url=base_url, - relative_uris=relative_uris, + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - inplaceUpdate: bool, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "InplaceUpdateRequirement" - self.inplaceUpdate = inplaceUpdate - - attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"]) - - -@mypyc_attr(native_class=True) -class ToolTimeLimit(Saveable): - """ - Set an upper limit on the execution time of a CommandLineTool. - A CommandLineTool whose execution duration exceeds the time - limit may be preemptively terminated and considered failed. - May also be used by batch systems to make scheduling decisions. - The execution duration excludes external operations, such as - staging of files, pulling a docker image etc, and only counts - wall-time for the execution of the command line itself. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ToolTimeLimit): - return bool( - self.class_ == other.class_ and self.timelimit == other.timelimit + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.timelimit)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ToolTimeLimit_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") + if self.inputs is not None: + r["inputs"] = save( + self.inputs, top=False, base_url=self.id, relative_uris=relative_uris ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("timelimit") is None: - raise ValidationException("missing required field `timelimit`", None, []) - - timelimit = load_field( - _doc.get("timelimit"), - union_of_inttype_or_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("timelimit") + if self.outputs is not None: + r["outputs"] = save( + self.outputs, top=False, base_url=self.id, relative_uris=relative_uris ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `timelimit`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("timelimit") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `timelimit` field is not valid because:", - SourceLine(_doc, "timelimit", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `timelimit` field is not valid because:", - SourceLine(_doc, "timelimit", str), - [e], - detailed_message=f"the `timelimit` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `timelimit`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - timelimit=timelimit, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.timelimit is not None: - r["timelimit"] = save( - self.timelimit, + if self.requirements is not None: + r["requirements"] = save( + self.requirements, top=False, - base_url=base_url, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.cwlVersion is not None: + u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) + r["cwlVersion"] = u + if self.intent is not None: + u = save_relative_uri(self.intent, self.id, True, None, relative_uris) + r["intent"] = u + if self.expression is not None: + r["expression"] = save( + self.expression, + top=False, + base_url=self.id, relative_uris=relative_uris, ) @@ -19174,7 +19287,16 @@ def save( def __init__( self, - timelimit: i32 | str, + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[ExpressionToolOutputParameter], + expression: str, + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -19186,18 +19308,48 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ToolTimeLimit" - self.timelimit = timelimit + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "ExpressionTool" + self.expression = expression - attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "label", + "doc", + "inputs", + "outputs", + "requirements", + "hints", + "cwlVersion", + "intent", + "class", + "expression", + ] + ) @mypyc_attr(native_class=True) -class ExpressionToolOutputParameter(Saveable): +class WorkflowOutputParameter(Saveable): + """ + Describe an output parameter of a workflow. The parameter must be connected to one or more parameters defined in the workflow that will provide the value of the output parameter. It is legal to connect a WorkflowInputParameter to a WorkflowOutputParameter. + + See `WorkflowStepInput <#WorkflowStepInput>`__ for discussion of ``linkMerge`` and ``pickValue``. + + """ + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, ExpressionToolOutputParameter): + if isinstance(other, WorkflowOutputParameter): return bool( self.label == other.label and self.secondaryFiles == other.secondaryFiles @@ -19205,6 +19357,9 @@ def __eq__(self, other: Any) -> bool: and self.doc == other.doc and self.id == other.id and self.format == other.format + and self.outputSource == other.outputSource + and self.linkMerge == other.linkMerge + and self.pickValue == other.pickValue and self.type_ == other.type_ ) return False @@ -19218,6 +19373,9 @@ def __hash__(self) -> int: self.doc, self.id, self.format, + self.outputSource, + self.linkMerge, + self.pickValue, self.type_, ) ) @@ -19239,7 +19397,7 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), uri_strtype_True_False_None_None, baseuri, @@ -19295,7 +19453,7 @@ def fromDoc( label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -19342,7 +19500,7 @@ def fromDoc( secondaryFiles = None if "secondaryFiles" in _doc: try: - secondaryFiles = load_field( + secondaryFiles = _load_field( _doc.get("secondaryFiles"), secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, @@ -19389,7 +19547,7 @@ def fromDoc( streamable = None if "streamable" in _doc: try: - streamable = load_field( + streamable = _load_field( _doc.get("streamable"), union_of_None_type_or_booltype, baseuri, @@ -19436,7 +19594,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -19483,7 +19641,7 @@ def fromDoc( format = None if "format" in _doc: try: - format = load_field( + format = _load_field( _doc.get("format"), uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, baseuri, @@ -19527,244 +19685,21 @@ def fromDoc( "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset( - ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] - ) - - -@mypyc_attr(native_class=True) -class WorkflowInputParameter(Saveable): - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowInputParameter): - return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.default == other.default - and self.type_ == other.type_ - and self.inputBinding == other.inputBinding - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.loadContents, - self.loadListing, - self.default, - self.type_, - self.inputBinding, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) + outputSource = None + if "outputSource" in _doc: + try: + outputSource = _load_field( + _doc.get("outputSource"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None, + baseuri, + loadingOptions, + lc=_doc.get("outputSource") + ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `outputSource`": _errors__.append( ValidationException( str(e), @@ -19772,13 +19707,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("outputSource") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `outputSource` field is not valid because:", + SourceLine(_doc, "outputSource", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -19790,37 +19725,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `outputSource` field is not valid because:", + SourceLine(_doc, "outputSource", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `outputSource` field with value `{val}` " "is not valid because:", ) ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: + linkMerge = None + if "linkMerge" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + linkMerge = _load_field( + _doc.get("linkMerge"), + union_of_None_type_or_LinkMergeMethodLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("linkMerge") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `linkMerge`": _errors__.append( ValidationException( str(e), @@ -19828,248 +19754,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadContents`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadContents") + val = _doc.get("linkMerge") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -20081,4694 +19772,108 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `linkMerge` field with value `{val}` " "is not valid because:", ) ) - loadListing = None - if "loadListing" in _doc: + pickValue = None + if "pickValue" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, - baseuri, - loadingOptions, - lc=_doc.get("loadListing") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadListing`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadListing") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [e], - detailed_message=f"the `loadListing` field with value `{val}` " - "is not valid because:", - ) - ) - default = None - if "default" in _doc: - try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, - baseuri, - loadingOptions, - lc=_doc.get("default") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `default`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("default") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [e], - detailed_message=f"the `default` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - inputBinding = None - if "inputBinding" in _doc: - try: - inputBinding = load_field( - _doc.get("inputBinding"), - union_of_None_type_or_InputBindingLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputBinding") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputBinding`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputBinding") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputBinding` field is not valid because:", - SourceLine(_doc, "inputBinding", str), - [e], - detailed_message=f"the `inputBinding` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`, `inputBinding`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - loadContents=loadContents, - loadListing=loadListing, - default=default, - type_=type_, - inputBinding=inputBinding, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputBinding is not None: - r["inputBinding"] = save( - self.inputBinding, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - default: CWLObjectType | None = None, - inputBinding: InputBinding | None = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - self.inputBinding = inputBinding - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "loadContents", - "loadListing", - "default", - "type", - "inputBinding", - ] - ) - - -@mypyc_attr(native_class=True) -class ExpressionTool(Saveable): - """ - An ExpressionTool is a type of Process object that can be run by itself - or as a Workflow step. It executes a pure Javascript expression that has - access to the same input parameters as a workflow. It is meant to be used - sparingly as a way to isolate complex Javascript expressions that need to - operate on input data and produce some result; perhaps just a - rearrangement of the inputs. No Docker software container is required - or allowed. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ExpressionTool): - return bool( - self.id == other.id - and self.label == other.label - and self.doc == other.doc - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.cwlVersion == other.cwlVersion - and self.intent == other.intent - and self.class_ == other.class_ - and self.expression == other.expression - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.label, - self.doc, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.cwlVersion, - self.intent, - self.class_, - self.expression, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ExpressionTool_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_WorkflowInputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) - - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_ExpressionToolOutputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [e], - detailed_message=f"the `outputs` field with value `{val}` " - "is not valid because:", - ) - ) - requirements = None - if "requirements" in _doc: - try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, - baseuri, - loadingOptions, - lc=_doc.get("requirements") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `requirements`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("requirements") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [e], - detailed_message=f"the `requirements` field with value `{val}` " - "is not valid because:", - ) - ) - hints = None - if "hints" in _doc: - try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("hints") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `hints`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("hints") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [e], - detailed_message=f"the `hints` field with value `{val}` " - "is not valid because:", - ) - ) - cwlVersion = None - if "cwlVersion" in _doc: - try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("cwlVersion") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cwlVersion`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cwlVersion") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " - "is not valid because:", - ) - ) - intent = None - if "intent" in _doc: - try: - intent = load_field( - _doc.get("intent"), - uri_union_of_None_type_or_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("intent") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `intent`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("intent") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `intent` field is not valid because:", - SourceLine(_doc, "intent", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `intent` field is not valid because:", - SourceLine(_doc, "intent", str), - [e], - detailed_message=f"the `intent` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("expression") is None: - raise ValidationException("missing required field `expression`", None, []) - - expression = load_field( - _doc.get("expression"), - ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("expression") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `expression`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("expression") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `expression` field is not valid because:", - SourceLine(_doc, "expression", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `expression` field is not valid because:", - SourceLine(_doc, "expression", str), - [e], - detailed_message=f"the `expression` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`, `expression`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - doc=doc, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - cwlVersion=cwlVersion, - intent=intent, - expression=expression, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) - r["class"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.intent is not None: - u = save_relative_uri(self.intent, self.id, True, None, relative_uris) - r["intent"] = u - if self.expression is not None: - r["expression"] = save( - self.expression, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - inputs: Sequence[WorkflowInputParameter], - outputs: Sequence[ExpressionToolOutputParameter], - expression: str, - id: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: CWLVersion | None = None, - intent: None | Sequence[str] = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_: Final[str] = "ExpressionTool" - self.expression = expression - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "label", - "doc", - "inputs", - "outputs", - "requirements", - "hints", - "cwlVersion", - "intent", - "class", - "expression", - ] - ) - - -@mypyc_attr(native_class=True) -class WorkflowOutputParameter(Saveable): - """ - Describe an output parameter of a workflow. The parameter must be - connected to one or more parameters defined in the workflow that - will provide the value of the output parameter. It is legal to - connect a WorkflowInputParameter to a WorkflowOutputParameter. - - See [WorkflowStepInput](#WorkflowStepInput) for discussion of - `linkMerge` and `pickValue`. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowOutputParameter): - return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.outputSource == other.outputSource - and self.linkMerge == other.linkMerge - and self.pickValue == other.pickValue - and self.type_ == other.type_ - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, - self.id, - self.format, - self.outputSource, - self.linkMerge, - self.pickValue, - self.type_, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - secondaryFiles = None - if "secondaryFiles" in _doc: - try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, - baseuri, - loadingOptions, - lc=_doc.get("secondaryFiles") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secondaryFiles`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secondaryFiles") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), - [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " - "is not valid because:", - ) - ) - streamable = None - if "streamable" in _doc: - try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("streamable") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `streamable`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("streamable") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), - [e], - detailed_message=f"the `streamable` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - format = None - if "format" in _doc: - try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, - baseuri, - loadingOptions, - lc=_doc.get("format") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `format`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("format") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), - [e], - detailed_message=f"the `format` field with value `{val}` " - "is not valid because:", - ) - ) - outputSource = None - if "outputSource" in _doc: - try: - outputSource = load_field( - _doc.get("outputSource"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None, - baseuri, - loadingOptions, - lc=_doc.get("outputSource") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputSource`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputSource") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputSource` field is not valid because:", - SourceLine(_doc, "outputSource", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputSource` field is not valid because:", - SourceLine(_doc, "outputSource", str), - [e], - detailed_message=f"the `outputSource` field with value `{val}` " - "is not valid because:", - ) - ) - linkMerge = None - if "linkMerge" in _doc: - try: - linkMerge = load_field( - _doc.get("linkMerge"), - union_of_None_type_or_LinkMergeMethodLoader, - baseuri, - loadingOptions, - lc=_doc.get("linkMerge") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `linkMerge`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("linkMerge") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [e], - detailed_message=f"the `linkMerge` field with value `{val}` " - "is not valid because:", - ) - ) - pickValue = None - if "pickValue" in _doc: - try: - pickValue = load_field( - _doc.get("pickValue"), - union_of_None_type_or_PickValueMethodLoader, - baseuri, - loadingOptions, - lc=_doc.get("pickValue") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `pickValue`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("pickValue") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `pickValue` field is not valid because:", - SourceLine(_doc, "pickValue", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `pickValue` field is not valid because:", - SourceLine(_doc, "pickValue", str), - [e], - detailed_message=f"the `pickValue` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `outputSource`, `linkMerge`, `pickValue`, `type`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - outputSource=outputSource, - linkMerge=linkMerge, - pickValue=pickValue, - type_=type_, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.outputSource is not None: - u = save_relative_uri(self.outputSource, self.id, False, 1, relative_uris) - r["outputSource"] = u - if self.linkMerge is not None: - r["linkMerge"] = save( - self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.pickValue is not None: - r["pickValue"] = save( - self.pickValue, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | str = None, - outputSource: None | Sequence[str] | str = None, - linkMerge: LinkMergeMethod | None = None, - pickValue: None | PickValueMethod = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc - self.id = id - self.format = format - self.outputSource = outputSource - self.linkMerge = linkMerge - self.pickValue = pickValue - self.type_ = type_ - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "outputSource", - "linkMerge", - "pickValue", - "type", - ] - ) - - -@mypyc_attr(native_class=True) -class WorkflowStepInput(Saveable): - """ - The input of a workflow step connects an upstream parameter (from the - workflow inputs, or the outputs of other workflows steps) with the input - parameters of the process specified by the `run` field. Only input parameters - declared by the target process will be passed through at runtime to the process - though additional parameters may be specified (for use within `valueFrom` - expressions for instance) - unconnected or unused parameters do not represent an - error condition. - - # Input object - - A WorkflowStepInput object must contain an `id` field in the form - `#fieldname` or `#prefix/fieldname`. When the `id` field contains a slash - `/` the field name consists of the characters following the final slash - (the prefix portion may contain one or more slashes to indicate scope). - This defines a field of the workflow step input object with the value of - the `source` parameter(s). - - # Merging multiple inbound data links - - To merge multiple inbound data links, - [MultipleInputFeatureRequirement](#MultipleInputFeatureRequirement) must be specified - in the workflow or workflow step requirements. - - If the sink parameter is an array, or named in a [workflow - scatter](#WorkflowStep) operation, there may be multiple inbound - data links listed in the `source` field. The values from the - input links are merged depending on the method specified in the - `linkMerge` field. If both `linkMerge` and `pickValue` are null - or not specified, and there is more than one element in the - `source` array, the default method is "merge_nested". - - If both `linkMerge` and `pickValue` are null or not specified, and - there is only a single element in the `source`, then the input - parameter takes the scalar value from the single input link (it is - *not* wrapped in a single-list). - - * **merge_nested** - - The input must be an array consisting of exactly one entry for each - input link. If "merge_nested" is specified with a single link, the value - from the link must be wrapped in a single-item list. - - * **merge_flattened** - - 1. The source and sink parameters must be compatible types, or the source - type must be compatible with single element from the "items" type of - the destination array parameter. - 2. Source parameters which are arrays are concatenated. - Source parameters which are single element types are appended as - single elements. - - # Picking non-null values among inbound data links - - If present, `pickValue` specifies how to pick non-null values among inbound data links. - - `pickValue` is evaluated - 1. Once all source values from upstream step or parameters are available. - 2. After `linkMerge`. - 3. Before `scatter` or `valueFrom`. - - This is specifically intended to be useful in combination with - [conditional execution](#WorkflowStep), where several upstream - steps may be connected to a single input (`source` is a list), and - skipped steps produce null values. - - Static type checkers should check for type consistency after inferring what the type - will be after `pickValue` is applied, just as they do currently for `linkMerge`. - - * **first_non_null** - - For the first level of a list input, pick the first non-null element. The result is a scalar. - It is an error if there is no non-null element. Examples: - * `[null, x, null, y] -> x` - * `[null, [null], null, y] -> [null]` - * `[null, null, null] -> Runtime Error` - - *Intended use case*: If-else pattern where the - value comes either from a conditional step or from a default or - fallback value. The conditional step(s) should be placed first in - the list. - - * **the_only_non_null** - - For the first level of a list input, pick the single non-null element. The result is a scalar. - It is an error if there is more than one non-null element. Examples: - - * `[null, x, null] -> x` - * `[null, x, null, y] -> Runtime Error` - * `[null, [null], null] -> [null]` - * `[null, null, null] -> Runtime Error` - - *Intended use case*: Switch type patterns where developer considers - more than one active code path as a workflow error - (possibly indicating an error in writing `when` condition expressions). - - * **all_non_null** - - For the first level of a list input, pick all non-null values. - The result is a list, which may be empty. Examples: - - * `[null, x, null] -> [x]` - * `[x, null, y] -> [x, y]` - * `[null, [x], [null]] -> [[x], [null]]` - * `[null, null, null] -> []` - - *Intended use case*: It is valid to have more than one source, but - sources are conditional, so null sources (from skipped steps) - should be filtered out. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStepInput): - return bool( - self.id == other.id - and self.source == other.source - and self.linkMerge == other.linkMerge - and self.pickValue == other.pickValue - and self.loadContents == other.loadContents - and self.loadListing == other.loadListing - and self.label == other.label - and self.default == other.default - and self.valueFrom == other.valueFrom - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.source, - self.linkMerge, - self.pickValue, - self.loadContents, - self.loadListing, - self.label, - self.default, - self.valueFrom, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - source = None - if "source" in _doc: - try: - source = load_field( - _doc.get("source"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None, - baseuri, - loadingOptions, - lc=_doc.get("source") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `source`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("source") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `source` field is not valid because:", - SourceLine(_doc, "source", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `source` field is not valid because:", - SourceLine(_doc, "source", str), - [e], - detailed_message=f"the `source` field with value `{val}` " - "is not valid because:", - ) - ) - linkMerge = None - if "linkMerge" in _doc: - try: - linkMerge = load_field( - _doc.get("linkMerge"), - union_of_None_type_or_LinkMergeMethodLoader, - baseuri, - loadingOptions, - lc=_doc.get("linkMerge") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `linkMerge`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("linkMerge") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), - [e], - detailed_message=f"the `linkMerge` field with value `{val}` " - "is not valid because:", - ) - ) - pickValue = None - if "pickValue" in _doc: - try: - pickValue = load_field( - _doc.get("pickValue"), - union_of_None_type_or_PickValueMethodLoader, - baseuri, - loadingOptions, - lc=_doc.get("pickValue") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `pickValue`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("pickValue") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `pickValue` field is not valid because:", - SourceLine(_doc, "pickValue", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `pickValue` field is not valid because:", - SourceLine(_doc, "pickValue", str), - [e], - detailed_message=f"the `pickValue` field with value `{val}` " - "is not valid because:", - ) - ) - loadContents = None - if "loadContents" in _doc: - try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, - baseuri, - loadingOptions, - lc=_doc.get("loadContents") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadContents`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadContents") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), - [e], - detailed_message=f"the `loadContents` field with value `{val}` " - "is not valid because:", - ) - ) - loadListing = None - if "loadListing" in _doc: - try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, - baseuri, - loadingOptions, - lc=_doc.get("loadListing") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loadListing`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loadListing") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), - [e], - detailed_message=f"the `loadListing` field with value `{val}` " - "is not valid because:", - ) - ) - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - default = None - if "default" in _doc: - try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, - baseuri, - loadingOptions, - lc=_doc.get("default") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `default`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("default") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [e], - detailed_message=f"the `default` field with value `{val}` " - "is not valid because:", - ) - ) - valueFrom = None - if "valueFrom" in _doc: - try: - valueFrom = load_field( - _doc.get("valueFrom"), - union_of_None_type_or_strtype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("valueFrom") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `valueFrom`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("valueFrom") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), - [e], - detailed_message=f"the `valueFrom` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `source`, `linkMerge`, `pickValue`, `loadContents`, `loadListing`, `label`, `default`, `valueFrom`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - source=source, - linkMerge=linkMerge, - pickValue=pickValue, - loadContents=loadContents, - loadListing=loadListing, - label=label, - default=default, - valueFrom=valueFrom, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.source is not None: - u = save_relative_uri(self.source, self.id, False, 2, relative_uris) - r["source"] = u - if self.linkMerge is not None: - r["linkMerge"] = save( - self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.pickValue is not None: - r["pickValue"] = save( - self.pickValue, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.valueFrom is not None: - r["valueFrom"] = save( - self.valueFrom, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - source: None | Sequence[str] | str = None, - linkMerge: LinkMergeMethod | None = None, - pickValue: None | PickValueMethod = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - label: None | str = None, - default: CWLObjectType | None = None, - valueFrom: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id - self.source = source - self.linkMerge = linkMerge - self.pickValue = pickValue - self.loadContents = loadContents - self.loadListing = loadListing - self.label = label - self.default = default - self.valueFrom = valueFrom - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "source", - "linkMerge", - "pickValue", - "loadContents", - "loadListing", - "label", - "default", - "valueFrom", - ] - ) - - -@mypyc_attr(native_class=True) -class WorkflowStepOutput(Saveable): - """ - Associate an output parameter of the underlying process with a workflow - parameter. The workflow parameter (given in the `id` field) be may be used - as a `source` to connect with input parameters of other workflow steps, or - with an output parameter of the process. - - A unique identifier for this workflow output parameter. This is - the identifier to use in the `source` field of `WorkflowStepInput` - to connect the output value to downstream parameters. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStepOutput): - return bool(self.id == other.id) - return False - - def __hash__(self) -> int: - return hash((self.id)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id - - attrs: ClassVar[Collection[str]] = frozenset(["id"]) - - -@mypyc_attr(native_class=True) -class WorkflowStep(Saveable): - """ - A workflow step is an executable element of a workflow. It specifies the - underlying process implementation (such as `CommandLineTool` or another - `Workflow`) in the `run` field and connects the input and output parameters - of the underlying process to workflow parameters. - - # Scatter/gather - - To use scatter/gather, - [ScatterFeatureRequirement](#ScatterFeatureRequirement) must be specified - in the workflow or workflow step requirements. - - A "scatter" operation specifies that the associated workflow step or - subworkflow should execute separately over a list of input elements. Each - job making up a scatter operation is independent and may be executed - concurrently. - - The `scatter` field specifies one or more input parameters which will be - scattered. An input parameter may be listed more than once. The declared - type of each input parameter implicitly becomes an array of items of the - input parameter type. If a parameter is listed more than once, it becomes - a nested array. As a result, upstream parameters which are connected to - scattered parameters must be arrays. - - All output parameter types are also implicitly wrapped in arrays. Each job - in the scatter results in an entry in the output array. - - If any scattered parameter runtime value is an empty array, all outputs are - set to empty arrays and no work is done for the step, according to - applicable scattering rules. - - If `scatter` declares more than one input parameter, `scatterMethod` - describes how to decompose the input into a discrete set of jobs. - - * **dotproduct** specifies that each of the input arrays are aligned and one - element taken from each array to construct each job. It is an error - if all input arrays are not the same length. - - * **nested_crossproduct** specifies the Cartesian product of the inputs, - producing a job for every combination of the scattered inputs. The - output must be nested arrays for each level of scattering, in the - order that the input arrays are listed in the `scatter` field. - - * **flat_crossproduct** specifies the Cartesian product of the inputs, - producing a job for every combination of the scattered inputs. The - output arrays must be flattened to a single level, but otherwise listed in the - order that the input arrays are listed in the `scatter` field. - - # Conditional execution (Optional) - - Conditional execution makes execution of a step conditional on an - expression. A step that is not executed is "skipped". A skipped - step produces `null` for all output parameters. - - The condition is evaluated after `scatter`, using the input object - of each individual scatter job. This means over a set of scatter - jobs, some may be executed and some may be skipped. When the - results are gathered, skipped steps must be `null` in the output - arrays. - - The `when` field controls conditional execution. This is an - expression that must be evaluated with `inputs` bound to the step - input object (or individual scatter job), and returns a boolean - value. It is an error if this expression returns a value other - than `true` or `false`. - - Conditionals in CWL are an optional feature and are not required - to be implemented by all consumers of CWL documents. An - implementation that does not support conditionals must return a - fatal error when attempting to execute a workflow that uses - conditional constructs the implementation does not support. - - # Subworkflows - - To specify a nested workflow as part of a workflow step, - [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) must be - specified in the workflow or workflow step requirements. - - It is a fatal error if a workflow directly or indirectly invokes itself as - a subworkflow (recursive workflows are not allowed). - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, WorkflowStep): - return bool( - self.id == other.id - and self.label == other.label - and self.doc == other.doc - and self.in_ == other.in_ - and self.out == other.out - and self.requirements == other.requirements - and self.hints == other.hints - and self.run == other.run - and self.when == other.when - and self.scatter == other.scatter - and self.scatterMethod == other.scatterMethod - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.label, - self.doc, - self.in_, - self.out, - self.requirements, - self.hints, - self.run, - self.when, - self.scatter, - self.scatterMethod, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("in") is None: - raise ValidationException("missing required field `in`", None, []) - - in_ = load_field( - _doc.get("in"), - idmap_in__array_of_WorkflowStepInputLoader, - baseuri, - loadingOptions, - lc=_doc.get("in") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `in`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("in") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `in` field is not valid because:", - SourceLine(_doc, "in", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `in` field is not valid because:", - SourceLine(_doc, "in", str), - [e], - detailed_message=f"the `in` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("out") is None: - raise ValidationException("missing required field `out`", None, []) - - out = load_field( - _doc.get("out"), - uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("out") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `out`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("out") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `out` field is not valid because:", - SourceLine(_doc, "out", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `out` field is not valid because:", - SourceLine(_doc, "out", str), - [e], - detailed_message=f"the `out` field with value `{val}` " - "is not valid because:", - ) - ) - requirements = None - if "requirements" in _doc: - try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, - baseuri, - loadingOptions, - lc=_doc.get("requirements") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `requirements`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("requirements") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [e], - detailed_message=f"the `requirements` field with value `{val}` " - "is not valid because:", - ) - ) - hints = None - if "hints" in _doc: - try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("hints") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `hints`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("hints") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [e], - detailed_message=f"the `hints` field with value `{val}` " - "is not valid because:", - ) - ) - - subscope_baseuri = expand_url('run', baseuri, loadingOptions, True) - try: - if _doc.get("run") is None: - raise ValidationException("missing required field `run`", None, []) - - run = load_field( - _doc.get("run"), - uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None, - subscope_baseuri, - loadingOptions, - lc=_doc.get("run") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `run`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("run") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), - [e], - detailed_message=f"the `run` field with value `{val}` " - "is not valid because:", - ) - ) - when = None - if "when" in _doc: - try: - when = load_field( - _doc.get("when"), - union_of_None_type_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("when") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `when`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("when") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `when` field is not valid because:", - SourceLine(_doc, "when", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `when` field is not valid because:", - SourceLine(_doc, "when", str), - [e], - detailed_message=f"the `when` field with value `{val}` " - "is not valid because:", - ) - ) - scatter = None - if "scatter" in _doc: - try: - scatter = load_field( - _doc.get("scatter"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None, - baseuri, - loadingOptions, - lc=_doc.get("scatter") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `scatter`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("scatter") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `scatter` field is not valid because:", - SourceLine(_doc, "scatter", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `scatter` field is not valid because:", - SourceLine(_doc, "scatter", str), - [e], - detailed_message=f"the `scatter` field with value `{val}` " - "is not valid because:", - ) - ) - scatterMethod = None - if "scatterMethod" in _doc: - try: - scatterMethod = load_field( - _doc.get("scatterMethod"), - uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("scatterMethod") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `scatterMethod`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("scatterMethod") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `scatterMethod` field is not valid because:", - SourceLine(_doc, "scatterMethod", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `scatterMethod` field is not valid because:", - SourceLine(_doc, "scatterMethod", str), - [e], - detailed_message=f"the `scatterMethod` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `in`, `out`, `requirements`, `hints`, `run`, `when`, `scatter`, `scatterMethod`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - doc=doc, - in_=in_, - out=out, - requirements=requirements, - hints=hints, - run=run, - when=when, - scatter=scatter, - scatterMethod=scatterMethod, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.in_ is not None: - r["in"] = save( - self.in_, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.out is not None: - u = save_relative_uri(self.out, self.id, True, None, relative_uris) - r["out"] = u - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.run is not None: - u = save_relative_uri(self.run, self.id, False, None, relative_uris) - r["run"] = u - if self.when is not None: - r["when"] = save( - self.when, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.scatter is not None: - u = save_relative_uri(self.scatter, self.id, False, 0, relative_uris) - r["scatter"] = u - if self.scatterMethod is not None: - u = save_relative_uri( - self.scatterMethod, self.id, False, None, relative_uris - ) - r["scatterMethod"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - id: str, - in_: Sequence[WorkflowStepInput], - out: Sequence[WorkflowStepOutput | str], - run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str, - label: None | str = None, - doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any] = None, - when: None | str = None, - scatter: None | Sequence[str] | str = None, - scatterMethod: None | ScatterMethod = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id - self.label = label - self.doc = doc - self.in_ = in_ - self.out = out - self.requirements = requirements - self.hints = hints - self.run = run - self.when = when - self.scatter = scatter - self.scatterMethod = scatterMethod - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "label", - "doc", - "in", - "out", - "requirements", - "hints", - "run", - "when", - "scatter", - "scatterMethod", - ] - ) - - -@mypyc_attr(native_class=True) -class Workflow(Saveable): - """ - A workflow describes a set of **steps** and the **dependencies** between - those steps. When a step produces output that will be consumed by a - second step, the first step is a dependency of the second step. - - When there is a dependency, the workflow engine must execute the preceding - step and wait for it to successfully produce output before executing the - dependent step. If two steps are defined in the workflow graph that - are not directly or indirectly dependent, these steps are **independent**, - and may execute in any order or execute concurrently. A workflow is - complete when all steps have been executed. - - Dependencies between parameters are expressed using the `source` - field on [workflow step input parameters](#WorkflowStepInput) and - `outputSource` field on [workflow output - parameters](#WorkflowOutputParameter). - - The `source` field on each workflow step input parameter expresses - the data links that contribute to the value of the step input - parameter (the "sink"). A workflow step can only begin execution - when every data link connected to a step has been fulfilled. - - The `outputSource` field on each workflow step input parameter - expresses the data links that contribute to the value of the - workflow output parameter (the "sink"). Workflow execution cannot - complete successfully until every data link connected to an output - parameter has been fulfilled. - - ## Workflow success and failure - - A completed step must result in one of `success`, `temporaryFailure` or - `permanentFailure` states. An implementation may choose to retry a step - execution which resulted in `temporaryFailure`. An implementation may - choose to either continue running other steps of a workflow, or terminate - immediately upon `permanentFailure`. - - * If any step of a workflow execution results in `permanentFailure`, then - the workflow status is `permanentFailure`. - - * If one or more steps result in `temporaryFailure` and all other steps - complete `success` or are not executed, then the workflow status is - `temporaryFailure`. - - * If all workflow steps are executed and complete with `success`, then the - workflow status is `success`. - - # Extensions - - [ScatterFeatureRequirement](#ScatterFeatureRequirement) and - [SubworkflowFeatureRequirement](#SubworkflowFeatureRequirement) are - available as standard [extensions](#Extensions_and_Metadata) to core - workflow semantics. - - """ - - id: str - - def __eq__(self, other: Any) -> bool: - if isinstance(other, Workflow): - return bool( - self.id == other.id - and self.label == other.label - and self.doc == other.doc - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.cwlVersion == other.cwlVersion - and self.intent == other.intent - and self.class_ == other.class_ - and self.steps == other.steps - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.id, - self.label, - self.doc, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.cwlVersion, - self.intent, - self.class_, - self.steps, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) - - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_Workflow_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_WorkflowInputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) - - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_WorkflowOutputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputs") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `outputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [e], - detailed_message=f"the `outputs` field with value `{val}` " - "is not valid because:", - ) - ) - requirements = None - if "requirements" in _doc: - try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, - baseuri, - loadingOptions, - lc=_doc.get("requirements") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `requirements`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("requirements") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [e], - detailed_message=f"the `requirements` field with value `{val}` " - "is not valid because:", - ) - ) - hints = None - if "hints" in _doc: - try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("hints") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `hints`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("hints") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [e], - detailed_message=f"the `hints` field with value `{val}` " - "is not valid because:", - ) - ) - cwlVersion = None - if "cwlVersion" in _doc: - try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("cwlVersion") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `cwlVersion`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cwlVersion") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " - "is not valid because:", - ) - ) - intent = None - if "intent" in _doc: - try: - intent = load_field( - _doc.get("intent"), - uri_union_of_None_type_or_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("intent") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `intent`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("intent") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `intent` field is not valid because:", - SourceLine(_doc, "intent", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `intent` field is not valid because:", - SourceLine(_doc, "intent", str), - [e], - detailed_message=f"the `intent` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("steps") is None: - raise ValidationException("missing required field `steps`", None, []) - - steps = load_field( - _doc.get("steps"), - idmap_steps_union_of_array_of_WorkflowStepLoader, - baseuri, - loadingOptions, - lc=_doc.get("steps") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `steps`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("steps") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `steps` field is not valid because:", - SourceLine(_doc, "steps", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `steps` field is not valid because:", - SourceLine(_doc, "steps", str), - [e], - detailed_message=f"the `steps` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`, `steps`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - label=label, - doc=doc, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - cwlVersion=cwlVersion, - intent=intent, - steps=steps, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) - r["class"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.intent is not None: - u = save_relative_uri(self.intent, self.id, True, None, relative_uris) - r["intent"] = u - if self.steps is not None: - r["steps"] = save( - self.steps, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - inputs: Sequence[WorkflowInputParameter], - outputs: Sequence[WorkflowOutputParameter], - steps: Sequence[WorkflowStep], - id: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: CWLVersion | None = None, - intent: None | Sequence[str] = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_: Final[str] = "Workflow" - self.steps = steps - - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "label", - "doc", - "inputs", - "outputs", - "requirements", - "hints", - "cwlVersion", - "intent", - "class", - "steps", - ] - ) - - -@mypyc_attr(native_class=True) -class SubworkflowFeatureRequirement(Saveable): - """ - Indicates that the workflow platform must support nested workflows in - the `run` field of [WorkflowStep](#WorkflowStep). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, SubworkflowFeatureRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "SubworkflowFeatureRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class ScatterFeatureRequirement(Saveable): - """ - Indicates that the workflow platform must support the `scatter` and - `scatterMethod` fields of [WorkflowStep](#WorkflowStep). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, ScatterFeatureRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_ScatterFeatureRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ScatterFeatureRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class MultipleInputFeatureRequirement(Saveable): - """ - Indicates that the workflow platform must support multiple inbound data links - listed in the `source` field of [WorkflowStepInput](#WorkflowStepInput). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, MultipleInputFeatureRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) + pickValue = _load_field( + _doc.get("pickValue"), + union_of_None_type_or_PickValueMethodLoader, + baseuri, + loadingOptions, + lc=_doc.get("pickValue") + ) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `pickValue`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("pickValue") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `pickValue` field is not valid because:", + SourceLine(_doc, "pickValue", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `pickValue` field is not valid because:", + SourceLine(_doc, "pickValue", str), + [e], + detailed_message=f"the `pickValue` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - class_ = load_field( - _doc.get("class"), - uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None, + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, - lc=_doc.get("class") + lc=_doc.get("type") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `type`": + _errors__.append( + ValidationException( + str(e), + None ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + else: + val = _doc.get("type") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), - SourceLine(_doc, k, str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), + [e], + detailed_message=f"the `type` field with value `{val}` " + "is not valid because:", ) ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "MultipleInputFeatureRequirement" - - attrs: ClassVar[Collection[str]] = frozenset(["class"]) - - -@mypyc_attr(native_class=True) -class StepInputExpressionRequirement(Saveable): - """ - Indicate that the workflow platform must support the `valueFrom` field - of [WorkflowStepInput](#WorkflowStepInput). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, StepInputExpressionRequirement): - return bool(self.class_ == other.class_) - return False - - def __hash__(self) -> int: - return hash((self.class_)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_StepInputExpressionRequirement_classLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -24777,14 +19882,16 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`".format(k), + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `outputSource`, `linkMerge`, `pickValue`, `type`".format( + k + ), SourceLine(_doc, k, str), ) ) @@ -24792,9 +19899,20 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + outputSource=outputSource, + linkMerge=linkMerge, + pickValue=pickValue, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -24808,14 +19926,49 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.streamable is not None: + r["streamable"] = save( + self.streamable, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.outputSource is not None: + u = save_relative_uri(self.outputSource, self.id, False, 1, relative_uris) + r["outputSource"] = u + if self.linkMerge is not None: + r["linkMerge"] = save( + self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.pickValue is not None: + r["pickValue"] = save( + self.pickValue, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -24827,6 +19980,16 @@ def save( def __init__( self, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, + outputSource: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + pickValue: None | PickValueMethod = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -24838,49 +20001,139 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "StepInputExpressionRequirement" + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.outputSource = outputSource + self.linkMerge = linkMerge + self.pickValue = pickValue + self.type_ = type_ - attrs: ClassVar[Collection[str]] = frozenset(["class"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "outputSource", + "linkMerge", + "pickValue", + "type", + ] + ) @mypyc_attr(native_class=True) -class OperationInputParameter(Saveable): +class WorkflowStepInput(Saveable): """ - Describe an input parameter of an operation. + The input of a workflow step connects an upstream parameter (from the workflow inputs, or the outputs of other workflows steps) with the input parameters of the process specified by the ``run`` field. Only input parameters declared by the target process will be passed through at runtime to the process though additional parameters may be specified (for use within ``valueFrom`` expressions for instance) - unconnected or unused parameters do not represent an error condition. + + Input object + ============ + + A WorkflowStepInput object must contain an ``id`` field in the form ``#fieldname`` or ``#prefix/fieldname``. When the ``id`` field contains a slash ``/`` the field name consists of the characters following the final slash (the prefix portion may contain one or more slashes to indicate scope). This defines a field of the workflow step input object with the value of the ``source`` parameter(s). + + Merging multiple inbound data links + =================================== + + To merge multiple inbound data links, `MultipleInputFeatureRequirement <#MultipleInputFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. + + If the sink parameter is an array, or named in a `workflow scatter <#WorkflowStep>`__ operation, there may be multiple inbound data links listed in the ``source`` field. The values from the input links are merged depending on the method specified in the ``linkMerge`` field. If both ``linkMerge`` and ``pickValue`` are null or not specified, and there is more than one element in the ``source`` array, the default method is "merge_nested". + + If both ``linkMerge`` and ``pickValue`` are null or not specified, and there is only a single element in the ``source``, then the input parameter takes the scalar value from the single input link (it is *not* wrapped in a single-list). + + * **merge_nested** + + The input must be an array consisting of exactly one entry for each input link. If "merge_nested" is specified with a single link, the value from the link must be wrapped in a single-item list. + + * **merge_flattened** + + 1. The source and sink parameters must be compatible types, or the source type must be compatible with single element from the "items" type of the destination array parameter. + 2. Source parameters which are arrays are concatenated. Source parameters which are single element types are appended as single elements. + + Picking non-null values among inbound data links + ================================================ + + If present, ``pickValue`` specifies how to pick non-null values among inbound data links. + + ``pickValue`` is evaluated + + 1. Once all source values from upstream step or parameters are available. + 2. After ``linkMerge``. + 3. Before ``scatter`` or ``valueFrom``. + + This is specifically intended to be useful in combination with `conditional execution <#WorkflowStep>`__, where several upstream steps may be connected to a single input (``source`` is a list), and skipped steps produce null values. + + Static type checkers should check for type consistency after inferring what the type will be after ``pickValue`` is applied, just as they do currently for ``linkMerge``. + + * **first_non_null** + + For the first level of a list input, pick the first non-null element. The result is a scalar. It is an error if there is no non-null element. Examples: + + * ``[null, x, null, y] -> x`` + * ``[null, [null], null, y] -> [null]`` + * ``[null, null, null] -> Runtime Error`` + + *Intended use case*: If-else pattern where the value comes either from a conditional step or from a default or fallback value. The conditional step(s) should be placed first in the list. + + * **the_only_non_null** + + For the first level of a list input, pick the single non-null element. The result is a scalar. It is an error if there is more than one non-null element. Examples: + + * ``[null, x, null] -> x`` + * ``[null, x, null, y] -> Runtime Error`` + * ``[null, [null], null] -> [null]`` + * ``[null, null, null] -> Runtime Error`` + + *Intended use case*: Switch type patterns where developer considers more than one active code path as a workflow error (possibly indicating an error in writing ``when`` condition expressions). + + * **all_non_null** + + For the first level of a list input, pick all non-null values. The result is a list, which may be empty. Examples: + + * ``[null, x, null] -> [x]`` + * ``[x, null, y] -> [x, y]`` + * ``[null, [x], [null]] -> [[x], [null]]`` + * ``[null, null, null] -> []`` + + *Intended use case*: It is valid to have more than one source, but sources are conditional, so null sources (from skipped steps) should be filtered out. """ id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, OperationInputParameter): + if isinstance(other, WorkflowStepInput): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable - and self.doc == other.doc - and self.id == other.id - and self.format == other.format + self.id == other.id + and self.source == other.source + and self.linkMerge == other.linkMerge + and self.pickValue == other.pickValue and self.loadContents == other.loadContents and self.loadListing == other.loadListing + and self.label == other.label and self.default == other.default - and self.type_ == other.type_ + and self.valueFrom == other.valueFrom ) return False def __hash__(self) -> int: return hash( ( - self.label, - self.secondaryFiles, - self.streamable, - self.doc, self.id, - self.format, + self.source, + self.linkMerge, + self.pickValue, self.loadContents, self.loadListing, + self.label, self.default, - self.type_, + self.valueFrom, ) ) @@ -24901,7 +20154,7 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), uri_strtype_True_False_None_None, baseuri, @@ -24954,21 +20207,21 @@ def fromDoc( _errors__.append(ValidationException("missing id")) else: baseuri = id - label = None - if "label" in _doc: + source = None + if "source" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + source = _load_field( + _doc.get("source"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_2_None, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("source") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `source`": _errors__.append( ValidationException( str(e), @@ -24976,13 +20229,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("source") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `source` field is not valid because:", + SourceLine(_doc, "source", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -24994,28 +20247,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `source` field is not valid because:", + SourceLine(_doc, "source", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `source` field with value `{val}` " "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + linkMerge = None + if "linkMerge" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + linkMerge = _load_field( + _doc.get("linkMerge"), + union_of_None_type_or_LinkMergeMethodLoader, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("linkMerge") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `linkMerge`": _errors__.append( ValidationException( str(e), @@ -25023,13 +20276,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("linkMerge") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25041,28 +20294,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `linkMerge` field is not valid because:", + SourceLine(_doc, "linkMerge", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `linkMerge` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: + pickValue = None + if "pickValue" in _doc: try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, + pickValue = _load_field( + _doc.get("pickValue"), + union_of_None_type_or_PickValueMethodLoader, baseuri, loadingOptions, - lc=_doc.get("streamable") + lc=_doc.get("pickValue") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `streamable`": + if str(e) == "missing required field `pickValue`": _errors__.append( ValidationException( str(e), @@ -25070,13 +20323,13 @@ def fromDoc( ) ) else: - val = _doc.get("streamable") + val = _doc.get("pickValue") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `pickValue` field is not valid because:", + SourceLine(_doc, "pickValue", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25088,28 +20341,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `pickValue` field is not valid because:", + SourceLine(_doc, "pickValue", str), [e], - detailed_message=f"the `streamable` field with value `{val}` " + detailed_message=f"the `pickValue` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + loadContents = None + if "loadContents" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("loadContents") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( str(e), @@ -25117,13 +20370,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("loadContents") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25135,28 +20388,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `loadContents` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: + loadListing = None + if "loadListing" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("loadListing") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -25164,13 +20417,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25182,28 +20435,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " "is not valid because:", ) ) - loadContents = None - if "loadContents" in _doc: + label = None + if "label" in _doc: try: - loadContents = load_field( - _doc.get("loadContents"), - union_of_None_type_or_booltype, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("loadContents") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadContents`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -25211,13 +20464,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadContents") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25229,28 +20482,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadContents` field is not valid because:", - SourceLine(_doc, "loadContents", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `loadContents` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - loadListing = None - if "loadListing" in _doc: + default = None + if "default" in _doc: try: - loadListing = load_field( - _doc.get("loadListing"), - union_of_None_type_or_LoadListingEnumLoader, + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, baseuri, loadingOptions, - lc=_doc.get("loadListing") + lc=_doc.get("default") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loadListing`": + if str(e) == "missing required field `default`": _errors__.append( ValidationException( str(e), @@ -25258,13 +20511,13 @@ def fromDoc( ) ) else: - val = _doc.get("loadListing") + val = _doc.get("default") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25276,28 +20529,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loadListing` field is not valid because:", - SourceLine(_doc, "loadListing", str), + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), [e], - detailed_message=f"the `loadListing` field with value `{val}` " + detailed_message=f"the `default` field with value `{val}` " "is not valid because:", ) ) - default = None - if "default" in _doc: + valueFrom = None + if "valueFrom" in _doc: try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_CWLObjectTypeLoader, + valueFrom = _load_field( + _doc.get("valueFrom"), + union_of_None_type_or_strtype_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("default") + lc=_doc.get("valueFrom") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `default`": + if str(e) == "missing required field `valueFrom`": _errors__.append( ValidationException( str(e), @@ -25305,13 +20558,13 @@ def fromDoc( ) ) else: - val = _doc.get("default") + val = _doc.get("valueFrom") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25323,61 +20576,249 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), + "the `valueFrom` field is not valid because:", + SourceLine(_doc, "valueFrom", str), [e], - detailed_message=f"the `default` field with value `{val}` " + detailed_message=f"the `valueFrom` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + "invalid field `{}`, expected one of: `id`, `source`, `linkMerge`, `pickValue`, `loadContents`, `loadListing`, `label`, `default`, `valueFrom`".format( + k + ), + SourceLine(_doc, k, str), ) ) - else: + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + id=id, + source=source, + linkMerge=linkMerge, + pickValue=pickValue, + loadContents=loadContents, + loadListing=loadListing, + label=label, + default=default, + valueFrom=valueFrom, + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + loadingOptions.idx[id] = (_constructed, loadingOptions) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.source is not None: + u = save_relative_uri(self.source, self.id, False, 2, relative_uris) + r["source"] = u + if self.linkMerge is not None: + r["linkMerge"] = save( + self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.pickValue is not None: + r["pickValue"] = save( + self.pickValue, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.valueFrom is not None: + r["valueFrom"] = save( + self.valueFrom, top=False, base_url=self.id, relative_uris=relative_uris + ) + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + id: str, + source: None | Sequence[str] | str = None, + linkMerge: LinkMergeMethod | None = None, + pickValue: None | PickValueMethod = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + label: None | str = None, + default: CWLObjectType | None = None, + valueFrom: None | str = None, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.id = id + self.source = source + self.linkMerge = linkMerge + self.pickValue = pickValue + self.loadContents = loadContents + self.loadListing = loadListing + self.label = label + self.default = default + self.valueFrom = valueFrom + + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "source", + "linkMerge", + "pickValue", + "loadContents", + "loadListing", + "label", + "default", + "valueFrom", + ] + ) + + +@mypyc_attr(native_class=True) +class WorkflowStepOutput(Saveable): + """ + Associate an output parameter of the underlying process with a workflow parameter. The workflow parameter (given in the ``id`` field) be may be used as a ``source`` to connect with input parameters of other workflow steps, or with an output parameter of the process. + + A unique identifier for this workflow output parameter. This is the identifier to use in the ``source`` field of ``WorkflowStepInput`` to connect the output value to downstream parameters. + + """ + + id: str + + def __eq__(self, other: Any) -> bool: + if isinstance(other, WorkflowStepOutput): + return bool(self.id == other.id) + return False + + def __hash__(self) -> int: + return hash((self.id)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `id`": _errors__.append( ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -25386,16 +20827,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`".format( - k - ), + "invalid field `{}`, expected one of: `id`".format(k), SourceLine(_doc, k, str), ) ) @@ -25404,15 +20843,6 @@ def fromDoc( raise ValidationException("", None, _errors__, "*") _constructed = cls( id=id, - label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, - doc=doc, - format=format, - loadContents=loadContents, - loadListing=loadListing, - default=default, - type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -25433,53 +20863,6 @@ def save( if self.id is not None: u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.loadContents is not None: - r["loadContents"] = save( - self.loadContents, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.loadListing is not None: - r["loadListing"] = save( - self.loadListing, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris - ) # top refers to the directory level if top: @@ -25492,15 +20875,6 @@ def save( def __init__( self, id: str, - type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, - label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, - doc: None | Sequence[str] | str = None, - format: None | Sequence[str] | str = None, - loadContents: None | bool = None, - loadListing: LoadListingEnum | None = None, - default: CWLObjectType | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -25512,65 +20886,90 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable - self.doc = doc self.id = id - self.format = format - self.loadContents = loadContents - self.loadListing = loadListing - self.default = default - self.type_ = type_ - attrs: ClassVar[Collection[str]] = frozenset( - [ - "label", - "secondaryFiles", - "streamable", - "doc", - "id", - "format", - "loadContents", - "loadListing", - "default", - "type", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["id"]) @mypyc_attr(native_class=True) -class OperationOutputParameter(Saveable): +class WorkflowStep(schema_salad.metaschema.Documented): """ - Describe an output parameter of an operation. + A workflow step is an executable element of a workflow. It specifies the underlying process implementation (such as ``CommandLineTool`` or another ``Workflow``) in the ``run`` field and connects the input and output parameters of the underlying process to workflow parameters. + + Scatter/gather + ============== + + To use scatter/gather, `ScatterFeatureRequirement <#ScatterFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. + + A "scatter" operation specifies that the associated workflow step or subworkflow should execute separately over a list of input elements. Each job making up a scatter operation is independent and may be executed concurrently. + + The ``scatter`` field specifies one or more input parameters which will be scattered. An input parameter may be listed more than once. The declared type of each input parameter implicitly becomes an array of items of the input parameter type. If a parameter is listed more than once, it becomes a nested array. As a result, upstream parameters which are connected to scattered parameters must be arrays. + + All output parameter types are also implicitly wrapped in arrays. Each job in the scatter results in an entry in the output array. + + If any scattered parameter runtime value is an empty array, all outputs are set to empty arrays and no work is done for the step, according to applicable scattering rules. + + If ``scatter`` declares more than one input parameter, ``scatterMethod`` describes how to decompose the input into a discrete set of jobs. + + * **dotproduct** specifies that each of the input arrays are aligned and one element taken from each array to construct each job. It is an error if all input arrays are not the same length. + + * **nested_crossproduct** specifies the Cartesian product of the inputs, producing a job for every combination of the scattered inputs. The output must be nested arrays for each level of scattering, in the order that the input arrays are listed in the ``scatter`` field. + + * **flat_crossproduct** specifies the Cartesian product of the inputs, producing a job for every combination of the scattered inputs. The output arrays must be flattened to a single level, but otherwise listed in the order that the input arrays are listed in the ``scatter`` field. + + Conditional execution (Optional) + ================================ + + Conditional execution makes execution of a step conditional on an expression. A step that is not executed is "skipped". A skipped step produces ``null`` for all output parameters. + + The condition is evaluated after ``scatter``, using the input object of each individual scatter job. This means over a set of scatter jobs, some may be executed and some may be skipped. When the results are gathered, skipped steps must be ``null`` in the output arrays. + + The ``when`` field controls conditional execution. This is an expression that must be evaluated with ``inputs`` bound to the step input object (or individual scatter job), and returns a boolean value. It is an error if this expression returns a value other than ``true`` or ``false``. + + Conditionals in CWL are an optional feature and are not required to be implemented by all consumers of CWL documents. An implementation that does not support conditionals must return a fatal error when attempting to execute a workflow that uses conditional constructs the implementation does not support. + + Subworkflows + ============ + + To specify a nested workflow as part of a workflow step, `SubworkflowFeatureRequirement <#SubworkflowFeatureRequirement>`__ must be specified in the workflow or workflow step requirements. + + It is a fatal error if a workflow directly or indirectly invokes itself as a subworkflow (recursive workflows are not allowed). """ id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, OperationOutputParameter): + if isinstance(other, WorkflowStep): return bool( - self.label == other.label - and self.secondaryFiles == other.secondaryFiles - and self.streamable == other.streamable + self.id == other.id + and self.label == other.label and self.doc == other.doc - and self.id == other.id - and self.format == other.format - and self.type_ == other.type_ + and self.in_ == other.in_ + and self.out == other.out + and self.requirements == other.requirements + and self.hints == other.hints + and self.run == other.run + and self.when == other.when + and self.scatter == other.scatter + and self.scatterMethod == other.scatterMethod ) return False def __hash__(self) -> int: return hash( ( + self.id, self.label, - self.secondaryFiles, - self.streamable, self.doc, - self.id, - self.format, - self.type_, + self.in_, + self.out, + self.requirements, + self.hints, + self.run, + self.when, + self.scatter, + self.scatterMethod, ) ) @@ -25591,18 +20990,121 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( - _doc.get("id"), - uri_strtype_True_False_None_None, + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("id") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `id`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -25610,13 +21112,13 @@ def fromDoc( ) ) else: - val = _doc.get("id") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25628,37 +21130,124 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `id` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) + try: + if _doc.get("in") is None: + raise ValidationException("missing required field `in`", None, []) - if id is None: - if docRoot is not None: - id = docRoot + in_ = _load_field( + _doc.get("in"), + idmap_in__array_of_WorkflowStepInputLoader, + baseuri, + loadingOptions, + lc=_doc.get("in") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `in`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) else: - id = "" - _errors__.append(ValidationException("missing id")) - else: - baseuri = id - label = None - if "label" in _doc: + val = _doc.get("in") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `in` field is not valid because:", + SourceLine(_doc, "in", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `in` field is not valid because:", + SourceLine(_doc, "in", str), + [e], + detailed_message=f"the `in` field with value `{val}` " + "is not valid because:", + ) + ) + try: + if _doc.get("out") is None: + raise ValidationException("missing required field `out`", None, []) + + out = _load_field( + _doc.get("out"), + uri_union_of_array_of_union_of_strtype_or_WorkflowStepOutputLoader_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("out") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `out`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("out") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `out` field is not valid because:", + SourceLine(_doc, "out", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `out` field is not valid because:", + SourceLine(_doc, "out", str), + [e], + detailed_message=f"the `out` field with value `{val}` " + "is not valid because:", + ) + ) + requirements = None + if "requirements" in _doc: try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, baseuri, loadingOptions, - lc=_doc.get("label") + lc=_doc.get("requirements") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `label`": + if str(e) == "missing required field `requirements`": _errors__.append( ValidationException( str(e), @@ -25666,13 +21255,13 @@ def fromDoc( ) ) else: - val = _doc.get("label") + val = _doc.get("requirements") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25684,28 +21273,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), [e], - detailed_message=f"the `label` field with value `{val}` " + detailed_message=f"the `requirements` field with value `{val}` " "is not valid because:", ) ) - secondaryFiles = None - if "secondaryFiles" in _doc: + hints = None + if "hints" in _doc: try: - secondaryFiles = load_field( - _doc.get("secondaryFiles"), - secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_Any_type, baseuri, loadingOptions, - lc=_doc.get("secondaryFiles") + lc=_doc.get("hints") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `secondaryFiles`": + if str(e) == "missing required field `hints`": _errors__.append( ValidationException( str(e), @@ -25713,13 +21302,13 @@ def fromDoc( ) ) else: - val = _doc.get("secondaryFiles") + val = _doc.get("hints") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25731,28 +21320,78 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `secondaryFiles` field is not valid because:", - SourceLine(_doc, "secondaryFiles", str), + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), [e], - detailed_message=f"the `secondaryFiles` field with value `{val}` " + detailed_message=f"the `hints` field with value `{val}` " "is not valid because:", ) ) - streamable = None - if "streamable" in _doc: + + subscope_baseuri = _expand_url('run', baseuri, loadingOptions, True) + try: + if _doc.get("run") is None: + raise ValidationException("missing required field `run`", None, []) + + run = _load_field( + _doc.get("run"), + uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_False_False_None_None, + subscope_baseuri, + loadingOptions, + lc=_doc.get("run") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `run`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("run") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `run` field is not valid because:", + SourceLine(_doc, "run", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `run` field is not valid because:", + SourceLine(_doc, "run", str), + [e], + detailed_message=f"the `run` field with value `{val}` " + "is not valid because:", + ) + ) + when = None + if "when" in _doc: try: - streamable = load_field( - _doc.get("streamable"), - union_of_None_type_or_booltype, + when = _load_field( + _doc.get("when"), + union_of_None_type_or_ExpressionLoader, baseuri, loadingOptions, - lc=_doc.get("streamable") + lc=_doc.get("when") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `streamable`": + if str(e) == "missing required field `when`": _errors__.append( ValidationException( str(e), @@ -25760,13 +21399,13 @@ def fromDoc( ) ) else: - val = _doc.get("streamable") + val = _doc.get("when") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `when` field is not valid because:", + SourceLine(_doc, "when", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25778,28 +21417,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `streamable` field is not valid because:", - SourceLine(_doc, "streamable", str), + "the `when` field is not valid because:", + SourceLine(_doc, "when", str), [e], - detailed_message=f"the `streamable` field with value `{val}` " + detailed_message=f"the `when` field with value `{val}` " "is not valid because:", ) ) - doc = None - if "doc" in _doc: + scatter = None + if "scatter" in _doc: try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, + scatter = _load_field( + _doc.get("scatter"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_0_None, baseuri, loadingOptions, - lc=_doc.get("doc") + lc=_doc.get("scatter") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `doc`": + if str(e) == "missing required field `scatter`": _errors__.append( ValidationException( str(e), @@ -25807,13 +21446,13 @@ def fromDoc( ) ) else: - val = _doc.get("doc") + val = _doc.get("scatter") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `scatter` field is not valid because:", + SourceLine(_doc, "scatter", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25825,28 +21464,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), + "the `scatter` field is not valid because:", + SourceLine(_doc, "scatter", str), [e], - detailed_message=f"the `doc` field with value `{val}` " + detailed_message=f"the `scatter` field with value `{val}` " "is not valid because:", ) ) - format = None - if "format" in _doc: + scatterMethod = None + if "scatterMethod" in _doc: try: - format = load_field( - _doc.get("format"), - uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + scatterMethod = _load_field( + _doc.get("scatterMethod"), + uri_union_of_None_type_or_ScatterMethodLoader_False_True_None_None, baseuri, loadingOptions, - lc=_doc.get("format") + lc=_doc.get("scatterMethod") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `format`": + if str(e) == "missing required field `scatterMethod`": _errors__.append( ValidationException( str(e), @@ -25854,13 +21493,13 @@ def fromDoc( ) ) else: - val = _doc.get("format") + val = _doc.get("scatterMethod") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `scatterMethod` field is not valid because:", + SourceLine(_doc, "scatterMethod", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -25872,61 +21511,13 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `format` field is not valid because:", - SourceLine(_doc, "format", str), + "the `scatterMethod` field is not valid because:", + SourceLine(_doc, "scatterMethod", str), [e], - detailed_message=f"the `format` field with value `{val}` " + detailed_message=f"the `scatterMethod` field with value `{val}` " "is not valid because:", ) ) - try: - if _doc.get("type") is None: - raise ValidationException("missing required field `type`", None, []) - - type_ = load_field( - _doc.get("type"), - typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, - baseuri, - loadingOptions, - lc=_doc.get("type") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `type`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("type") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `type` field is not valid because:", - SourceLine(_doc, "type", str), - [e], - detailed_message=f"the `type` field with value `{val}` " - "is not valid because:", - ) - ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -25935,14 +21526,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `in`, `out`, `requirements`, `hints`, `run`, `when`, `scatter`, `scatterMethod`".format( k ), SourceLine(_doc, k, str), @@ -25954,11 +21545,15 @@ def fromDoc( _constructed = cls( id=id, label=label, - secondaryFiles=secondaryFiles, - streamable=streamable, doc=doc, - format=format, - type_=type_, + in_=in_, + out=out, + requirements=requirements, + hints=hints, + run=run, + when=when, + scatter=scatter, + scatterMethod=scatterMethod, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -25983,31 +21578,43 @@ def save( r["label"] = save( self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.secondaryFiles is not None: - r["secondaryFiles"] = save( - self.secondaryFiles, - top=False, - base_url=self.id, - relative_uris=relative_uris, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.streamable is not None: - r["streamable"] = save( - self.streamable, + if self.in_ is not None: + r["in"] = save( + self.in_, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.out is not None: + u = save_relative_uri(self.out, self.id, True, None, relative_uris) + r["out"] = u + if self.requirements is not None: + r["requirements"] = save( + self.requirements, top=False, base_url=self.id, relative_uris=relative_uris, ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.format is not None: - u = save_relative_uri(self.format, self.id, True, None, relative_uris) - r["format"] = u - if self.type_ is not None: - r["type"] = save( - self.type_, top=False, base_url=self.id, relative_uris=relative_uris + if self.run is not None: + u = save_relative_uri(self.run, self.id, False, None, relative_uris) + r["run"] = u + if self.when is not None: + r["when"] = save( + self.when, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.scatter is not None: + u = save_relative_uri(self.scatter, self.id, False, 0, relative_uris) + r["scatter"] = u + if self.scatterMethod is not None: + u = save_relative_uri( + self.scatterMethod, self.id, False, None, relative_uris ) + r["scatterMethod"] = u # top refers to the directory level if top: @@ -26020,12 +21627,16 @@ def save( def __init__( self, id: str, - type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + in_: Sequence[WorkflowStepInput], + out: Sequence[WorkflowStepOutput | str], + run: CommandLineTool | ExpressionTool | Operation | Workflow | str, label: None | str = None, - secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, - streamable: None | bool = None, doc: None | Sequence[str] | str = None, - format: None | str = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any] = None, + when: None | str = None, + scatter: None | Sequence[str] | str = None, + scatterMethod: None | ScatterMethod = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -26037,36 +21648,70 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() + self.id = id self.label = label - self.secondaryFiles = secondaryFiles - self.streamable = streamable self.doc = doc - self.id = id - self.format = format - self.type_ = type_ + self.in_ = in_ + self.out = out + self.requirements = requirements + self.hints = hints + self.run = run + self.when = when + self.scatter = scatter + self.scatterMethod = scatterMethod attrs: ClassVar[Collection[str]] = frozenset( - ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] + [ + "id", + "label", + "doc", + "in", + "out", + "requirements", + "hints", + "run", + "when", + "scatter", + "scatterMethod", + ] ) @mypyc_attr(native_class=True) -class Operation(Saveable): +class Workflow(Saveable): """ - This record describes an abstract operation. It is a potential - step of a workflow that has not yet been bound to a concrete - implementation. It specifies an input and output signature, but - does not provide enough information to be executed. An - implementation (or other tooling) may provide a means of binding - an Operation to a concrete process (such as Workflow, - CommandLineTool, or ExpressionTool) with a compatible signature. + A workflow describes a set of **steps** and the **dependencies** between those steps. When a step produces output that will be consumed by a second step, the first step is a dependency of the second step. + + When there is a dependency, the workflow engine must execute the preceding step and wait for it to successfully produce output before executing the dependent step. If two steps are defined in the workflow graph that are not directly or indirectly dependent, these steps are **independent**, and may execute in any order or execute concurrently. A workflow is complete when all steps have been executed. + + Dependencies between parameters are expressed using the ``source`` field on `workflow step input parameters <#WorkflowStepInput>`__ and ``outputSource`` field on `workflow output parameters <#WorkflowOutputParameter>`__. + + The ``source`` field on each workflow step input parameter expresses the data links that contribute to the value of the step input parameter (the "sink"). A workflow step can only begin execution when every data link connected to a step has been fulfilled. + + The ``outputSource`` field on each workflow step input parameter expresses the data links that contribute to the value of the workflow output parameter (the "sink"). Workflow execution cannot complete successfully until every data link connected to an output parameter has been fulfilled. + + Workflow success and failure + ---------------------------- + + A completed step must result in one of ``success``, ``temporaryFailure`` or ``permanentFailure`` states. An implementation may choose to retry a step execution which resulted in ``temporaryFailure``. An implementation may choose to either continue running other steps of a workflow, or terminate immediately upon ``permanentFailure``. + + * If any step of a workflow execution results in ``permanentFailure``, then the workflow status is ``permanentFailure``. + + * If one or more steps result in ``temporaryFailure`` and all other steps complete ``success`` or are not executed, then the workflow status is ``temporaryFailure``. + + * If all workflow steps are executed and complete with ``success``, then the workflow status is ``success``. + + Extensions + ========== + + `ScatterFeatureRequirement <#ScatterFeatureRequirement>`__ and `SubworkflowFeatureRequirement <#SubworkflowFeatureRequirement>`__ are available as standard `extensions <#Extensions_and_Metadata>`__ to core workflow semantics. """ id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, Operation): + if isinstance(other, Workflow): return bool( self.id == other.id and self.label == other.label @@ -26078,6 +21723,7 @@ def __eq__(self, other: Any) -> bool: and self.cwlVersion == other.cwlVersion and self.intent == other.intent and self.class_ == other.class_ + and self.steps == other.steps ) return False @@ -26094,6 +21740,7 @@ def __hash__(self) -> int: self.cwlVersion, self.intent, self.class_, + self.steps, ) ) @@ -26114,7 +21761,7 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), uri_union_of_None_type_or_strtype_True_False_None_None, baseuri, @@ -26170,22 +21817,23 @@ def fromDoc( if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_Operation_classLoader_False_True_None_None, + uri_Workflow_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + raise e label = None if "label" in _doc: try: - label = load_field( + label = _load_field( _doc.get("label"), union_of_None_type_or_strtype, baseuri, @@ -26232,7 +21880,7 @@ def fromDoc( doc = None if "doc" in _doc: try: - doc = load_field( + doc = _load_field( _doc.get("doc"), union_of_None_type_or_strtype_or_array_of_strtype, baseuri, @@ -26280,9 +21928,9 @@ def fromDoc( if _doc.get("inputs") is None: raise ValidationException("missing required field `inputs`", None, []) - inputs = load_field( + inputs = _load_field( _doc.get("inputs"), - idmap_inputs_array_of_OperationInputParameterLoader, + idmap_inputs_array_of_WorkflowInputParameterLoader, baseuri, loadingOptions, lc=_doc.get("inputs") @@ -26328,9 +21976,9 @@ def fromDoc( if _doc.get("outputs") is None: raise ValidationException("missing required field `outputs`", None, []) - outputs = load_field( + outputs = _load_field( _doc.get("outputs"), - idmap_outputs_array_of_OperationOutputParameterLoader, + idmap_outputs_array_of_WorkflowOutputParameterLoader, baseuri, loadingOptions, lc=_doc.get("outputs") @@ -26375,9 +22023,9 @@ def fromDoc( requirements = None if "requirements" in _doc: try: - requirements = load_field( + requirements = _load_field( _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, baseuri, loadingOptions, lc=_doc.get("requirements") @@ -26422,9 +22070,9 @@ def fromDoc( hints = None if "hints" in _doc: try: - hints = load_field( + hints = _load_field( _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, baseuri, loadingOptions, lc=_doc.get("hints") @@ -26469,7 +22117,7 @@ def fromDoc( cwlVersion = None if "cwlVersion" in _doc: try: - cwlVersion = load_field( + cwlVersion = _load_field( _doc.get("cwlVersion"), uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, baseuri, @@ -26516,7 +22164,7 @@ def fromDoc( intent = None if "intent" in _doc: try: - intent = load_field( + intent = _load_field( _doc.get("intent"), uri_union_of_None_type_or_array_of_strtype_True_False_None_None, baseuri, @@ -26560,6 +22208,54 @@ def fromDoc( "is not valid because:", ) ) + try: + if _doc.get("steps") is None: + raise ValidationException("missing required field `steps`", None, []) + + steps = _load_field( + _doc.get("steps"), + idmap_steps_union_of_array_of_WorkflowStepLoader, + baseuri, + loadingOptions, + lc=_doc.get("steps") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `steps`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("steps") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `steps` field is not valid because:", + SourceLine(_doc, "steps", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `steps` field is not valid because:", + SourceLine(_doc, "steps", str), + [e], + detailed_message=f"the `steps` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -26568,14 +22264,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`, `steps`".format( k ), SourceLine(_doc, k, str), @@ -26594,6 +22290,7 @@ def fromDoc( hints=hints, cwlVersion=cwlVersion, intent=intent, + steps=steps, extension_fields=extension_fields, loadingOptions=loadingOptions, ) @@ -26615,8 +22312,10 @@ def save( u = save_relative_uri(self.id, self.id, True, None, relative_uris) r["id"] = u if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ @@ -26655,6 +22354,10 @@ def save( if self.intent is not None: u = save_relative_uri(self.intent, self.id, True, None, relative_uris) r["intent"] = u + if self.steps is not None: + r["steps"] = save( + self.steps, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -26666,13 +22369,14 @@ def save( def __init__( self, - inputs: Sequence[OperationInputParameter], - outputs: Sequence[OperationOutputParameter], + inputs: Sequence[WorkflowInputParameter], + outputs: Sequence[WorkflowOutputParameter], + steps: Sequence[WorkflowStep], id: None | str = None, label: None | str = None, doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, cwlVersion: CWLVersion | None = None, intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, @@ -26695,7 +22399,8 @@ def __init__( self.hints = hints self.cwlVersion = cwlVersion self.intent = intent - self.class_: Final[str] = "Operation" + self.class_: Final[str] = "Workflow" + self.steps = steps attrs: ClassVar[Collection[str]] = frozenset( [ @@ -26709,731 +22414,301 @@ def __init__( "cwlVersion", "intent", "class", + "steps", ] ) @mypyc_attr(native_class=True) -class Secrets(Saveable): - def __eq__(self, other: Any) -> bool: - if isinstance(other, Secrets): - return bool(self.class_ == other.class_ and self.secrets == other.secrets) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.secrets)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("secrets") is None: - raise ValidationException("missing required field `secrets`", None, []) - - secrets = load_field( - _doc.get("secrets"), - uri_array_of_strtype_False_False_0_None, - baseuri, - loadingOptions, - lc=_doc.get("secrets") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `secrets`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("secrets") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `secrets` field is not valid because:", - SourceLine(_doc, "secrets", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `secrets` field is not valid because:", - SourceLine(_doc, "secrets", str), - [e], - detailed_message=f"the `secrets` field with value `{val}` " - "is not valid because:", - ) - ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `secrets`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - secrets=secrets, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.secrets is not None: - u = save_relative_uri(self.secrets, base_url, False, 0, relative_uris) - r["secrets"] = u - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - secrets: Sequence[str], - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "Secrets" - self.secrets = secrets - - attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"]) - +class SubworkflowFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support nested workflows in the ``run`` field of `WorkflowStep <#WorkflowStep>`__. -@mypyc_attr(native_class=True) -class ProcessGenerator(Saveable): - id: str + """ def __eq__(self, other: Any) -> bool: - if isinstance(other, ProcessGenerator): - return bool( - self.id == other.id - and self.label == other.label - and self.doc == other.doc - and self.inputs == other.inputs - and self.outputs == other.outputs - and self.requirements == other.requirements - and self.hints == other.hints - and self.cwlVersion == other.cwlVersion - and self.intent == other.intent - and self.class_ == other.class_ - and self.run == other.run - ) + if isinstance(other, SubworkflowFeatureRequirement): + return bool(self.class_ == other.class_) return False def __hash__(self) -> int: - return hash( - ( - self.id, - self.label, - self.doc, - self.inputs, - self.outputs, - self.requirements, - self.hints, - self.cwlVersion, - self.intent, - self.class_, - self.run, - ) - ) + return hash((self.class_)) @classmethod def fromDoc( cls, doc: Any, baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - id = None - if "id" in _doc: - try: - id = load_field( - _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("id") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `id`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("id") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `id` field is not valid because:", - SourceLine(_doc, "id", str), - [e], - detailed_message=f"the `id` field with value `{val}` " - "is not valid because:", - ) - ) + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) - if id is None: - if docRoot is not None: - id = docRoot - else: - id = "_:" + str(_uuid__.uuid4()) - else: - baseuri = id + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] try: if _doc.get("class") is None: raise ValidationException("missing required field `class`", None, []) - class_ = load_field( + class_ = _load_field( _doc.get("class"), - uri_strtype_False_True_None_None, + uri_SubworkflowFeatureRequirement_classLoader_False_True_None_None, baseuri, loadingOptions, lc=_doc.get("class") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e - label = None - if "label" in _doc: - try: - label = load_field( - _doc.get("label"), - union_of_None_type_or_strtype, - baseuri, - loadingOptions, - lc=_doc.get("label") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `label`": + raise e + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - str(e), - None - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: - val = _doc.get("label") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `label` field is not valid because:", - SourceLine(_doc, "label", str), - [e], - detailed_message=f"the `label` field with value `{val}` " - "is not valid because:", - ) - ) - doc = None - if "doc" in _doc: - try: - doc = load_field( - _doc.get("doc"), - union_of_None_type_or_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("doc") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - str(e), - None + "invalid field `{}`, expected one of: `class`".format(k), + SourceLine(_doc, k, str), ) ) - else: - val = _doc.get("doc") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `doc` field is not valid because:", - SourceLine(_doc, "doc", str), - [e], - detailed_message=f"the `doc` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("inputs") is None: - raise ValidationException("missing required field `inputs`", None, []) - inputs = load_field( - _doc.get("inputs"), - idmap_inputs_array_of_WorkflowInputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("inputs") - ) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} - if str(e) == "missing required field `inputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" else: - val = _doc.get("inputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `inputs` field is not valid because:", - SourceLine(_doc, "inputs", str), - [e], - detailed_message=f"the `inputs` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("outputs") is None: - raise ValidationException("missing required field `outputs`", None, []) + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u - outputs = load_field( - _doc.get("outputs"), - idmap_outputs_array_of_ExpressionToolOutputParameterLoader, - baseuri, - loadingOptions, - lc=_doc.get("outputs") - ) + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "SubworkflowFeatureRequirement" - if str(e) == "missing required field `outputs`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("outputs") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class ScatterFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support the ``scatter`` and ``scatterMethod`` fields of `WorkflowStep <#WorkflowStep>`__. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, ScatterFeatureRequirement): + return bool(self.class_ == other.class_) + return False + + def __hash__(self) -> int: + return hash((self.class_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_ScatterFeatureRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: _errors__.append( - ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False ) + extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "the `outputs` field is not valid because:", - SourceLine(_doc, "outputs", str), - [e], - detailed_message=f"the `outputs` field with value `{val}` " - "is not valid because:", + "invalid field `{}`, expected one of: `class`".format(k), + SourceLine(_doc, k, str), ) ) - requirements = None - if "requirements" in _doc: - try: - requirements = load_field( - _doc.get("requirements"), - idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, - baseuri, - loadingOptions, - lc=_doc.get("requirements") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed - if str(e) == "missing required field `requirements`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("requirements") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `requirements` field is not valid because:", - SourceLine(_doc, "requirements", str), - [e], - detailed_message=f"the `requirements` field with value `{val}` " - "is not valid because:", - ) - ) - hints = None - if "hints" in _doc: - try: - hints = load_field( - _doc.get("hints"), - idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("hints") - ) + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u - if str(e) == "missing required field `hints`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("hints") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `hints` field is not valid because:", - SourceLine(_doc, "hints", str), - [e], - detailed_message=f"the `hints` field with value `{val}` " - "is not valid because:", - ) - ) - cwlVersion = None - if "cwlVersion" in _doc: - try: - cwlVersion = load_field( - _doc.get("cwlVersion"), - uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("cwlVersion") - ) + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "ScatterFeatureRequirement" - if str(e) == "missing required field `cwlVersion`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cwlVersion") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `cwlVersion` field is not valid because:", - SourceLine(_doc, "cwlVersion", str), - [e], - detailed_message=f"the `cwlVersion` field with value `{val}` " - "is not valid because:", - ) - ) - intent = None - if "intent" in _doc: - try: - intent = load_field( - _doc.get("intent"), - uri_union_of_None_type_or_array_of_strtype_True_False_None_None, - baseuri, - loadingOptions, - lc=_doc.get("intent") - ) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `intent`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("intent") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `intent` field is not valid because:", - SourceLine(_doc, "intent", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `intent` field is not valid because:", - SourceLine(_doc, "intent", str), - [e], - detailed_message=f"the `intent` field with value `{val}` " - "is not valid because:", - ) - ) +@mypyc_attr(native_class=True) +class MultipleInputFeatureRequirement(Saveable): + """ + Indicates that the workflow platform must support multiple inbound data links listed in the ``source`` field of `WorkflowStepInput <#WorkflowStepInput>`__. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, MultipleInputFeatureRequirement): + return bool(self.class_ == other.class_) + return False + + def __hash__(self) -> int: + return hash((self.class_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) - subscope_baseuri = expand_url('run', baseuri, loadingOptions, True) + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] try: - if _doc.get("run") is None: - raise ValidationException("missing required field `run`", None, []) + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) - run = load_field( - _doc.get("run"), - uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None, - subscope_baseuri, + class_ = _load_field( + _doc.get("class"), + uri_MultipleInputFeatureRequirement_classLoader_False_True_None_None, + baseuri, loadingOptions, - lc=_doc.get("run") + lc=_doc.get("class") ) + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `run`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("run") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `run` field is not valid because:", - SourceLine(_doc, "run", str), - [e], - detailed_message=f"the `run` field with value `{val}` " - "is not valid because:", - ) - ) + raise e extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -27442,16 +22717,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`, `run`".format( - k - ), + "invalid field `{}`, expected one of: `class`".format(k), SourceLine(_doc, k, str), ) ) @@ -27459,20 +22732,9 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - id=id, - label=label, - doc=doc, - inputs=inputs, - outputs=outputs, - requirements=requirements, - hints=hints, - cwlVersion=cwlVersion, - intent=intent, - run=run, extension_fields=extension_fields, loadingOptions=loadingOptions, ) - loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -27486,53 +22748,16 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ - u = save_relative_uri(uri, self.id, False, None, relative_uris) + u = save_relative_uri(uri, base_url, False, None, relative_uris) r["class"] = u - if self.label is not None: - r["label"] = save( - self.label, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.doc is not None: - r["doc"] = save( - self.doc, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.inputs is not None: - r["inputs"] = save( - self.inputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.outputs is not None: - r["outputs"] = save( - self.outputs, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.requirements is not None: - r["requirements"] = save( - self.requirements, - top=False, - base_url=self.id, - relative_uris=relative_uris, - ) - if self.hints is not None: - r["hints"] = save( - self.hints, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.cwlVersion is not None: - u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) - r["cwlVersion"] = u - if self.intent is not None: - u = save_relative_uri(self.intent, self.id, True, None, relative_uris) - r["intent"] = u - if self.run is not None: - u = save_relative_uri(self.run, self.id, False, None, relative_uris) - r["run"] = u # top refers to the directory level if top: @@ -27544,16 +22769,6 @@ def save( def __init__( self, - inputs: Sequence[WorkflowInputParameter], - outputs: Sequence[ExpressionToolOutputParameter], - run: CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str, - id: None | str = None, - label: None | str = None, - doc: None | Sequence[str] | str = None, - requirements: None | Sequence[CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - hints: None | Sequence[Any | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | Loop | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | Secrets | ShellCommandRequirement | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, - cwlVersion: CWLVersion | None = None, - intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -27565,51 +22780,173 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.label = label - self.doc = doc - self.inputs = inputs - self.outputs = outputs - self.requirements = requirements - self.hints = hints - self.cwlVersion = cwlVersion - self.intent = intent - self.class_: Final[str] = "ProcessGenerator" - self.run = run + self.class_: Final[str] = "MultipleInputFeatureRequirement" - attrs: ClassVar[Collection[str]] = frozenset( - [ - "id", - "label", - "doc", - "inputs", - "outputs", - "requirements", - "hints", - "cwlVersion", - "intent", - "class", - "run", - ] - ) + attrs: ClassVar[Collection[str]] = frozenset(["class"]) + + +@mypyc_attr(native_class=True) +class StepInputExpressionRequirement(Saveable): + """ + Indicate that the workflow platform must support the ``valueFrom`` field of `WorkflowStepInput <#WorkflowStepInput>`__. + + """ + + def __eq__(self, other: Any) -> bool: + if isinstance(other, StepInputExpressionRequirement): + return bool(self.class_ == other.class_) + return False + + def __hash__(self) -> int: + return hash((self.class_)) + + @classmethod + def fromDoc( + cls, + doc: Any, + baseuri: str, + loadingOptions: LoadingOptions, + docRoot: str | None = None + ) -> Self: + _doc = copy.copy(doc) + + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_StepInputExpressionRequirement_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + extension_fields: MutableMapping[str, Any] = {} + for k in _doc.keys(): + if k not in cls.attrs: + if not k: + _errors__.append( + ValidationException("mapping with implicit null key") + ) + elif ":" in k: + ex = _expand_url( + k, "", loadingOptions, scoped_id=False, vocab_term=False + ) + extension_fields[ex] = _doc[k] + else: + _errors__.append( + ValidationException( + "invalid field `{}`, expected one of: `class`".format(k), + SourceLine(_doc, k, str), + ) + ) + + if _errors__: + raise ValidationException("", None, _errors__, "*") + _constructed = cls( + extension_fields=extension_fields, + loadingOptions=loadingOptions, + ) + return _constructed + + def save( + self, top: bool = False, base_url: str = "", relative_uris: bool = True + ) -> dict[str, Any]: + r: dict[str, Any] = {} + + if relative_uris: + for ef in self.extension_fields: + r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] + else: + for ef in self.extension_fields: + r[ef] = self.extension_fields[ef] + if self.class_ is not None: + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): + uri = f"{p}:{self.class_}" + else: + uri = self.class_ + u = save_relative_uri(uri, base_url, False, None, relative_uris) + r["class"] = u + + # top refers to the directory level + if top: + if self.loadingOptions.namespaces: + r["$namespaces"] = self.loadingOptions.namespaces + if self.loadingOptions.schemas: + r["$schemas"] = self.loadingOptions.schemas + return r + + def __init__( + self, + extension_fields: MutableMapping[str, Any] | None = None, + loadingOptions: LoadingOptions | None = None, + ) -> None: + if extension_fields: + self.extension_fields = extension_fields + else: + self.extension_fields = CommentedMap() + if loadingOptions: + self.loadingOptions = loadingOptions + else: + self.loadingOptions = LoadingOptions() + self.class_: Final[str] = "StepInputExpressionRequirement" + + attrs: ClassVar[Collection[str]] = frozenset(["class"]) @mypyc_attr(native_class=True) -class MPIRequirement(Saveable): +class OperationInputParameter(Saveable): """ - Indicates that a process requires an MPI runtime. + Describe an input parameter of an operation. """ + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, MPIRequirement): + if isinstance(other, OperationInputParameter): return bool( - self.class_ == other.class_ and self.processes == other.processes + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc + and self.id == other.id + and self.format == other.format + and self.loadContents == other.loadContents + and self.loadListing == other.loadListing + and self.default == other.default + and self.type_ == other.type_ ) return False def __hash__(self) -> int: - return hash((self.class_, self.processes)) + return hash( + ( + self.label, + self.secondaryFiles, + self.streamable, + self.doc, + self.id, + self.format, + self.loadContents, + self.loadListing, + self.default, + self.type_, + ) + ) @classmethod def fromDoc( @@ -27625,278 +22962,359 @@ def fromDoc( _doc.lc.data = doc.lc.data _doc.lc.filename = doc.lc.filename _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("processes") is None: - raise ValidationException("missing required field `processes`", None, []) + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) - processes = load_field( - _doc.get("processes"), - union_of_inttype_or_ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("processes") - ) + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "" + _errors__.append(ValidationException("missing id")) + else: + baseuri = id + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `processes`": - _errors__.append( - ValidationException( - str(e), - None + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + secondaryFiles = None + if "secondaryFiles" in _doc: + try: + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, + baseuri, + loadingOptions, + lc=_doc.get("secondaryFiles") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `secondaryFiles`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("secondaryFiles") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), + [e], + detailed_message=f"the `secondaryFiles` field with value `{val}` " + "is not valid because:", + ) + ) + streamable = None + if "streamable" in _doc: + try: + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("streamable") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `streamable`": + _errors__.append( + ValidationException( + str(e), + None + ) ) + else: + val = _doc.get("streamable") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), + [e], + detailed_message=f"the `streamable` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") ) - else: - val = _doc.get("processes") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( - "the `processes` field is not valid because:", - SourceLine(_doc, "processes", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_array_of_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `format`": _errors__.append( ValidationException( - "the `processes` field is not valid because:", - SourceLine(_doc, "processes", str), - [e], - detailed_message=f"the `processes` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `class`, `processes`".format( - k - ), - SourceLine(_doc, k, str), + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - processes=processes, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.processes is not None: - r["processes"] = save( - self.processes, - top=False, - base_url=base_url, - relative_uris=relative_uris, - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - processes: i32 | str, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "MPIRequirement" - self.processes = processes - - attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"]) - - -@mypyc_attr(native_class=True) -class CUDARequirement(Saveable): - """ - Require support for NVIDA CUDA (GPU hardware acceleration). - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, CUDARequirement): - return bool( - self.class_ == other.class_ - and self.cudaComputeCapability == other.cudaComputeCapability - and self.cudaDeviceCountMax == other.cudaDeviceCountMax - and self.cudaDeviceCountMin == other.cudaDeviceCountMin - and self.cudaVersionMin == other.cudaVersionMin - ) - return False - - def __hash__(self) -> int: - return hash( - ( - self.class_, - self.cudaComputeCapability, - self.cudaDeviceCountMax, - self.cudaDeviceCountMin, - self.cudaVersionMin, - ) - ) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("cudaComputeCapability") is None: - raise ValidationException("missing required field `cudaComputeCapability`", None, []) - - cudaComputeCapability = load_field( - _doc.get("cudaComputeCapability"), - union_of_strtype_or_array_of_strtype, - baseuri, - loadingOptions, - lc=_doc.get("cudaComputeCapability") - ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) + loadContents = None + if "loadContents" in _doc: + try: + loadContents = _load_field( + _doc.get("loadContents"), + union_of_None_type_or_booltype, + baseuri, + loadingOptions, + lc=_doc.get("loadContents") + ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `cudaComputeCapability`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("cudaComputeCapability") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) + if str(e) == "missing required field `loadContents`": _errors__.append( ValidationException( - "the `cudaComputeCapability` field is not valid because:", - SourceLine(_doc, "cudaComputeCapability", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], + str(e), + None ) ) else: - _errors__.append( - ValidationException( - "the `cudaComputeCapability` field is not valid because:", - SourceLine(_doc, "cudaComputeCapability", str), - [e], - detailed_message=f"the `cudaComputeCapability` field with value `{val}` " - "is not valid because:", + val = _doc.get("loadContents") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `loadContents` field is not valid because:", + SourceLine(_doc, "loadContents", str), + [e], + detailed_message=f"the `loadContents` field with value `{val}` " + "is not valid because:", + ) ) - ) - cudaDeviceCountMax = None - if "cudaDeviceCountMax" in _doc: + loadListing = None + if "loadListing" in _doc: try: - cudaDeviceCountMax = load_field( - _doc.get("cudaDeviceCountMax"), - union_of_None_type_or_inttype_or_ExpressionLoader, + loadListing = _load_field( + _doc.get("loadListing"), + union_of_None_type_or_LoadListingEnumLoader, baseuri, loadingOptions, - lc=_doc.get("cudaDeviceCountMax") + lc=_doc.get("loadListing") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `cudaDeviceCountMax`": + if str(e) == "missing required field `loadListing`": _errors__.append( ValidationException( str(e), @@ -27904,13 +23322,13 @@ def fromDoc( ) ) else: - val = _doc.get("cudaDeviceCountMax") + val = _doc.get("loadListing") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `cudaDeviceCountMax` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMax", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -27922,28 +23340,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `cudaDeviceCountMax` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMax", str), + "the `loadListing` field is not valid because:", + SourceLine(_doc, "loadListing", str), [e], - detailed_message=f"the `cudaDeviceCountMax` field with value `{val}` " + detailed_message=f"the `loadListing` field with value `{val}` " "is not valid because:", ) ) - cudaDeviceCountMin = None - if "cudaDeviceCountMin" in _doc: + default = None + if "default" in _doc: try: - cudaDeviceCountMin = load_field( - _doc.get("cudaDeviceCountMin"), - union_of_None_type_or_inttype_or_ExpressionLoader, + default = _load_field( + _doc.get("default"), + union_of_None_type_or_CWLObjectTypeLoader, baseuri, loadingOptions, - lc=_doc.get("cudaDeviceCountMin") + lc=_doc.get("default") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `cudaDeviceCountMin`": + if str(e) == "missing required field `default`": _errors__.append( ValidationException( str(e), @@ -27951,13 +23369,13 @@ def fromDoc( ) ) else: - val = _doc.get("cudaDeviceCountMin") + val = _doc.get("default") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `cudaDeviceCountMin` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMin", str), + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -27969,29 +23387,29 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `cudaDeviceCountMin` field is not valid because:", - SourceLine(_doc, "cudaDeviceCountMin", str), + "the `default` field is not valid because:", + SourceLine(_doc, "default", str), [e], - detailed_message=f"the `cudaDeviceCountMin` field with value `{val}` " + detailed_message=f"the `default` field with value `{val}` " "is not valid because:", ) ) try: - if _doc.get("cudaVersionMin") is None: - raise ValidationException("missing required field `cudaVersionMin`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - cudaVersionMin = load_field( - _doc.get("cudaVersionMin"), - strtype, + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_InputRecordSchemaLoader_or_InputEnumSchemaLoader_or_InputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, - lc=_doc.get("cudaVersionMin") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `cudaVersionMin`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -27999,13 +23417,13 @@ def fromDoc( ) ) else: - val = _doc.get("cudaVersionMin") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `cudaVersionMin` field is not valid because:", - SourceLine(_doc, "cudaVersionMin", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -28017,10 +23435,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `cudaVersionMin` field is not valid because:", - SourceLine(_doc, "cudaVersionMin", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `cudaVersionMin` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) @@ -28032,14 +23450,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `cudaComputeCapability`, `cudaDeviceCountMax`, `cudaDeviceCountMin`, `cudaVersionMin`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `loadContents`, `loadListing`, `default`, `type`".format( k ), SourceLine(_doc, k, str), @@ -28049,13 +23467,20 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - cudaComputeCapability=cudaComputeCapability, - cudaDeviceCountMax=cudaDeviceCountMax, - cudaDeviceCountMin=cudaDeviceCountMin, - cudaVersionMin=cudaVersionMin, + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + loadContents=loadContents, + loadListing=loadListing, + default=default, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -28069,42 +23494,56 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.cudaComputeCapability is not None: - r["cudaComputeCapability"] = save( - self.cudaComputeCapability, + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.cudaDeviceCountMax is not None: - r["cudaDeviceCountMax"] = save( - self.cudaDeviceCountMax, + if self.streamable is not None: + r["streamable"] = save( + self.streamable, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.cudaDeviceCountMin is not None: - r["cudaDeviceCountMin"] = save( - self.cudaDeviceCountMin, + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.loadContents is not None: + r["loadContents"] = save( + self.loadContents, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) - if self.cudaVersionMin is not None: - r["cudaVersionMin"] = save( - self.cudaVersionMin, + if self.loadListing is not None: + r["loadListing"] = save( + self.loadListing, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) + if self.default is not None: + r["default"] = save( + self.default, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -28116,10 +23555,16 @@ def save( def __init__( self, - cudaComputeCapability: Sequence[str] | str, - cudaVersionMin: str, - cudaDeviceCountMax: None | i32 | str = None, - cudaDeviceCountMin: None | i32 | str = None, + id: str, + type_: CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | Sequence[CWLType | InputArraySchema | InputEnumSchema | InputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | Sequence[str] | str = None, + loadContents: None | bool = None, + loadListing: LoadListingEnum | None = None, + default: CWLObjectType | None = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -28131,48 +23576,65 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "CUDARequirement" - self.cudaComputeCapability = cudaComputeCapability - self.cudaDeviceCountMax = cudaDeviceCountMax - self.cudaDeviceCountMin = cudaDeviceCountMin - self.cudaVersionMin = cudaVersionMin + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.loadContents = loadContents + self.loadListing = loadListing + self.default = default + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( [ - "class", - "cudaComputeCapability", - "cudaDeviceCountMax", - "cudaDeviceCountMin", - "cudaVersionMin", + "label", + "secondaryFiles", + "streamable", + "doc", + "id", + "format", + "loadContents", + "loadListing", + "default", + "type", ] ) @mypyc_attr(native_class=True) -class LoopInput(Saveable): +class OperationOutputParameter(Saveable): + """ + Describe an output parameter of an operation. + + """ + id: str def __eq__(self, other: Any) -> bool: - if isinstance(other, LoopInput): + if isinstance(other, OperationOutputParameter): return bool( - self.default == other.default + self.label == other.label + and self.secondaryFiles == other.secondaryFiles + and self.streamable == other.streamable + and self.doc == other.doc and self.id == other.id - and self.linkMerge == other.linkMerge - and self.loopSource == other.loopSource - and self.pickValue == other.pickValue - and self.valueFrom == other.valueFrom + and self.format == other.format + and self.type_ == other.type_ ) return False def __hash__(self) -> int: return hash( ( - self.default, + self.label, + self.secondaryFiles, + self.streamable, + self.doc, self.id, - self.linkMerge, - self.loopSource, - self.pickValue, - self.valueFrom, + self.format, + self.type_, ) ) @@ -28193,9 +23655,9 @@ def fromDoc( id = None if "id" in _doc: try: - id = load_field( + id = _load_field( _doc.get("id"), - uri_union_of_None_type_or_strtype_True_False_None_None, + uri_strtype_True_False_None_None, baseuri, loadingOptions, lc=_doc.get("id") @@ -28242,71 +23704,25 @@ def fromDoc( if docRoot is not None: id = docRoot else: - id = "_:" + str(_uuid__.uuid4()) + id = "" + _errors__.append(ValidationException("missing id")) else: baseuri = id - default = None - if "default" in _doc: - try: - default = load_field( - _doc.get("default"), - union_of_None_type_or_Any_type, - baseuri, - loadingOptions, - lc=_doc.get("default") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `default`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("default") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `default` field is not valid because:", - SourceLine(_doc, "default", str), - [e], - detailed_message=f"the `default` field with value `{val}` " - "is not valid because:", - ) - ) - linkMerge = None - if "linkMerge" in _doc: + label = None + if "label" in _doc: try: - linkMerge = load_field( - _doc.get("linkMerge"), - union_of_None_type_or_LinkMergeMethodLoader, + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, baseuri, loadingOptions, - lc=_doc.get("linkMerge") + lc=_doc.get("label") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `linkMerge`": + if str(e) == "missing required field `label`": _errors__.append( ValidationException( str(e), @@ -28314,13 +23730,13 @@ def fromDoc( ) ) else: - val = _doc.get("linkMerge") + val = _doc.get("label") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -28332,28 +23748,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `linkMerge` field is not valid because:", - SourceLine(_doc, "linkMerge", str), + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), [e], - detailed_message=f"the `linkMerge` field with value `{val}` " + detailed_message=f"the `label` field with value `{val}` " "is not valid because:", ) ) - loopSource = None - if "loopSource" in _doc: + secondaryFiles = None + if "secondaryFiles" in _doc: try: - loopSource = load_field( - _doc.get("loopSource"), - uri_union_of_None_type_or_strtype_or_array_of_strtype_False_False_1_None, + secondaryFiles = _load_field( + _doc.get("secondaryFiles"), + secondaryfilesdsl_union_of_None_type_or_SecondaryFileSchemaLoader_or_array_of_SecondaryFileSchemaLoader, baseuri, loadingOptions, - lc=_doc.get("loopSource") + lc=_doc.get("secondaryFiles") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loopSource`": + if str(e) == "missing required field `secondaryFiles`": _errors__.append( ValidationException( str(e), @@ -28361,13 +23777,13 @@ def fromDoc( ) ) else: - val = _doc.get("loopSource") + val = _doc.get("secondaryFiles") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `loopSource` field is not valid because:", - SourceLine(_doc, "loopSource", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -28379,28 +23795,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `loopSource` field is not valid because:", - SourceLine(_doc, "loopSource", str), + "the `secondaryFiles` field is not valid because:", + SourceLine(_doc, "secondaryFiles", str), [e], - detailed_message=f"the `loopSource` field with value `{val}` " + detailed_message=f"the `secondaryFiles` field with value `{val}` " "is not valid because:", ) ) - pickValue = None - if "pickValue" in _doc: + streamable = None + if "streamable" in _doc: try: - pickValue = load_field( - _doc.get("pickValue"), - union_of_None_type_or_PickValueMethodLoader, + streamable = _load_field( + _doc.get("streamable"), + union_of_None_type_or_booltype, baseuri, loadingOptions, - lc=_doc.get("pickValue") + lc=_doc.get("streamable") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `pickValue`": + if str(e) == "missing required field `streamable`": _errors__.append( ValidationException( str(e), @@ -28408,13 +23824,13 @@ def fromDoc( ) ) else: - val = _doc.get("pickValue") + val = _doc.get("streamable") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `pickValue` field is not valid because:", - SourceLine(_doc, "pickValue", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -28426,28 +23842,28 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `pickValue` field is not valid because:", - SourceLine(_doc, "pickValue", str), + "the `streamable` field is not valid because:", + SourceLine(_doc, "streamable", str), [e], - detailed_message=f"the `pickValue` field with value `{val}` " + detailed_message=f"the `streamable` field with value `{val}` " "is not valid because:", ) ) - valueFrom = None - if "valueFrom" in _doc: + doc = None + if "doc" in _doc: try: - valueFrom = load_field( - _doc.get("valueFrom"), - union_of_None_type_or_strtype_or_ExpressionLoader, + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, baseuri, loadingOptions, - lc=_doc.get("valueFrom") + lc=_doc.get("doc") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `valueFrom`": + if str(e) == "missing required field `doc`": _errors__.append( ValidationException( str(e), @@ -28455,13 +23871,13 @@ def fromDoc( ) ) else: - val = _doc.get("valueFrom") + val = _doc.get("doc") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -28473,296 +23889,76 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `valueFrom` field is not valid because:", - SourceLine(_doc, "valueFrom", str), + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), [e], - detailed_message=f"the `valueFrom` field with value `{val}` " + detailed_message=f"the `doc` field with value `{val}` " "is not valid because:", ) ) - extension_fields: MutableMapping[str, Any] = {} - for k in _doc.keys(): - if k not in cls.attrs: - if not k: - _errors__.append( - ValidationException("mapping with implicit null key") - ) - elif ":" in k: - ex = expand_url( - k, "", loadingOptions, scoped_id=False, vocab_term=False - ) - extension_fields[ex] = _doc[k] - else: - _errors__.append( - ValidationException( - "invalid field `{}`, expected one of: `default`, `id`, `linkMerge`, `loopSource`, `pickValue`, `valueFrom`".format( - k - ), - SourceLine(_doc, k, str), - ) - ) - - if _errors__: - raise ValidationException("", None, _errors__, "*") - _constructed = cls( - id=id, - default=default, - linkMerge=linkMerge, - loopSource=loopSource, - pickValue=pickValue, - valueFrom=valueFrom, - extension_fields=extension_fields, - loadingOptions=loadingOptions, - ) - loadingOptions.idx[id] = (_constructed, loadingOptions) - return _constructed - - def save( - self, top: bool = False, base_url: str = "", relative_uris: bool = True - ) -> dict[str, Any]: - r: dict[str, Any] = {} - - if relative_uris: - for ef in self.extension_fields: - r[prefix_url(ef, self.loadingOptions.vocab)] = self.extension_fields[ef] - else: - for ef in self.extension_fields: - r[ef] = self.extension_fields[ef] - if self.id is not None: - u = save_relative_uri(self.id, self.id, True, None, relative_uris) - r["id"] = u - if self.default is not None: - r["default"] = save( - self.default, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.linkMerge is not None: - r["linkMerge"] = save( - self.linkMerge, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.loopSource is not None: - u = save_relative_uri(self.loopSource, self.id, False, 1, relative_uris) - r["loopSource"] = u - if self.pickValue is not None: - r["pickValue"] = save( - self.pickValue, top=False, base_url=self.id, relative_uris=relative_uris - ) - if self.valueFrom is not None: - r["valueFrom"] = save( - self.valueFrom, top=False, base_url=self.id, relative_uris=relative_uris - ) - - # top refers to the directory level - if top: - if self.loadingOptions.namespaces: - r["$namespaces"] = self.loadingOptions.namespaces - if self.loadingOptions.schemas: - r["$schemas"] = self.loadingOptions.schemas - return r - - def __init__( - self, - default: Any | None = None, - id: None | str = None, - linkMerge: LinkMergeMethod | None = None, - loopSource: None | Sequence[str] | str = None, - pickValue: None | PickValueMethod = None, - valueFrom: None | str = None, - extension_fields: MutableMapping[str, Any] | None = None, - loadingOptions: LoadingOptions | None = None, - ) -> None: - if extension_fields: - self.extension_fields = extension_fields - else: - self.extension_fields = CommentedMap() - if loadingOptions: - self.loadingOptions = loadingOptions - else: - self.loadingOptions = LoadingOptions() - self.default = default - self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) - self.linkMerge = linkMerge - self.loopSource = loopSource - self.pickValue = pickValue - self.valueFrom = valueFrom - - attrs: ClassVar[Collection[str]] = frozenset( - ["default", "id", "linkMerge", "loopSource", "pickValue", "valueFrom"] - ) - - -@mypyc_attr(native_class=True) -class Loop(Saveable): - """ - Prototype to enable workflow-level looping of a step. - - Valid only under `requirements` of a https://www.commonwl.org/v1.2/Workflow.html#WorkflowStep. - Unlike other CWL requirements, Loop requirement is not propagated to inner steps. - - `loopWhen` is an expansion of the CWL v1.2 `when` construct which controls - conditional execution. - - Using `loopWhen` and `when` for the same step will produce an error. - - `loopWhen` is not compatible with `scatter` at this time and combining the - two in the same step will produce an error. - - """ - - def __eq__(self, other: Any) -> bool: - if isinstance(other, Loop): - return bool( - self.class_ == other.class_ - and self.loop == other.loop - and self.loopWhen == other.loopWhen - and self.outputMethod == other.outputMethod - ) - return False - - def __hash__(self) -> int: - return hash((self.class_, self.loop, self.loopWhen, self.outputMethod)) - - @classmethod - def fromDoc( - cls, - doc: Any, - baseuri: str, - loadingOptions: LoadingOptions, - docRoot: str | None = None - ) -> Self: - _doc = copy.copy(doc) - - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] - try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) - - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, - baseuri, - loadingOptions, - lc=_doc.get("class") - ) - - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") - except ValidationException as e: - raise e - try: - if _doc.get("loop") is None: - raise ValidationException("missing required field `loop`", None, []) - - loop = load_field( - _doc.get("loop"), - idmap_loop_array_of_LoopInputLoader, - baseuri, - loadingOptions, - lc=_doc.get("loop") - ) - - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) - - if str(e) == "missing required field `loop`": - _errors__.append( - ValidationException( - str(e), - None - ) + format = None + if "format" in _doc: + try: + format = _load_field( + _doc.get("format"), + uri_union_of_None_type_or_strtype_or_ExpressionLoader_True_False_None_True, + baseuri, + loadingOptions, + lc=_doc.get("format") ) - else: - val = _doc.get("loop") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loop` field is not valid because:", - SourceLine(_doc, "loop", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: - _errors__.append( - ValidationException( - "the `loop` field is not valid because:", - SourceLine(_doc, "loop", str), - [e], - detailed_message=f"the `loop` field with value `{val}` " - "is not valid because:", - ) - ) - try: - if _doc.get("loopWhen") is None: - raise ValidationException("missing required field `loopWhen`", None, []) - - loopWhen = load_field( - _doc.get("loopWhen"), - ExpressionLoader, - baseuri, - loadingOptions, - lc=_doc.get("loopWhen") - ) - except ValidationException as e: - error_message, to_print, verb_tensage = parse_errors(str(e)) + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `loopWhen`": - _errors__.append( - ValidationException( - str(e), - None - ) - ) - else: - val = _doc.get("loopWhen") - if error_message != str(e): - val_type = convert_typing(extract_type(type(val))) - _errors__.append( - ValidationException( - "the `loopWhen` field is not valid because:", - SourceLine(_doc, "loopWhen", str), - [ValidationException(f"Value is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}", - detailed_message=f"Value `{val}` is a {val_type}, " - f"but valid {to_print} for this field " - f"{verb_tensage} {error_message}")], - ) - ) - else: + if str(e) == "missing required field `format`": _errors__.append( ValidationException( - "the `loopWhen` field is not valid because:", - SourceLine(_doc, "loopWhen", str), - [e], - detailed_message=f"the `loopWhen` field with value `{val}` " - "is not valid because:", + str(e), + None ) ) + else: + val = _doc.get("format") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `format` field is not valid because:", + SourceLine(_doc, "format", str), + [e], + detailed_message=f"the `format` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("outputMethod") is None: - raise ValidationException("missing required field `outputMethod`", None, []) + if _doc.get("type") is None: + raise ValidationException("missing required field `type`", None, []) - outputMethod = load_field( - _doc.get("outputMethod"), - LoopOutputModesLoader, + type_ = _load_field( + _doc.get("type"), + typedsl_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_or_array_of_union_of_CWLTypeLoader_or_OutputRecordSchemaLoader_or_OutputEnumSchemaLoader_or_OutputArraySchemaLoader_or_strtype_2, baseuri, loadingOptions, - lc=_doc.get("outputMethod") + lc=_doc.get("type") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `outputMethod`": + if str(e) == "missing required field `type`": _errors__.append( ValidationException( str(e), @@ -28770,13 +23966,13 @@ def fromDoc( ) ) else: - val = _doc.get("outputMethod") + val = _doc.get("type") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `outputMethod` field is not valid because:", - SourceLine(_doc, "outputMethod", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -28788,10 +23984,10 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `outputMethod` field is not valid because:", - SourceLine(_doc, "outputMethod", str), + "the `type` field is not valid because:", + SourceLine(_doc, "type", str), [e], - detailed_message=f"the `outputMethod` field with value `{val}` " + detailed_message=f"the `type` field with value `{val}` " "is not valid because:", ) ) @@ -28803,14 +23999,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `loop`, `loopWhen`, `outputMethod`".format( + "invalid field `{}`, expected one of: `label`, `secondaryFiles`, `streamable`, `doc`, `id`, `format`, `type`".format( k ), SourceLine(_doc, k, str), @@ -28820,12 +24016,17 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - loop=loop, - loopWhen=loopWhen, - outputMethod=outputMethod, + id=id, + label=label, + secondaryFiles=secondaryFiles, + streamable=streamable, + doc=doc, + format=format, + type_=type_, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -28839,29 +24040,38 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] - if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): - uri = f"{p}:{self.class_}" - else: - uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) - r["class"] = u - if self.loop is not None: - r["loop"] = save( - self.loop, top=False, base_url=base_url, relative_uris=relative_uris + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris ) - if self.loopWhen is not None: - r["loopWhen"] = save( - self.loopWhen, top=False, base_url=base_url, relative_uris=relative_uris + if self.secondaryFiles is not None: + r["secondaryFiles"] = save( + self.secondaryFiles, + top=False, + base_url=self.id, + relative_uris=relative_uris, ) - if self.outputMethod is not None: - r["outputMethod"] = save( - self.outputMethod, + if self.streamable is not None: + r["streamable"] = save( + self.streamable, top=False, - base_url=base_url, + base_url=self.id, relative_uris=relative_uris, ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.format is not None: + u = save_relative_uri(self.format, self.id, True, None, relative_uris) + r["format"] = u + if self.type_ is not None: + r["type"] = save( + self.type_, top=False, base_url=self.id, relative_uris=relative_uris + ) # top refers to the directory level if top: @@ -28873,9 +24083,13 @@ def save( def __init__( self, - loop: Sequence[LoopInput], - loopWhen: str, - outputMethod: LoopOutputModes, + id: str, + type_: CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | Sequence[CWLType | OutputArraySchema | OutputEnumSchema | OutputRecordSchema | str] | str, + label: None | str = None, + secondaryFiles: None | SecondaryFileSchema | Sequence[SecondaryFileSchema] = None, + streamable: None | bool = None, + doc: None | Sequence[str] | str = None, + format: None | str = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -28887,25 +24101,59 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "Loop" - self.loop = loop - self.loopWhen = loopWhen - self.outputMethod = outputMethod + self.label = label + self.secondaryFiles = secondaryFiles + self.streamable = streamable + self.doc = doc + self.id = id + self.format = format + self.type_ = type_ attrs: ClassVar[Collection[str]] = frozenset( - ["class", "loop", "loopWhen", "outputMethod"] + ["label", "secondaryFiles", "streamable", "doc", "id", "format", "type"] ) @mypyc_attr(native_class=True) -class ShmSize(Saveable): +class Operation(Saveable): + """ + This record describes an abstract operation. It is a potential step of a workflow that has not yet been bound to a concrete implementation. It specifies an input and output signature, but does not provide enough information to be executed. An implementation (or other tooling) may provide a means of binding an Operation to a concrete process (such as Workflow, CommandLineTool, or ExpressionTool) with a compatible signature. + + """ + + id: str + def __eq__(self, other: Any) -> bool: - if isinstance(other, ShmSize): - return bool(self.class_ == other.class_ and self.shmSize == other.shmSize) + if isinstance(other, Operation): + return bool( + self.id == other.id + and self.label == other.label + and self.doc == other.doc + and self.inputs == other.inputs + and self.outputs == other.outputs + and self.requirements == other.requirements + and self.hints == other.hints + and self.cwlVersion == other.cwlVersion + and self.intent == other.intent + and self.class_ == other.class_ + ) return False def __hash__(self) -> int: - return hash((self.class_, self.shmSize)) + return hash( + ( + self.id, + self.label, + self.doc, + self.inputs, + self.outputs, + self.requirements, + self.hints, + self.cwlVersion, + self.intent, + self.class_, + ) + ) @classmethod def fromDoc( @@ -28917,42 +24165,240 @@ def fromDoc( ) -> Self: _doc = copy.copy(doc) - if hasattr(doc, "lc"): - _doc.lc.data = doc.lc.data - _doc.lc.filename = doc.lc.filename - _errors__ = [] + if hasattr(doc, "lc"): + _doc.lc.data = doc.lc.data + _doc.lc.filename = doc.lc.filename + _errors__ = [] + id = None + if "id" in _doc: + try: + id = _load_field( + _doc.get("id"), + uri_union_of_None_type_or_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("id") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `id`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("id") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `id` field is not valid because:", + SourceLine(_doc, "id", str), + [e], + detailed_message=f"the `id` field with value `{val}` " + "is not valid because:", + ) + ) + + if id is None: + if docRoot is not None: + id = docRoot + else: + id = "_:" + str(_uuid__.uuid4()) + else: + baseuri = id + try: + if _doc.get("class") is None: + raise ValidationException("missing required field `class`", None, []) + + class_ = _load_field( + _doc.get("class"), + uri_Operation_classLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("class") + ) + + vocab = _vocab | loadingOptions.vocab + if class_ not in (cls.__name__, vocab.get(cls.__name__)): + raise ValidationException(f"tried `{cls.__name__}` but") + except ValidationException as e: + raise e + label = None + if "label" in _doc: + try: + label = _load_field( + _doc.get("label"), + union_of_None_type_or_strtype, + baseuri, + loadingOptions, + lc=_doc.get("label") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `label`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("label") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `label` field is not valid because:", + SourceLine(_doc, "label", str), + [e], + detailed_message=f"the `label` field with value `{val}` " + "is not valid because:", + ) + ) + doc = None + if "doc" in _doc: + try: + doc = _load_field( + _doc.get("doc"), + union_of_None_type_or_strtype_or_array_of_strtype, + baseuri, + loadingOptions, + lc=_doc.get("doc") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `doc`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("doc") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `doc` field is not valid because:", + SourceLine(_doc, "doc", str), + [e], + detailed_message=f"the `doc` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("class") is None: - raise ValidationException("missing required field `class`", None, []) + if _doc.get("inputs") is None: + raise ValidationException("missing required field `inputs`", None, []) - class_ = load_field( - _doc.get("class"), - uri_strtype_False_True_None_None, + inputs = _load_field( + _doc.get("inputs"), + idmap_inputs_array_of_OperationInputParameterLoader, baseuri, loadingOptions, - lc=_doc.get("class") + lc=_doc.get("inputs") ) - if class_ not in (cls.__name__, loadingOptions.vocab.get(cls.__name__)): - raise ValidationException(f"tried `{cls.__name__}` but") except ValidationException as e: - raise e + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `inputs`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("inputs") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `inputs` field is not valid because:", + SourceLine(_doc, "inputs", str), + [e], + detailed_message=f"the `inputs` field with value `{val}` " + "is not valid because:", + ) + ) try: - if _doc.get("shmSize") is None: - raise ValidationException("missing required field `shmSize`", None, []) + if _doc.get("outputs") is None: + raise ValidationException("missing required field `outputs`", None, []) - shmSize = load_field( - _doc.get("shmSize"), - strtype, + outputs = _load_field( + _doc.get("outputs"), + idmap_outputs_array_of_OperationOutputParameterLoader, baseuri, loadingOptions, - lc=_doc.get("shmSize") + lc=_doc.get("outputs") ) except ValidationException as e: error_message, to_print, verb_tensage = parse_errors(str(e)) - if str(e) == "missing required field `shmSize`": + if str(e) == "missing required field `outputs`": _errors__.append( ValidationException( str(e), @@ -28960,13 +24406,13 @@ def fromDoc( ) ) else: - val = _doc.get("shmSize") + val = _doc.get("outputs") if error_message != str(e): val_type = convert_typing(extract_type(type(val))) _errors__.append( ValidationException( - "the `shmSize` field is not valid because:", - SourceLine(_doc, "shmSize", str), + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), [ValidationException(f"Value is a {val_type}, " f"but valid {to_print} for this field " f"{verb_tensage} {error_message}", @@ -28978,13 +24424,201 @@ def fromDoc( else: _errors__.append( ValidationException( - "the `shmSize` field is not valid because:", - SourceLine(_doc, "shmSize", str), - [e], - detailed_message=f"the `shmSize` field with value `{val}` " - "is not valid because:", + "the `outputs` field is not valid because:", + SourceLine(_doc, "outputs", str), + [e], + detailed_message=f"the `outputs` field with value `{val}` " + "is not valid because:", + ) + ) + requirements = None + if "requirements" in _doc: + try: + requirements = _load_field( + _doc.get("requirements"), + idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, + baseuri, + loadingOptions, + lc=_doc.get("requirements") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `requirements`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("requirements") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `requirements` field is not valid because:", + SourceLine(_doc, "requirements", str), + [e], + detailed_message=f"the `requirements` field with value `{val}` " + "is not valid because:", + ) + ) + hints = None + if "hints" in _doc: + try: + hints = _load_field( + _doc.get("hints"), + idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, + baseuri, + loadingOptions, + lc=_doc.get("hints") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `hints`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("hints") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `hints` field is not valid because:", + SourceLine(_doc, "hints", str), + [e], + detailed_message=f"the `hints` field with value `{val}` " + "is not valid because:", + ) + ) + cwlVersion = None + if "cwlVersion" in _doc: + try: + cwlVersion = _load_field( + _doc.get("cwlVersion"), + uri_union_of_None_type_or_CWLVersionLoader_False_True_None_None, + baseuri, + loadingOptions, + lc=_doc.get("cwlVersion") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `cwlVersion`": + _errors__.append( + ValidationException( + str(e), + None + ) + ) + else: + val = _doc.get("cwlVersion") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `cwlVersion` field is not valid because:", + SourceLine(_doc, "cwlVersion", str), + [e], + detailed_message=f"the `cwlVersion` field with value `{val}` " + "is not valid because:", + ) + ) + intent = None + if "intent" in _doc: + try: + intent = _load_field( + _doc.get("intent"), + uri_union_of_None_type_or_array_of_strtype_True_False_None_None, + baseuri, + loadingOptions, + lc=_doc.get("intent") + ) + + except ValidationException as e: + error_message, to_print, verb_tensage = parse_errors(str(e)) + + if str(e) == "missing required field `intent`": + _errors__.append( + ValidationException( + str(e), + None ) ) + else: + val = _doc.get("intent") + if error_message != str(e): + val_type = convert_typing(extract_type(type(val))) + _errors__.append( + ValidationException( + "the `intent` field is not valid because:", + SourceLine(_doc, "intent", str), + [ValidationException(f"Value is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}", + detailed_message=f"Value `{val}` is a {val_type}, " + f"but valid {to_print} for this field " + f"{verb_tensage} {error_message}")], + ) + ) + else: + _errors__.append( + ValidationException( + "the `intent` field is not valid because:", + SourceLine(_doc, "intent", str), + [e], + detailed_message=f"the `intent` field with value `{val}` " + "is not valid because:", + ) + ) extension_fields: MutableMapping[str, Any] = {} for k in _doc.keys(): if k not in cls.attrs: @@ -28993,14 +24627,14 @@ def fromDoc( ValidationException("mapping with implicit null key") ) elif ":" in k: - ex = expand_url( + ex = _expand_url( k, "", loadingOptions, scoped_id=False, vocab_term=False ) extension_fields[ex] = _doc[k] else: _errors__.append( ValidationException( - "invalid field `{}`, expected one of: `class`, `shmSize`".format( + "invalid field `{}`, expected one of: `id`, `label`, `doc`, `inputs`, `outputs`, `requirements`, `hints`, `cwlVersion`, `intent`, `class`".format( k ), SourceLine(_doc, k, str), @@ -29010,10 +24644,19 @@ def fromDoc( if _errors__: raise ValidationException("", None, _errors__, "*") _constructed = cls( - shmSize=shmSize, + id=id, + label=label, + doc=doc, + inputs=inputs, + outputs=outputs, + requirements=requirements, + hints=hints, + cwlVersion=cwlVersion, + intent=intent, extension_fields=extension_fields, loadingOptions=loadingOptions, ) + loadingOptions.idx[id] = (_constructed, loadingOptions) return _constructed def save( @@ -29027,18 +24670,52 @@ def save( else: for ef in self.extension_fields: r[ef] = self.extension_fields[ef] + if self.id is not None: + u = save_relative_uri(self.id, self.id, True, None, relative_uris) + r["id"] = u if self.class_ is not None: - uri = self.loadingOptions.vocab[self.class_] - if p := self.loadingOptions.rvocab.get(uri[: -len(self.class_)]): + vocab = _vocab | self.loadingOptions.vocab + rvocab = _rvocab | self.loadingOptions.rvocab + uri = vocab[self.class_] + if p := rvocab.get(uri[: -len(self.class_)]): uri = f"{p}:{self.class_}" else: uri = self.class_ - u = save_relative_uri(uri, base_url, False, None, relative_uris) + u = save_relative_uri(uri, self.id, False, None, relative_uris) r["class"] = u - if self.shmSize is not None: - r["shmSize"] = save( - self.shmSize, top=False, base_url=base_url, relative_uris=relative_uris + if self.label is not None: + r["label"] = save( + self.label, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.doc is not None: + r["doc"] = save( + self.doc, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.inputs is not None: + r["inputs"] = save( + self.inputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.outputs is not None: + r["outputs"] = save( + self.outputs, top=False, base_url=self.id, relative_uris=relative_uris + ) + if self.requirements is not None: + r["requirements"] = save( + self.requirements, + top=False, + base_url=self.id, + relative_uris=relative_uris, + ) + if self.hints is not None: + r["hints"] = save( + self.hints, top=False, base_url=self.id, relative_uris=relative_uris ) + if self.cwlVersion is not None: + u = save_relative_uri(self.cwlVersion, self.id, False, None, relative_uris) + r["cwlVersion"] = u + if self.intent is not None: + u = save_relative_uri(self.intent, self.id, True, None, relative_uris) + r["intent"] = u # top refers to the directory level if top: @@ -29050,7 +24727,15 @@ def save( def __init__( self, - shmSize: str, + inputs: Sequence[OperationInputParameter], + outputs: Sequence[OperationOutputParameter], + id: None | str = None, + label: None | str = None, + doc: None | Sequence[str] | str = None, + requirements: None | Sequence[DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + hints: None | Sequence[Any | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement | ShellCommandRequirement | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse] = None, + cwlVersion: CWLVersion | None = None, + intent: None | Sequence[str] = None, extension_fields: MutableMapping[str, Any] | None = None, loadingOptions: LoadingOptions | None = None, ) -> None: @@ -29062,16 +24747,36 @@ def __init__( self.loadingOptions = loadingOptions else: self.loadingOptions = LoadingOptions() - self.class_: Final[str] = "ShmSize" - self.shmSize = shmSize + self.id = id if id is not None else "_:" + str(_uuid__.uuid4()) + self.label = label + self.doc = doc + self.inputs = inputs + self.outputs = outputs + self.requirements = requirements + self.hints = hints + self.cwlVersion = cwlVersion + self.intent = intent + self.class_: Final[str] = "Operation" - attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"]) + attrs: ClassVar[Collection[str]] = frozenset( + [ + "id", + "label", + "doc", + "inputs", + "outputs", + "requirements", + "hints", + "cwlVersion", + "intent", + "class", + ] + ) _vocab.update({ "Any": "https://w3id.org/cwl/salad#Any", "ArraySchema": "https://w3id.org/cwl/salad#ArraySchema", - "CUDARequirement": "http://commonwl.org/cwltool#CUDARequirement", "CWLArraySchema": "https://w3id.org/cwl/cwl#CWLArraySchema", "CWLInputFile": "https://w3id.org/cwl/cwl#CWLInputFile", "CWLObjectType": "https://w3id.org/cwl/cwl#CWLObjectType", @@ -29126,9 +24831,6 @@ def __init__( "LoadContents": "https://w3id.org/cwl/cwl#LoadContents", "LoadListingEnum": "https://w3id.org/cwl/cwl#LoadListingEnum", "LoadListingRequirement": "https://w3id.org/cwl/cwl#LoadListingRequirement", - "Loop": "http://commonwl.org/cwltool#Loop", - "LoopInput": "http://commonwl.org/cwltool#LoopInput", - "MPIRequirement": "http://commonwl.org/cwltool#MPIRequirement", "MapSchema": "https://w3id.org/cwl/salad#MapSchema", "MultipleInputFeatureRequirement": "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement", "NetworkAccess": "https://w3id.org/cwl/cwl#NetworkAccess", @@ -29146,7 +24848,6 @@ def __init__( "PickValueMethod": "https://w3id.org/cwl/cwl#PickValueMethod", "PrimitiveType": "https://w3id.org/cwl/salad#PrimitiveType", "Process": "https://w3id.org/cwl/cwl#Process", - "ProcessGenerator": "http://commonwl.org/cwltool#ProcessGenerator", "ProcessRequirement": "https://w3id.org/cwl/cwl#ProcessRequirement", "RecordField": "https://w3id.org/cwl/salad#RecordField", "RecordSchema": "https://w3id.org/cwl/salad#RecordSchema", @@ -29155,9 +24856,7 @@ def __init__( "ScatterMethod": "https://w3id.org/cwl/cwl#ScatterMethod", "SchemaDefRequirement": "https://w3id.org/cwl/cwl#SchemaDefRequirement", "SecondaryFileSchema": "https://w3id.org/cwl/cwl#SecondaryFileSchema", - "Secrets": "http://commonwl.org/cwltool#Secrets", "ShellCommandRequirement": "https://w3id.org/cwl/cwl#ShellCommandRequirement", - "ShmSize": "http://commonwl.org/cwltool#ShmSize", "Sink": "https://w3id.org/cwl/cwl#Sink", "SoftwarePackage": "https://w3id.org/cwl/cwl#SoftwarePackage", "SoftwareRequirement": "https://w3id.org/cwl/cwl#SoftwareRequirement", @@ -29172,7 +24871,6 @@ def __init__( "WorkflowStep": "https://w3id.org/cwl/cwl#WorkflowStep", "WorkflowStepInput": "https://w3id.org/cwl/cwl#WorkflowStepInput", "WorkflowStepOutput": "https://w3id.org/cwl/cwl#WorkflowStepOutput", - "all": "http://commonwl.org/cwltool#Loop/outputMethod/LoopOutputModes/all", "all_non_null": "https://w3id.org/cwl/cwl#PickValueMethod/all_non_null", "array": "https://w3id.org/cwl/salad#array", "boolean": "http://www.w3.org/2001/XMLSchema#boolean", @@ -29184,7 +24882,6 @@ def __init__( "flat_crossproduct": "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct", "float": "http://www.w3.org/2001/XMLSchema#float", "int": "http://www.w3.org/2001/XMLSchema#int", - "last": "http://commonwl.org/cwltool#Loop/outputMethod/LoopOutputModes/last", "long": "http://www.w3.org/2001/XMLSchema#long", "map": "https://w3id.org/cwl/salad#map", "merge_flattened": "https://w3id.org/cwl/cwl#LinkMergeMethod/merge_flattened", @@ -29205,7 +24902,6 @@ def __init__( _rvocab.update({ "https://w3id.org/cwl/salad#Any": "Any", "https://w3id.org/cwl/salad#ArraySchema": "ArraySchema", - "http://commonwl.org/cwltool#CUDARequirement": "CUDARequirement", "https://w3id.org/cwl/cwl#CWLArraySchema": "CWLArraySchema", "https://w3id.org/cwl/cwl#CWLInputFile": "CWLInputFile", "https://w3id.org/cwl/cwl#CWLObjectType": "CWLObjectType", @@ -29260,9 +24956,6 @@ def __init__( "https://w3id.org/cwl/cwl#LoadContents": "LoadContents", "https://w3id.org/cwl/cwl#LoadListingEnum": "LoadListingEnum", "https://w3id.org/cwl/cwl#LoadListingRequirement": "LoadListingRequirement", - "http://commonwl.org/cwltool#Loop": "Loop", - "http://commonwl.org/cwltool#LoopInput": "LoopInput", - "http://commonwl.org/cwltool#MPIRequirement": "MPIRequirement", "https://w3id.org/cwl/salad#MapSchema": "MapSchema", "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement": "MultipleInputFeatureRequirement", "https://w3id.org/cwl/cwl#NetworkAccess": "NetworkAccess", @@ -29280,7 +24973,6 @@ def __init__( "https://w3id.org/cwl/cwl#PickValueMethod": "PickValueMethod", "https://w3id.org/cwl/salad#PrimitiveType": "PrimitiveType", "https://w3id.org/cwl/cwl#Process": "Process", - "http://commonwl.org/cwltool#ProcessGenerator": "ProcessGenerator", "https://w3id.org/cwl/cwl#ProcessRequirement": "ProcessRequirement", "https://w3id.org/cwl/salad#RecordField": "RecordField", "https://w3id.org/cwl/salad#RecordSchema": "RecordSchema", @@ -29289,9 +24981,7 @@ def __init__( "https://w3id.org/cwl/cwl#ScatterMethod": "ScatterMethod", "https://w3id.org/cwl/cwl#SchemaDefRequirement": "SchemaDefRequirement", "https://w3id.org/cwl/cwl#SecondaryFileSchema": "SecondaryFileSchema", - "http://commonwl.org/cwltool#Secrets": "Secrets", "https://w3id.org/cwl/cwl#ShellCommandRequirement": "ShellCommandRequirement", - "http://commonwl.org/cwltool#ShmSize": "ShmSize", "https://w3id.org/cwl/cwl#Sink": "Sink", "https://w3id.org/cwl/cwl#SoftwarePackage": "SoftwarePackage", "https://w3id.org/cwl/cwl#SoftwareRequirement": "SoftwareRequirement", @@ -29306,7 +24996,6 @@ def __init__( "https://w3id.org/cwl/cwl#WorkflowStep": "WorkflowStep", "https://w3id.org/cwl/cwl#WorkflowStepInput": "WorkflowStepInput", "https://w3id.org/cwl/cwl#WorkflowStepOutput": "WorkflowStepOutput", - "http://commonwl.org/cwltool#Loop/outputMethod/LoopOutputModes/all": "all", "https://w3id.org/cwl/cwl#PickValueMethod/all_non_null": "all_non_null", "https://w3id.org/cwl/salad#array": "array", "http://www.w3.org/2001/XMLSchema#boolean": "boolean", @@ -29318,7 +25007,6 @@ def __init__( "https://w3id.org/cwl/cwl#ScatterMethod/flat_crossproduct": "flat_crossproduct", "http://www.w3.org/2001/XMLSchema#float": "float", "http://www.w3.org/2001/XMLSchema#int": "int", - "http://commonwl.org/cwltool#Loop/outputMethod/LoopOutputModes/last": "last", "http://www.w3.org/2001/XMLSchema#long": "long", "https://w3id.org/cwl/salad#map": "map", "https://w3id.org/cwl/cwl#LinkMergeMethod/merge_flattened": "merge_flattened", @@ -29339,11 +25027,11 @@ def __init__( strtype: Final[_Loader[str]] = _PrimitiveLoader(str) inttype: Final[_Loader[i32]] = _PrimitiveLoader(i32) +longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) floattype: Final[_Loader[float]] = _PrimitiveLoader(float) booltype: Final[_Loader[bool]] = _PrimitiveLoader(bool) None_type: Final[_Loader[None]] = _PrimitiveLoader(type(None)) Any_type: Final[_Loader[Any]] = _AnyLoader() -longtype: Final[_Loader[i64]] = _PrimitiveLoader(i64) PrimitiveType: TypeAlias = Literal[ "null", "boolean", "int", "long", "float", "double", "string" ] @@ -29362,15 +25050,20 @@ def __init__( """ Names of salad data types (based on Avro schema declarations). -Refer to the [Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for -detailed information. +Refer to the `Avro schema declaration documentation `__ for detailed information. null: no value + boolean: a binary value + int: 32-bit signed integer + long: 64-bit signed integer + float: single precision (32-bit) IEEE 754 floating-point number + double: double precision (64-bit) IEEE 754 floating-point number + string: Unicode character sequence """ Any_: TypeAlias = Literal["Any"] @@ -29378,14 +25071,24 @@ def __init__( """ The **Any** type validates for any non-null value. """ -RecordFieldLoader: Final[_Loader[RecordField]] = _RecordLoader(RecordField, None, None) -RecordSchemaLoader: Final[_Loader[RecordSchema]] = _RecordLoader( - RecordSchema, None, None +RecordFieldLoader: Final[_Loader[schema_salad.metaschema.RecordField]] = _RecordLoader( + schema_salad.metaschema.RecordField, None, None +) +RecordSchemaLoader: Final[_Loader[schema_salad.metaschema.RecordSchema]] = ( + _RecordLoader(schema_salad.metaschema.RecordSchema, None, None) +) +EnumSchemaLoader: Final[_Loader[schema_salad.metaschema.EnumSchema]] = _RecordLoader( + schema_salad.metaschema.EnumSchema, None, None +) +ArraySchemaLoader: Final[_Loader[schema_salad.metaschema.ArraySchema]] = _RecordLoader( + schema_salad.metaschema.ArraySchema, None, None +) +MapSchemaLoader: Final[_Loader[schema_salad.metaschema.MapSchema]] = _RecordLoader( + schema_salad.metaschema.MapSchema, None, None +) +UnionSchemaLoader: Final[_Loader[schema_salad.metaschema.UnionSchema]] = _RecordLoader( + schema_salad.metaschema.UnionSchema, None, None ) -EnumSchemaLoader: Final[_Loader[EnumSchema]] = _RecordLoader(EnumSchema, None, None) -ArraySchemaLoader: Final[_Loader[ArraySchema]] = _RecordLoader(ArraySchema, None, None) -MapSchemaLoader: Final[_Loader[MapSchema]] = _RecordLoader(MapSchema, None, None) -UnionSchemaLoader: Final[_Loader[UnionSchema]] = _RecordLoader(UnionSchema, None, None) CWLType: TypeAlias = Literal[ "null", "boolean", "int", "long", "float", "double", "string", "File", "Directory" ] @@ -29405,7 +25108,9 @@ def __init__( ) """ Extends primitive types with the concept of a file and directory as a builtin type. + File: A File object + Directory: A Directory object """ CWLArraySchemaLoader: Final[_Loader[CWLArraySchema]] = _RecordLoader( @@ -29483,34 +25188,20 @@ def __init__( StepInputExpressionRequirementLoader: Final[_Loader[StepInputExpressionRequirement]] = ( _RecordLoader(StepInputExpressionRequirement, None, None) ) -SecretsLoader: Final[_Loader[Secrets]] = _RecordLoader(Secrets, None, None) -MPIRequirementLoader: Final[_Loader[MPIRequirement]] = _RecordLoader( - MPIRequirement, None, None -) -CUDARequirementLoader: Final[_Loader[CUDARequirement]] = _RecordLoader( - CUDARequirement, None, None -) -LoopLoader: Final[_Loader[Loop]] = _RecordLoader(Loop, None, None) -ShmSizeLoader: Final[_Loader[ShmSize]] = _RecordLoader(ShmSize, None, None) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -29536,33 +25227,23 @@ def __init__( ScatterFeatureRequirementLoader, MultipleInputFeatureRequirementLoader, StepInputExpressionRequirementLoader, - SecretsLoader, - MPIRequirementLoader, - CUDARequirementLoader, - LoopLoader, - ShmSizeLoader, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -29571,30 +25252,25 @@ def __init__( ] ] ] = _ArrayLoader( - union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader + union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_CWLObjectTypeLoader: Final[ _Loader[ CWLObjectType | None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -29605,34 +25281,29 @@ def __init__( ] = _UnionLoader( ( None_type, - array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, + array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, CWLObjectTypeLoader, ) ) -map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader: Final[ +map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_CWLObjectTypeLoader: Final[ _Loader[ Mapping[ str, CWLObjectType | None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -29642,7 +25313,7 @@ def __init__( ] ] ] = _MapLoader( - union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader, + union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_CWLObjectTypeLoader, "CWLInputFile", "@list", True, @@ -29654,23 +25325,18 @@ def __init__( CWLObjectType | None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -29679,7 +25345,7 @@ def __init__( ], ] ] -] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_CWLObjectTypeLoader +] = map_of_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_CWLObjectTypeLoader CWLVersion: TypeAlias = Literal["v1.2"] CWLVersionLoader: Final[_Loader[CWLVersion]] = _EnumLoader(("v1.2",), "CWLVersion") """ @@ -29695,11 +25361,12 @@ def __init__( "LoadListingEnum", ) """ -Specify the desired behavior for loading the `listing` field of -a Directory object for use by expressions. +Specify the desired behavior for loading the ``listing`` field of a Directory object for use by expressions. no_listing: Do not load the directory listing. + shallow_listing: Only load the top level listing, do not recurse into subdirectories. + deep_listing: Load the directory listing and recursively load all subdirectories as well. """ Expression: TypeAlias = Literal["ExpressionPlaceholder"] @@ -29776,119 +25443,134 @@ def __init__( stdin: TypeAlias = Literal["stdin"] stdinLoader: Final[_Loader[stdin]] = _EnumLoader(("stdin",), "stdin") """ -Only valid as a `type` for a `CommandLineTool` input with no -`inputBinding` set. `stdin` must not be specified at the `CommandLineTool` -level. +Only valid as a ``type`` for a ``CommandLineTool`` input with no ``inputBinding`` set. ``stdin`` must not be specified at the ``CommandLineTool`` level. The following -``` -inputs: - an_input_name: - type: stdin -``` + +:: + + inputs: + an_input_name: + type: stdin + + is equivalent to -``` -inputs: - an_input_name: - type: File - streamable: true - -stdin: $(inputs.an_input_name.path) -``` + +:: + + inputs: + an_input_name: + type: File + streamable: true + + stdin: $(inputs.an_input_name.path) """ stdout: TypeAlias = Literal["stdout"] stdoutLoader: Final[_Loader[stdout]] = _EnumLoader(("stdout",), "stdout") """ -Only valid as a `type` for a `CommandLineTool` output with no -`outputBinding` set. +Only valid as a ``type`` for a ``CommandLineTool`` output with no ``outputBinding`` set. The following -``` -outputs: - an_output_name: - type: stdout -stdout: a_stdout_file -``` +:: + + outputs: + an_output_name: + type: stdout + + stdout: a_stdout_file + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: a_stdout_file - -stdout: a_stdout_file -``` - -If there is no `stdout` name provided, a random filename will be created. -For example, the following -``` -outputs: - an_output_name: - type: stdout -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: a_stdout_file + + stdout: a_stdout_file + + +If there is no ``stdout`` name provided, a random filename will be created. For example, the following + +:: + + outputs: + an_output_name: + type: stdout + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: random_stdout_filenameABCDEFG - -stdout: random_stdout_filenameABCDEFG -``` - -If the `CommandLineTool` contains logically chained commands -(e.g. `echo a && echo b`) `stdout` must include the output of -every command. + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: random_stdout_filenameABCDEFG + + stdout: random_stdout_filenameABCDEFG + + +If the ``CommandLineTool`` contains logically chained commands (e.g. ``echo a && echo b``) ``stdout`` must include the output of every command. """ stderr: TypeAlias = Literal["stderr"] stderrLoader: Final[_Loader[stderr]] = _EnumLoader(("stderr",), "stderr") """ -Only valid as a `type` for a `CommandLineTool` output with no -`outputBinding` set. +Only valid as a ``type`` for a ``CommandLineTool`` output with no ``outputBinding`` set. The following -``` -outputs: - an_output_name: - type: stderr -stderr: a_stderr_file -``` +:: + + outputs: + an_output_name: + type: stderr + + stderr: a_stderr_file + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: a_stderr_file - -stderr: a_stderr_file -``` - -If there is no `stderr` name provided, a random filename will be created. -For example, the following -``` -outputs: - an_output_name: - type: stderr -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: a_stderr_file + + stderr: a_stderr_file + + +If there is no ``stderr`` name provided, a random filename will be created. For example, the following + +:: + + outputs: + an_output_name: + type: stderr + + is equivalent to -``` -outputs: - an_output_name: - type: File - streamable: true - outputBinding: - glob: random_stderr_filenameABCDEFG - -stderr: random_stderr_filenameABCDEFG -``` + +:: + + outputs: + an_output_name: + type: File + streamable: true + outputBinding: + glob: random_stderr_filenameABCDEFG + + stderr: random_stderr_filenameABCDEFG """ CommandLineToolLoader: Final[_Loader[CommandLineTool]] = _RecordLoader( CommandLineTool, None, None @@ -29915,7 +25597,7 @@ def __init__( "LinkMergeMethod", ) """ -The input link merge method, described in [WorkflowStepInput](#WorkflowStepInput). +The input link merge method, described in `WorkflowStepInput <#WorkflowStepInput>`__. """ PickValueMethod: TypeAlias = Literal[ "first_non_null", "the_only_non_null", "all_non_null" @@ -29929,7 +25611,7 @@ def __init__( "PickValueMethod", ) """ -Picking non-null values among inbound data links, described in [WorkflowStepInput](#WorkflowStepInput). +Picking non-null values among inbound data links, described in `WorkflowStepInput <#WorkflowStepInput>`__. """ WorkflowOutputParameterLoader: Final[_Loader[WorkflowOutputParameter]] = _RecordLoader( WorkflowOutputParameter, None, None @@ -29952,7 +25634,7 @@ def __init__( "ScatterMethod", ) """ -The scatter method, as described in [workflow step scatter](#WorkflowStep). +The scatter method, as described in `workflow step scatter <#WorkflowStep>`__. """ WorkflowStepLoader: Final[_Loader[WorkflowStep]] = _RecordLoader( WorkflowStep, None, None @@ -29965,10 +25647,6 @@ def __init__( _RecordLoader(OperationOutputParameter, None, None) ) OperationLoader: Final[_Loader[Operation]] = _RecordLoader(Operation, None, None) -ProcessGeneratorLoader: Final[_Loader[ProcessGenerator]] = _RecordLoader( - ProcessGenerator, None, None -) -LoopInputLoader: Final[_Loader[LoopInput]] = _RecordLoader(LoopInput, None, None) array_of_strtype: Final[_Loader[Sequence[str]]] = _ArrayLoader(strtype) union_of_None_type_or_strtype_or_array_of_strtype: Final[ _Loader[None | Sequence[str] | str] @@ -29984,12 +25662,12 @@ def __init__( ) union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _UnionLoader( @@ -30006,12 +25684,12 @@ def __init__( array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] @@ -30020,21 +25698,21 @@ def __init__( ) union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _UnionLoader( @@ -30051,21 +25729,21 @@ def __init__( ) typedsl_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_2: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _TypeDSLLoader( @@ -30073,11 +25751,11 @@ def __init__( 2, "v1.1", ) -array_of_RecordFieldLoader: Final[_Loader[Sequence[RecordField]]] = _ArrayLoader( - RecordFieldLoader -) +array_of_RecordFieldLoader: Final[ + _Loader[Sequence[schema_salad.metaschema.RecordField]] +] = _ArrayLoader(RecordFieldLoader) union_of_None_type_or_array_of_RecordFieldLoader: Final[ - _Loader[None | Sequence[RecordField]] + _Loader[None | Sequence[schema_salad.metaschema.RecordField]] ] = _UnionLoader( ( None_type, @@ -30085,7 +25763,7 @@ def __init__( ) ) idmap_fields_union_of_None_type_or_array_of_RecordFieldLoader: Final[ - _Loader[None | Sequence[RecordField]] + _Loader[None | Sequence[schema_salad.metaschema.RecordField]] ] = _IdMapLoader(union_of_None_type_or_array_of_RecordFieldLoader, "name", "type") Record_name: TypeAlias = Literal["record"] Record_nameLoader: Final[_Loader[Record_name]] = _EnumLoader(("record",), "Record_name") @@ -30111,21 +25789,21 @@ def __init__( ) uri_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_or_array_of_union_of_PrimitiveTypeLoader_or_RecordSchemaLoader_or_EnumSchemaLoader_or_ArraySchemaLoader_or_MapSchemaLoader_or_UnionSchemaLoader_or_strtype_False_True_2_None: Final[ _Loader[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema + PrimitiveType | Sequence[ - ArraySchema - | EnumSchema - | MapSchema - | PrimitiveType - | RecordSchema - | UnionSchema + PrimitiveType + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] - | UnionSchema + | schema_salad.metaschema.ArraySchema + | schema_salad.metaschema.EnumSchema + | schema_salad.metaschema.MapSchema + | schema_salad.metaschema.RecordSchema + | schema_salad.metaschema.UnionSchema | str ] ] = _URILoader( @@ -30151,7 +25829,13 @@ def __init__( Union_nameLoader, 2, "v1.1" ) union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ - _Loader[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + _Loader[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] ] = _UnionLoader( ( PrimitiveTypeLoader, @@ -30163,7 +25847,13 @@ def __init__( ) array_of_union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype: Final[ _Loader[ - Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] ] ] = _ArrayLoader( union_of_PrimitiveTypeLoader_or_CWLRecordSchemaLoader_or_EnumSchemaLoader_or_CWLArraySchemaLoader_or_strtype @@ -30172,9 +25862,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _UnionLoader( @@ -30191,9 +25887,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _URILoader( @@ -30207,9 +25909,15 @@ def __init__( _Loader[ CWLArraySchema | CWLRecordSchema - | EnumSchema | PrimitiveType - | Sequence[CWLArraySchema | CWLRecordSchema | EnumSchema | PrimitiveType | str] + | Sequence[ + CWLArraySchema + | CWLRecordSchema + | PrimitiveType + | schema_salad.metaschema.EnumSchema + | str + ] + | schema_salad.metaschema.EnumSchema | str ] ] = _TypeDSLLoader( @@ -30239,11 +25947,13 @@ def __init__( uri_union_of_None_type_or_strtype_False_False_None_None: Final[_Loader[None | str]] = ( _URILoader(union_of_None_type_or_strtype, False, False, None, None) ) -union_of_None_type_or_inttype_or_inttype: Final[_Loader[None | i32]] = _UnionLoader( - ( - None_type, - inttype, - inttype, +union_of_None_type_or_inttype_or_longtype: Final[_Loader[None | i32 | i64]] = ( + _UnionLoader( + ( + None_type, + inttype, + longtype, + ) ) ) union_of_FileLoader_or_DirectoryLoader: Final[_Loader[Directory | File]] = _UnionLoader( @@ -30598,27 +26308,22 @@ def __init__( "id", "type", ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -30629,30 +26334,25 @@ def __init__( ] = _UnionLoader( ( None_type, - array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, + array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, ) ) -idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader: Final[ +idmap_requirements_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader: Final[ _Loader[ None | Sequence[ - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -30661,30 +26361,25 @@ def __init__( ] ] ] = _IdMapLoader( - union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader, + union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader, "class", "None", ) -union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ +union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -30710,35 +26405,25 @@ def __init__( ScatterFeatureRequirementLoader, MultipleInputFeatureRequirementLoader, StepInputExpressionRequirementLoader, - SecretsLoader, - MPIRequirementLoader, - CUDARequirementLoader, - LoopLoader, - ShmSizeLoader, Any_type, ) ) -array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ +array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -30747,30 +26432,25 @@ def __init__( ] ] ] = _ArrayLoader( - union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type + union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type ) -union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ +union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ None | Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -30781,31 +26461,26 @@ def __init__( ] = _UnionLoader( ( None_type, - array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, + array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, ) ) -idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type: Final[ +idmap_hints_union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type: Final[ _Loader[ None | Sequence[ Any - | CUDARequirement | DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement @@ -30814,7 +26489,7 @@ def __init__( ] ] ] = _IdMapLoader( - union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_SecretsLoader_or_MPIRequirementLoader_or_CUDARequirementLoader_or_LoopLoader_or_ShmSizeLoader_or_Any_type, + union_of_None_type_or_array_of_union_of_InlineJavascriptRequirementLoader_or_SchemaDefRequirementLoader_or_LoadListingRequirementLoader_or_DockerRequirementLoader_or_SoftwareRequirementLoader_or_InitialWorkDirRequirementLoader_or_EnvVarRequirementLoader_or_ShellCommandRequirementLoader_or_ResourceRequirementLoader_or_WorkReuseLoader_or_NetworkAccessLoader_or_InplaceUpdateRequirementLoader_or_ToolTimeLimitLoader_or_SubworkflowFeatureRequirementLoader_or_ScatterFeatureRequirementLoader_or_MultipleInputFeatureRequirementLoader_or_StepInputExpressionRequirementLoader_or_Any_type, "class", "None", ) @@ -31395,13 +27070,13 @@ def __init__( uri_ResourceRequirement_classLoader_False_True_None_None: Final[ _Loader[ResourceRequirement_class] ] = _URILoader(ResourceRequirement_classLoader, False, True, None, None) -union_of_None_type_or_inttype_or_inttype_or_floattype_or_ExpressionLoader: Final[ - _Loader[None | float | i32 | str] +union_of_None_type_or_inttype_or_longtype_or_floattype_or_ExpressionLoader: Final[ + _Loader[None | float | i32 | i64 | str] ] = _UnionLoader( ( None_type, inttype, - inttype, + longtype, floattype, ExpressionLoader, ) @@ -31440,11 +27115,11 @@ def __init__( uri_ToolTimeLimit_classLoader_False_True_None_None: Final[ _Loader[ToolTimeLimit_class] ] = _URILoader(ToolTimeLimit_classLoader, False, True, None, None) -union_of_inttype_or_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = ( +union_of_inttype_or_longtype_or_ExpressionLoader: Final[_Loader[i32 | i64 | str]] = ( _UnionLoader( ( inttype, - inttype, + longtype, ExpressionLoader, ) ) @@ -31539,10 +27214,8 @@ def __init__( idmap_hints_union_of_None_type_or_array_of_Any_type: Final[ _Loader[None | Sequence[Any]] ] = _IdMapLoader(union_of_None_type_or_array_of_Any_type, "class", "None") -union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ - _Loader[ - CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str - ] +union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | Operation | Workflow | str] ] = _UnionLoader( ( strtype, @@ -31550,15 +27223,12 @@ def __init__( ExpressionToolLoader, WorkflowLoader, OperationLoader, - ProcessGeneratorLoader, ) ) -uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_False_False_None_None: Final[ - _Loader[ - CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow | str - ] +uri_union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_False_False_None_None: Final[ + _Loader[CommandLineTool | ExpressionTool | Operation | Workflow | str] ] = _URILoader( - union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, + union_of_strtype_or_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader, False, False, None, @@ -31659,75 +27329,27 @@ def __init__( idmap_outputs_array_of_OperationOutputParameterLoader: Final[ _Loader[Sequence[OperationOutputParameter]] ] = _IdMapLoader(array_of_OperationOutputParameterLoader, "id", "type") -uri_strtype_False_True_None_None: Final[_Loader[str]] = _URILoader( - strtype, False, True, None, None -) -uri_array_of_strtype_False_False_0_None: Final[_Loader[Sequence[str]]] = _URILoader( - array_of_strtype, False, False, 0, None -) -union_of_inttype_or_ExpressionLoader: Final[_Loader[i32 | str]] = _UnionLoader( - ( - inttype, - ExpressionLoader, - ) -) -union_of_strtype_or_array_of_strtype: Final[_Loader[Sequence[str] | str]] = ( - _UnionLoader( - ( - strtype, - array_of_strtype, - ) - ) -) -union_of_None_type_or_Any_type: Final[_Loader[Any | None]] = _UnionLoader( - ( - None_type, - Any_type, - ) -) -array_of_LoopInputLoader: Final[_Loader[Sequence[LoopInput]]] = _ArrayLoader( - LoopInputLoader -) -idmap_loop_array_of_LoopInputLoader: Final[_Loader[Sequence[LoopInput]]] = _IdMapLoader( - array_of_LoopInputLoader, "id", "loopSource" -) -LoopOutputModes: TypeAlias = Literal["last", "all"] -LoopOutputModesLoader: Final[_Loader[LoopOutputModes]] = _EnumLoader( - ( - "last", - "all", - ), - "LoopOutputModes", -) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ - _Loader[CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow] +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader: Final[ + _Loader[CommandLineTool | ExpressionTool | Operation | Workflow] ] = _UnionLoader( ( CommandLineToolLoader, ExpressionToolLoader, WorkflowLoader, OperationLoader, - ProcessGeneratorLoader, ) ) -array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ - _Loader[ - Sequence[ - CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow - ] - ] +array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader: Final[ + _Loader[Sequence[CommandLineTool | ExpressionTool | Operation | Workflow]] ] = _ArrayLoader( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader ) -union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader: Final[ +union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader: Final[ _Loader[ CommandLineTool | ExpressionTool | Operation - | ProcessGenerator - | Sequence[ - CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow - ] + | Sequence[CommandLineTool | ExpressionTool | Operation | Workflow] | Workflow ] ] = _UnionLoader( @@ -31736,8 +27358,7 @@ def __init__( ExpressionToolLoader, WorkflowLoader, OperationLoader, - ProcessGeneratorLoader, - array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, + array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader, ) ) @@ -31745,7 +27366,6 @@ def __init__( ( booltype, inttype, - longtype, floattype, strtype, FileLoader, @@ -31755,7 +27375,7 @@ def __init__( ) ) CWLObjectType: TypeAlias = ( - "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str" + "Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | str" ) Sink: TypeAlias = WorkflowStepInput @@ -31771,32 +27391,25 @@ def __init__( | WorkflowOutputParameter ) ProcessRequirement: TypeAlias = ( - CUDARequirement - | DockerRequirement + DockerRequirement | EnvVarRequirement | InitialWorkDirRequirement | InlineJavascriptRequirement | InplaceUpdateRequirement | LoadListingRequirement - | Loop - | MPIRequirement | MultipleInputFeatureRequirement | NetworkAccess | ResourceRequirement | ScatterFeatureRequirement | SchemaDefRequirement - | Secrets | ShellCommandRequirement - | ShmSize | SoftwareRequirement | StepInputExpressionRequirement | SubworkflowFeatureRequirement | ToolTimeLimit | WorkReuse ) -Process: TypeAlias = ( - CommandLineTool | ExpressionTool | Operation | ProcessGenerator | Workflow -) +Process: TypeAlias = CommandLineTool | ExpressionTool | Operation | Workflow CommandInputSchema: TypeAlias = ( CommandInputArraySchema | CommandInputEnumSchema | CommandInputRecordSchema ) @@ -31813,7 +27426,6 @@ def __init__( InputFormat: TypeAlias = InputParameter | InputRecordField OutputFormat: TypeAlias = OutputParameter | OutputRecordField Parameter: TypeAlias = InputParameter | OutputParameter -Documented: TypeAlias = IOSchema | Parameter | Process | RecordField | WorkflowStep IdentifierRequired: TypeAlias = ( Parameter | WorkflowStep | WorkflowStepInput | WorkflowStepOutput ) @@ -31832,7 +27444,7 @@ def load_document( if loadingOptions is None: loadingOptions = LoadingOptions() result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader, doc, baseuri, loadingOptions, @@ -31851,7 +27463,7 @@ def load_document_with_metadata( if loadingOptions is None: loadingOptions = LoadingOptions(fileuri=baseuri) return _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader, doc, baseuri, loadingOptions, @@ -31872,7 +27484,7 @@ def load_document_by_string( loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader, result, uri, loadingOptions, @@ -31895,7 +27507,7 @@ def load_document_by_yaml( loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _document_load( - union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_ProcessGeneratorLoader, + union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader_or_array_of_union_of_CommandLineToolLoader_or_ExpressionToolLoader_or_WorkflowLoader_or_OperationLoader, yaml, uri, loadingOptions, diff --git a/src/cwl_utils/parser/cwl_v1_2_utils.py b/src/cwl_utils/parser/cwl_v1_2_utils.py index 7d973ef4..54949008 100644 --- a/src/cwl_utils/parser/cwl_v1_2_utils.py +++ b/src/cwl_utils/parser/cwl_v1_2_utils.py @@ -9,6 +9,8 @@ from urllib.parse import urldefrag from schema_salad.exceptions import ValidationException +from schema_salad.metaschema import ArraySchema, EnumSchema, RecordSchema +from schema_salad.runtime import LoadingOptions, shortname, file_uri, save from schema_salad.sourceline import add_lc_filename, SourceLine from schema_salad.utils import aslist, json_dumps, yaml_no_ts @@ -63,22 +65,22 @@ def _in_output_type_schema_to_output_type_schema( schema_type: BasicInputTypeSchemas | BasicOutputTypeSchemas, - loading_options: cwl.LoadingOptions, + loading_options: LoadingOptions, ) -> BasicOutputTypeSchemas: match schema_type: - case cwl.ArraySchema(): + case ArraySchema(): return cwl.OutputArraySchema.fromDoc( schema_type.save(), loading_options.baseuri, loading_options, ) - case cwl.EnumSchema(): + case EnumSchema(): return cwl.OutputEnumSchema.fromDoc( schema_type.save(), loading_options.baseuri, loading_options, ) - case cwl.RecordSchema(): + case RecordSchema(): return cwl.OutputRecordSchema.fromDoc( schema_type.save(), loading_options.baseuri, @@ -95,7 +97,7 @@ def in_output_type_schema_to_output_type_schema( | BasicOutputTypeSchemas | Sequence[BasicInputTypeSchemas | BasicOutputTypeSchemas] ), - loading_options: cwl.LoadingOptions, + loading_options: LoadingOptions, ) -> OutputTypeSchemas: if is_sequence(schema_type): return [ @@ -109,14 +111,14 @@ def in_output_type_schema_to_output_type_schema( def _compare_type(type1: Any, type2: Any) -> bool: match (type1, type1): - case cwl.ArraySchema() as t1, cwl.ArraySchema() as t2: + case ArraySchema() as t1, ArraySchema() as t2: return _compare_type(t1.items, t2.items) - case cwl.RecordSchema(), cwl.RecordSchema(): + case RecordSchema(), RecordSchema(): fields1 = { - cwl.shortname(field.name): field.type_ for field in (type1.fields or {}) + shortname(field.name): field.type_ for field in (type1.fields or {}) } fields2 = { - cwl.shortname(field.name): field.type_ for field in (type2.fields or {}) + shortname(field.name): field.type_ for field in (type2.fields or {}) } if fields1.keys() != fields2.keys(): return False @@ -131,16 +133,6 @@ def _compare_type(type1: Any, type2: Any) -> bool: return bool(type1 == type2) -def _is_all_output_method_loop_step( - param_to_step: Mapping[str, cwl.WorkflowStep], parm_id: str -) -> bool: - if (source_step := param_to_step.get(parm_id)) is not None: - for requirement in source_step.requirements or []: - if isinstance(requirement, cwl.Loop) and requirement.outputMethod == "all": - return True - return False - - def _is_conditional_step( param_to_step: Mapping[str, cwl.WorkflowStep], parm_id: str ) -> bool: @@ -153,9 +145,9 @@ def _is_conditional_step( def _inputfile_load( doc: str | MutableMapping[str, Any] | MutableSequence[Any], baseuri: str, - loadingOptions: cwl.LoadingOptions, + loadingOptions: LoadingOptions, addl_metadata_fields: MutableSequence[str] | None = None, -) -> tuple[Any, cwl.LoadingOptions]: +) -> tuple[Any, LoadingOptions]: loader = cwl.CWLInputFileLoader match doc: case str(): @@ -169,9 +161,7 @@ def _inputfile_load( yaml = yaml_no_ts() result = yaml.load(textIO) add_lc_filename(result, doc_url) - loadingOptions = cwl.LoadingOptions( - copyfrom=loadingOptions, fileuri=doc_url - ) + loadingOptions = LoadingOptions(copyfrom=loadingOptions, fileuri=doc_url) _inputfile_load( result, doc_url, @@ -185,7 +175,7 @@ def _inputfile_load( if mf in doc: addl_metadata[mf] = doc[mf] - loadingOptions = cwl.LoadingOptions( + loadingOptions = LoadingOptions( copyfrom=loadingOptions, baseuri=baseuri, addl_metadata=addl_metadata, @@ -269,11 +259,6 @@ def check_all_types( ) ) type_dict[src_dict[parm_id].id] = src_typ - if _is_all_output_method_loop_step(param_to_step, parm_id): - src_typ = type_dict[src_dict[parm_id].id] - type_dict[src_dict[parm_id].id] = cwl.ArraySchema( - items=src_typ, type_="array" - ) else: if is_sequence(sourceField): parm_id = sourceField[0] @@ -303,11 +288,6 @@ def check_all_types( message="Source is from conditional step, but pickValue is not used", ) ) - if _is_all_output_method_loop_step(param_to_step, parm_id): - src_typ = type_dict[src_dict[parm_id].id] - type_dict[src_dict[parm_id].id] = cwl.ArraySchema( - items=src_typ, type_="array" - ) for src in srcs_of_sink: check_result = cwl_utils.parser.utils.check_types( type_dict[src.id], @@ -390,13 +370,13 @@ def convert_stdstreams_to_files(clt: cwl.CommandLineTool) -> None: def load_inputfile( doc: Any, baseuri: str | None = None, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.2 input file from a serialized YAML string or a YAML object.""" if baseuri is None: - baseuri = cwl.file_uri(str(Path.cwd())) + "/" + baseuri = file_uri(str(Path.cwd())) + "/" if loadingOptions is None: - loadingOptions = cwl.LoadingOptions() + loadingOptions = LoadingOptions() result, metadata = _inputfile_load( doc, @@ -409,14 +389,14 @@ def load_inputfile( def load_inputfile_by_string( string: Any, uri: str, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.2 input file from a serialized YAML string.""" result = yaml_no_ts().load(string) add_lc_filename(result, uri) if loadingOptions is None: - loadingOptions = cwl.LoadingOptions(fileuri=uri) + loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _inputfile_load( result, @@ -429,13 +409,13 @@ def load_inputfile_by_string( def load_inputfile_by_yaml( yaml: Any, uri: str, - loadingOptions: cwl.LoadingOptions | None = None, + loadingOptions: LoadingOptions | None = None, ) -> Any: """Load a CWL v1.2 input file from a YAML object.""" add_lc_filename(yaml, uri) if loadingOptions is None: - loadingOptions = cwl.LoadingOptions(fileuri=uri) + loadingOptions = LoadingOptions(fileuri=uri) result, metadata = _inputfile_load( yaml, @@ -504,7 +484,7 @@ def type_for_step_output( raise ValidationException( "param {} not found in {}.".format( sourcename, - yaml_dumps(cwl.save(step)), + yaml_dumps(save(step)), ) ) @@ -522,7 +502,9 @@ def type_for_source( ): """Determine the type for the given sourcenames.""" scatter_context: list[tuple[int, str] | None] = [] - params = param_for_source_id(process, sourcenames, parent, scatter_context) + params = cwl_utils.parser.utils.param_for_source_id( + process, sourcenames, parent, scatter_context + ) if not isinstance(params, MutableSequence): new_type: InputTypeSchemas | OutputTypeSchemas = params.type_ if scatter_context[0] is not None: @@ -551,7 +533,7 @@ def type_for_source( elif linkMerge == "merge_flattened": new_type = cwl_utils.parser.utils.merge_flatten_type(new_type) if pickValue is not None: - if isinstance(new_type, cwl.ArraySchema): + if isinstance(new_type, ArraySchema): if pickValue in ("first_non_null", "the_only_non_null"): return new_type.items return new_type @@ -604,96 +586,7 @@ def type_for_source( type_="array", ) if pickValue is not None: - if isinstance(final_type, cwl.ArraySchema): + if isinstance(final_type, ArraySchema): if pickValue in ("first_non_null", "the_only_non_null"): return final_type.items return final_type - - -def param_for_source_id( - process: cwl.Process, - sourcenames: str | Sequence[str], - parent: cwl.Workflow | None = None, - scatter_context: list[tuple[int, str] | None] | None = None, -) -> ( - cwl_utils.parser.InputParameter - | cwl_utils.parser.OutputParameter - | MutableSequence[ - cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter - ] -): - """Find the process input parameter that matches one of the given sourcenames.""" - if isinstance(sourcenames, str): - sourcenames = [sourcenames] - params: MutableSequence[ - cwl_utils.parser.InputParameter | cwl_utils.parser.OutputParameter - ] = [] - for sourcename in sourcenames: - if not isinstance(process, cwl.Workflow): - for param in process.inputs: - if param.id.split("#")[-1] == sourcename.split("#")[-1]: - params.append(param) - if scatter_context is not None: - scatter_context.append(None) - targets = [process] - if parent: - targets.append(parent) - for target in targets: - if isinstance(target, cwl.Workflow): - for inp in target.inputs: - if inp.id.split("#")[-1] == sourcename.split("#")[-1]: - params.append(inp) - if scatter_context is not None: - scatter_context.append(None) - for step in target.steps: - if ( - "/".join(sourcename.split("#")[-1].split("/")[:-1]) - == step.id.split("#")[-1] - and step.out - ): - step_run = cwl_utils.parser.utils.load_step(step) - cwl_utils.parser.utils.convert_stdstreams_to_files(step_run) - for outp in step.out: - outp_id = outp if isinstance(outp, str) else outp.id - if ( - outp_id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - if step_run and step_run.outputs: - for output in step_run.outputs: - if ( - output.id.split("#")[-1].split("/")[-1] - == sourcename.split("#")[-1].split("/")[-1] - ): - params.append(output) - if scatter_context is not None: - match step.scatter: - case str(): - scatter_context.append( - ( - 1, - step.scatterMethod - or "dotproduct", - ) - ) - case Sequence(): - scatter_context.append( - ( - len(step.scatter), - step.scatterMethod - or "dotproduct", - ) - ) - case _: - scatter_context.append(None) - if len(params) == 1: - return params[0] - elif len(params) > 1: - return params - raise WorkflowException( - "param {} not found in {}\n{}.".format( - sourcename, - yaml_dumps(cwl.save(process)), - (f" or\n {yaml_dumps(cwl.save(parent))}" if parent is not None else ""), - ) - ) diff --git a/src/cwl_utils/parser/utils.py b/src/cwl_utils/parser/utils.py index 10b180bb..30993c3d 100644 --- a/src/cwl_utils/parser/utils.py +++ b/src/cwl_utils/parser/utils.py @@ -2,28 +2,26 @@ import copy import logging +from collections.abc import Mapping from collections.abc import MutableMapping, MutableSequence, Sequence from pathlib import Path from typing import ( Any, Final, - Optional, cast, Literal, TypeAlias, overload, - Mapping, ) from urllib.parse import unquote_plus, urlparse from schema_salad.exceptions import ValidationException +from schema_salad.metaschema import ArraySchema +from schema_salad.runtime import file_uri, shortname, save, LoadingOptions from schema_salad.sourceline import SourceLine, strip_dup_lineno -from schema_salad.utils import json_dumps, yaml_no_ts +from schema_salad.utils import yaml_no_ts from . import ( - CommandLineTool, - ExpressionTool, - LoadingOptions, Process, Workflow, WorkflowStep, @@ -39,14 +37,15 @@ InputArraySchema, OutputParameter, InputParameter, - ArraySchema, InputRecordSchema, CommandOutputRecordSchema, OutputRecordSchema, InputRecordField, OutputRecordField, ) +from ..errors import WorkflowException from ..types import is_sequence +from ..utils import yaml_dumps _logger = logging.getLogger("cwl_utils") @@ -96,7 +95,7 @@ def _compare_records( step, so that they can be compared. """ srcfields = { - cwl_v1_2.shortname(field.name): cast( + shortname(field.name): cast( InputTypeSchemas | OutputTypeSchemas | None, field.type_ ) for field in cast( @@ -104,7 +103,7 @@ def _compare_records( ) } sinkfields = { - cwl_v1_2.shortname(field.name): cast( + shortname(field.name): cast( InputTypeSchemas | OutputTypeSchemas | None, field.type_ ) for field in cast( @@ -199,7 +198,7 @@ def check_types( return "exception" if linkMerge == "merge_nested": return check_types( - cwl_v1_2.ArraySchema(items=srctype, type_="array"), sinktype, None, None + ArraySchema(items=srctype, type_="array"), sinktype, None, None ) if linkMerge == "merge_flattened": return check_types(merge_flatten_type(srctype), sinktype, None, None) @@ -217,21 +216,6 @@ def convert_stdstreams_to_files(process: Process) -> None: cwl_v1_2_utils.convert_stdstreams_to_files(process) -def dump_type( - type_: InputTypeSchemas | OutputTypeSchemas | None, - cwlVersion: Literal["v1.0", "v1.1", "v1.2"], -) -> str: - match cwlVersion: - case "v1.0": - return json_dumps(cwl_v1_0.save(type_)) - case "v1.1": - return json_dumps(cwl_v1_1.save(type_)) - case "v1.2": - return json_dumps(cwl_v1_2.save(type_)) - case _: - raise Exception(f"Unsupported CWL version {cwlVersion}") - - def load_inputfile_by_uri( version: str, path: str | Path, @@ -253,17 +237,7 @@ def load_inputfile_by_uri( baseuri: str = real_path if loadingOptions is None: - match version: - case "v1.0": - loadingOptions = cwl_v1_0.LoadingOptions(fileuri=baseuri) - case "v1.1": - loadingOptions = cwl_v1_1.LoadingOptions(fileuri=baseuri) - case "v1.2": - loadingOptions = cwl_v1_2.LoadingOptions(fileuri=baseuri) - case _: - raise ValidationException( - f"Version error. Did not recognise {version} as a CWL version" - ) + loadingOptions = LoadingOptions(fileuri=baseuri) doc = loadingOptions.fetcher.fetch_text(real_path) return load_inputfile_by_string(version, doc, baseuri, loadingOptions) @@ -277,7 +251,7 @@ def load_inputfile( ) -> Any: """Load a CWL input file from a serialized YAML string or a YAML object.""" if baseuri is None: - baseuri = cwl_v1_0.file_uri(str(Path.cwd())) + "/" + baseuri = file_uri(str(Path.cwd())) + "/" if isinstance(doc, str): return load_inputfile_by_string(version, doc, baseuri, loadingOptions) return load_inputfile_by_yaml(version, doc, baseuri, loadingOptions) @@ -303,17 +277,11 @@ def load_inputfile_by_yaml( """Load a CWL input file from a YAML object.""" match version: case "v1.0": - return cwl_v1_0_utils.load_inputfile_by_yaml( - yaml, uri, cast(Optional[cwl_v1_0.LoadingOptions], loadingOptions) - ) + return cwl_v1_0_utils.load_inputfile_by_yaml(yaml, uri, loadingOptions) case "v1.1": - return cwl_v1_1_utils.load_inputfile_by_yaml( - yaml, uri, cast(Optional[cwl_v1_1.LoadingOptions], loadingOptions) - ) + return cwl_v1_1_utils.load_inputfile_by_yaml(yaml, uri, loadingOptions) case "v1.2": - return cwl_v1_2_utils.load_inputfile_by_yaml( - yaml, uri, cast(Optional[cwl_v1_2.LoadingOptions], loadingOptions) - ) + return cwl_v1_2_utils.load_inputfile_by_yaml(yaml, uri, loadingOptions) case None: raise ValidationException("could not get the cwlVersion") case _: @@ -334,7 +302,7 @@ def load_step( loadingOptions=step.loadingOptions, ) return cast(Process, step_run) - return cast(Process, copy.deepcopy(step.run)) + return copy.deepcopy(step.run) def merge_flatten_type(src: Any) -> Any: @@ -343,7 +311,90 @@ def merge_flatten_type(src: Any) -> Any: return [merge_flatten_type(t) for t in src] if isinstance(src, ArraySchema): return src - return cwl_v1_2.ArraySchema(type_="array", items=src) + return ArraySchema(type_="array", items=src) + + +def param_for_source_id( + process: Process, + sourcenames: str | Sequence[str], + parent: Workflow | None = None, + scatter_context: list[tuple[int, str] | None] | None = None, +) -> ( + InputParameter | OutputParameter | MutableSequence[InputParameter | OutputParameter] +): + """Find the process input parameter that matches one of the given sourcenames.""" + if isinstance(sourcenames, str): + sourcenames = [sourcenames] + params: MutableSequence[InputParameter | OutputParameter] = [] + for sourcename in sourcenames: + if not isinstance(process, Workflow): + for param in process.inputs: + if param.id.split("#")[-1] == sourcename.split("#")[-1]: + params.append(param) + if scatter_context is not None: + scatter_context.append(None) + targets = [process] + if parent: + targets.append(parent) + for target in targets: + if isinstance(target, Workflow): + for inp in target.inputs: + if inp.id.split("#")[-1] == sourcename.split("#")[-1]: + params.append(inp) + if scatter_context is not None: + scatter_context.append(None) + for step in target.steps: + if ( + "/".join(sourcename.split("#")[-1].split("/")[:-1]) + == step.id.split("#")[-1] + and step.out + ): + step_run = load_step(step) + convert_stdstreams_to_files(step_run) + for outp in step.out: + outp_id = outp if isinstance(outp, str) else outp.id + if ( + outp_id.split("#")[-1].split("/")[-1] + == sourcename.split("#")[-1].split("/")[-1] + ): + if step_run and step_run.outputs: + for output in step_run.outputs: + if ( + output.id.split("#")[-1].split("/")[-1] + == sourcename.split("#")[-1].split("/")[-1] + ): + params.append(output) + if scatter_context is not None: + match step.scatter: + case str(): + scatter_context.append( + ( + 1, + step.scatterMethod + or "dotproduct", + ) + ) + case Sequence(): + scatter_context.append( + ( + len(step.scatter), + step.scatterMethod + or "dotproduct", + ) + ) + case _: + scatter_context.append(None) + if len(params) == 1: + return params[0] + elif len(params) > 1: + return params + raise WorkflowException( + "param {} not found in {}\n{}.".format( + sourcename, + yaml_dumps(save(process)), + (f" or\n {yaml_dumps(save(parent))}" if parent is not None else ""), + ) + ) def static_checker(workflow: Workflow) -> None: @@ -485,16 +536,16 @@ def static_checker(workflow: Workflow) -> None: SourceLine(src, "type").makeError( "Source '%s' of type %s may be incompatible" % ( - shortname(src.id, workflow.cwlVersion), - dump_type(type_dict[src.id], workflow.cwlVersion), + shortname(src.id), + save(type_dict[src.id]), ) ) + "\n" + SourceLine(sink, "type").makeError( " with sink '%s' of type %s" % ( - shortname(sink.id, workflow.cwlVersion), - dump_type(type_dict[sink.id], workflow.cwlVersion), + shortname(sink.id), + save(type_dict[sink.id]), ) ) ) @@ -519,16 +570,16 @@ def static_checker(workflow: Workflow) -> None: SourceLine(src, "type").makeError( "Source '%s' of type %s is incompatible" % ( - shortname(src.id, workflow.cwlVersion), - dump_type(type_dict[src.id], workflow.cwlVersion), + shortname(src.id), + save(type_dict[src.id]), ) ) + "\n" + SourceLine(sink, "type").makeError( " with sink '%s' of type %s" % ( - shortname(sink.id, workflow.cwlVersion), - dump_type(type_dict[sink.id], workflow.cwlVersion), + shortname(sink.id), + save(type_dict[sink.id]), ) ) ) @@ -552,7 +603,7 @@ def static_checker(workflow: Workflow) -> None: ): msg = SourceLine(sink).makeError( "Required parameter '%s' does not have source, default, or valueFrom expression" - % shortname(sink.id, workflow.cwlVersion), + % shortname(sink.id), ) exception_msgs.append(msg) @@ -716,53 +767,3 @@ def type_for_step_output( ) case _: raise Exception(f"Unsupported CWL version {cwlVersion}") - - -def param_for_source_id( - process: CommandLineTool | Workflow | ExpressionTool, - sourcenames: str | list[str], - parent: Workflow | None = None, - scatter_context: list[tuple[int, str] | None] | None = None, -) -> ( - InputParameter | OutputParameter | MutableSequence[InputParameter | OutputParameter] -): - match process.cwlVersion: - case "v1.0": - return cwl_v1_0_utils.param_for_source_id( - process, - sourcenames, - cast(cwl_v1_0.Workflow, parent), - scatter_context, - ) - case "v1.1": - return cwl_v1_1_utils.param_for_source_id( - process, - sourcenames, - cast(cwl_v1_1.Workflow, parent), - scatter_context, - ) - case "v1.2": - return cwl_v1_2_utils.param_for_source_id( - process, - sourcenames, - cast(cwl_v1_2.Workflow, parent), - scatter_context, - ) - case None: - raise ValidationException("could not get the cwlVersion") - case _: - raise ValidationException( - f"Version error. Did not recognise {process.cwlVersion} as a CWL version" - ) - - -def shortname(name: str, cwlVersion: Literal["v1.0", "v1.1", "v1.2"]) -> str: - match cwlVersion: - case "v1.0": - return cwl_v1_0.shortname(name) - case "v1.1": - return cwl_v1_1.shortname(name) - case "v1.2": - return cwl_v1_2.shortname(name) - case _: - raise Exception(f"Unsupported CWL version {cwlVersion}") diff --git a/src/cwl_utils/testdata/extensions/all-output-loop_v1_2.cwl b/src/cwl_utils/testdata/extensions/all-output-loop_v1_2.cwl deleted file mode 100755 index 096be519..00000000 --- a/src/cwl_utils/testdata/extensions/all-output-loop_v1_2.cwl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.2 -class: Workflow -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - InlineJavascriptRequirement: {} -inputs: - i1: int -outputs: - o1: - type: int[] - outputSource: subworkflow/o1 -steps: - subworkflow: - run: - class: ExpressionTool - inputs: - i1: int - outputs: - o1: int - expression: > - ${return {'o1': inputs.i1 + 1};} - in: - i1: i1 - out: [o1] - requirements: - cwltool:Loop: - loopWhen: $(inputs.i1 < 10) - loop: - i1: o1 - outputMethod: all diff --git a/src/cwl_utils/testdata/extensions/cuda-requirement_v1_0.cwl b/src/cwl_utils/testdata/extensions/cuda-requirement_v1_0.cwl deleted file mode 100755 index 21985e6c..00000000 --- a/src/cwl_utils/testdata/extensions/cuda-requirement_v1_0.cwl +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.0 -class: CommandLineTool -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:CUDARequirement: - cudaVersionMin: "1.0" - cudaComputeCapability: "1.0" - cudaDeviceCountMin: $(inputs.gpus) -inputs: - gpus: - type: int - default: 1 -outputs: [] -baseCommand: "nvidia-smi" \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/cuda-requirement_v1_1.cwl b/src/cwl_utils/testdata/extensions/cuda-requirement_v1_1.cwl deleted file mode 100755 index 9c24f0fe..00000000 --- a/src/cwl_utils/testdata/extensions/cuda-requirement_v1_1.cwl +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.1 -class: CommandLineTool -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:CUDARequirement: - cudaVersionMin: "1.0" - cudaComputeCapability: "1.0" - cudaDeviceCountMin: $(inputs.gpus) -inputs: - gpus: - type: int - default: 1 -outputs: [] -baseCommand: "nvidia-smi" \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/cuda-requirement_v1_2.cwl b/src/cwl_utils/testdata/extensions/cuda-requirement_v1_2.cwl deleted file mode 100755 index 4f1ecbd8..00000000 --- a/src/cwl_utils/testdata/extensions/cuda-requirement_v1_2.cwl +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.2 -class: CommandLineTool -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:CUDARequirement: - cudaVersionMin: "1.0" - cudaComputeCapability: "1.0" - cudaDeviceCountMin: $(inputs.gpus) -inputs: - gpus: - type: int - default: 1 -outputs: [] -baseCommand: "nvidia-smi" \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/inplace-update-requirement_v1_0.cwl b/src/cwl_utils/testdata/extensions/inplace-update-requirement_v1_0.cwl deleted file mode 100755 index 14f72054..00000000 --- a/src/cwl_utils/testdata/extensions/inplace-update-requirement_v1_0.cwl +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.0 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:InplaceUpdateRequirement: - inplaceUpdate: true -inputs: - r: File - script: - type: File - default: - class: File - location: updateval.py -outputs: - out: - type: File - outputBinding: - glob: $(inputs.r.basename) -arguments: [python, $(inputs.script), $(inputs.r.basename)] \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/load-listing-requirement_v1_0.cwl b/src/cwl_utils/testdata/extensions/load-listing-requirement_v1_0.cwl deleted file mode 100755 index 36d67fb4..00000000 --- a/src/cwl_utils/testdata/extensions/load-listing-requirement_v1_0.cwl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.0 -$namespaces: - cwltool: http://commonwl.org/cwltool# -requirements: - cwltool:LoadListingRequirement: - loadListing: shallow_listing -inputs: - d: Directory -outputs: [] -arguments: - [echo, "$(inputs.d.listing[0].listing[0])"] diff --git a/src/cwl_utils/testdata/extensions/mpi-requirement_v1_0.cwl b/src/cwl_utils/testdata/extensions/mpi-requirement_v1_0.cwl deleted file mode 100755 index 72dc680b..00000000 --- a/src/cwl_utils/testdata/extensions/mpi-requirement_v1_0.cwl +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.0 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" - -baseCommand: env -requirements: - cwltool:MPIRequirement: - processes: 1 -inputs: {} -outputs: - environment: - type: stdout \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/mpi-requirement_v1_1.cwl b/src/cwl_utils/testdata/extensions/mpi-requirement_v1_1.cwl deleted file mode 100755 index a4ad0fe1..00000000 --- a/src/cwl_utils/testdata/extensions/mpi-requirement_v1_1.cwl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.1 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -baseCommand: env -requirements: - cwltool:MPIRequirement: - processes: 1 -inputs: {} -outputs: - environment: - type: stdout \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/mpi-requirement_v1_2.cwl b/src/cwl_utils/testdata/extensions/mpi-requirement_v1_2.cwl deleted file mode 100755 index 5790f414..00000000 --- a/src/cwl_utils/testdata/extensions/mpi-requirement_v1_2.cwl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.2 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -baseCommand: env -requirements: - cwltool:MPIRequirement: - processes: 1 -inputs: {} -outputs: - environment: - type: stdout \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/network-access_v1_0.cwl b/src/cwl_utils/testdata/extensions/network-access_v1_0.cwl deleted file mode 100755 index 4152a116..00000000 --- a/src/cwl_utils/testdata/extensions/network-access_v1_0.cwl +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.0 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:NetworkAccess: - networkAccess: true -inputs: [] -outputs: [] -baseCommand: python -arguments: - - "-c" - - valueFrom: | - import urllib.request - assert(urllib.request.urlopen("http://commonwl.org").code == 200) \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/process-generator_v1_0.cwl b/src/cwl_utils/testdata/extensions/process-generator_v1_0.cwl deleted file mode 100755 index 01df6367..00000000 --- a/src/cwl_utils/testdata/extensions/process-generator_v1_0.cwl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.0 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -class: cwltool:ProcessGenerator -inputs: - script: string - dir: Directory -outputs: {} -run: - class: CommandLineTool - inputs: - script: string - dir: Directory - outputs: - runProcess: - type: File - outputBinding: - glob: main.cwl - requirements: - InlineJavascriptRequirement: {} - LoadListingRequirement: - loadListing: shallow_listing - InitialWorkDirRequirement: - listing: | - ${ - var v = inputs.dir.listing; - v.push({entryname: "inp.py", entry: inputs.script}); - return v; - } - arguments: [python3, inp.py] - stdout: main.cwl \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/process-generator_v1_1.cwl b/src/cwl_utils/testdata/extensions/process-generator_v1_1.cwl deleted file mode 100755 index b4ccc99c..00000000 --- a/src/cwl_utils/testdata/extensions/process-generator_v1_1.cwl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.1 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -class: cwltool:ProcessGenerator -inputs: - script: string - dir: Directory -outputs: {} -run: - class: CommandLineTool - inputs: - script: string - dir: Directory - outputs: - runProcess: - type: File - outputBinding: - glob: main.cwl - requirements: - InlineJavascriptRequirement: {} - LoadListingRequirement: - loadListing: shallow_listing - InitialWorkDirRequirement: - listing: | - ${ - var v = inputs.dir.listing; - v.push({entryname: "inp.py", entry: inputs.script}); - return v; - } - arguments: [python3, inp.py] - stdout: main.cwl \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/process-generator_v1_2.cwl b/src/cwl_utils/testdata/extensions/process-generator_v1_2.cwl deleted file mode 100755 index 62960a2f..00000000 --- a/src/cwl_utils/testdata/extensions/process-generator_v1_2.cwl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.2 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -class: cwltool:ProcessGenerator -inputs: - script: string - dir: Directory -outputs: {} -run: - class: CommandLineTool - inputs: - script: string - dir: Directory - outputs: - runProcess: - type: File - outputBinding: - glob: main.cwl - requirements: - InlineJavascriptRequirement: {} - LoadListingRequirement: - loadListing: shallow_listing - InitialWorkDirRequirement: - listing: | - ${ - var v = inputs.dir.listing; - v.push({entryname: "inp.py", entry: inputs.script}); - return v; - } - arguments: [python3, inp.py] - stdout: main.cwl \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/secrets_v1_0.cwl b/src/cwl_utils/testdata/extensions/secrets_v1_0.cwl deleted file mode 100755 index 63446512..00000000 --- a/src/cwl_utils/testdata/extensions/secrets_v1_0.cwl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.0 -class: CommandLineTool -$namespaces: - cwltool: http://commonwl.org/cwltool# -requirements: - cwltool:Secrets: - secrets: [pw] -inputs: - pw: string -outputs: - out: stdout -arguments: [cat, example.conf] diff --git a/src/cwl_utils/testdata/extensions/secrets_v1_1.cwl b/src/cwl_utils/testdata/extensions/secrets_v1_1.cwl deleted file mode 100755 index 09d476f6..00000000 --- a/src/cwl_utils/testdata/extensions/secrets_v1_1.cwl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.1 -class: CommandLineTool -$namespaces: - cwltool: http://commonwl.org/cwltool# -requirements: - cwltool:Secrets: - secrets: [pw] -inputs: - pw: string -outputs: - out: stdout -arguments: [cat, example.conf] diff --git a/src/cwl_utils/testdata/extensions/secrets_v1_2.cwl b/src/cwl_utils/testdata/extensions/secrets_v1_2.cwl deleted file mode 100755 index 02d7dff6..00000000 --- a/src/cwl_utils/testdata/extensions/secrets_v1_2.cwl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.2 -class: CommandLineTool -$namespaces: - cwltool: http://commonwl.org/cwltool# -requirements: - cwltool:Secrets: - secrets: [pw] -inputs: - pw: string -outputs: - out: stdout -arguments: [cat, example.conf] diff --git a/src/cwl_utils/testdata/extensions/shm-size_v1_0.cwl b/src/cwl_utils/testdata/extensions/shm-size_v1_0.cwl deleted file mode 100755 index 01f90a44..00000000 --- a/src/cwl_utils/testdata/extensions/shm-size_v1_0.cwl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.0 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:ShmSize: - shmSize: 128m -inputs: [] -outputs: - output: - type: stdout -baseCommand: echo -stdout: shm-size.txt -arguments: [ $(runtime) ] diff --git a/src/cwl_utils/testdata/extensions/shm-size_v1_1.cwl b/src/cwl_utils/testdata/extensions/shm-size_v1_1.cwl deleted file mode 100755 index 3bff20df..00000000 --- a/src/cwl_utils/testdata/extensions/shm-size_v1_1.cwl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.1 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:ShmSize: - shmSize: 128m -inputs: [] -outputs: - output: - type: stdout -baseCommand: echo -stdout: shm-size.txt -arguments: [ $(runtime) ] diff --git a/src/cwl_utils/testdata/extensions/shm-size_v1_2.cwl b/src/cwl_utils/testdata/extensions/shm-size_v1_2.cwl deleted file mode 100755 index b6491432..00000000 --- a/src/cwl_utils/testdata/extensions/shm-size_v1_2.cwl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.2 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:ShmSize: - shmSize: 128m -inputs: [] -outputs: - output: - type: stdout -baseCommand: echo -stdout: shm-size.txt -arguments: [ $(runtime) ] diff --git a/src/cwl_utils/testdata/extensions/single-var-loop_v1_2.cwl b/src/cwl_utils/testdata/extensions/single-var-loop_v1_2.cwl deleted file mode 100755 index c5f76563..00000000 --- a/src/cwl_utils/testdata/extensions/single-var-loop_v1_2.cwl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env cwl-runner -cwlVersion: v1.2 -class: Workflow -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - InlineJavascriptRequirement: {} -inputs: - i1: int -outputs: - o1: - type: int - outputSource: subworkflow/o1 -steps: - subworkflow: - run: - class: ExpressionTool - inputs: - i1: int - outputs: - o1: int - expression: > - ${return {'o1': inputs.i1 + 1};} - in: - i1: i1 - out: [o1] - requirements: - cwltool:Loop: - loopWhen: $(inputs.i1 < 10) - loop: - i1: o1 - outputMethod: last diff --git a/src/cwl_utils/testdata/extensions/time-limit_v1_0.cwl b/src/cwl_utils/testdata/extensions/time-limit_v1_0.cwl deleted file mode 100755 index 7106a934..00000000 --- a/src/cwl_utils/testdata/extensions/time-limit_v1_0.cwl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.0 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -inputs: - sleep_time: - type: int - default: 3 - inputBinding: {} -outputs: [] -requirements: - cwltool:TimeLimit: - timelimit: 20 -baseCommand: sleep \ No newline at end of file diff --git a/src/cwl_utils/testdata/extensions/work-reuse_v1_0.cwl b/src/cwl_utils/testdata/extensions/work-reuse_v1_0.cwl deleted file mode 100755 index 7278cb2b..00000000 --- a/src/cwl_utils/testdata/extensions/work-reuse_v1_0.cwl +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env cwl-runner -class: CommandLineTool -cwlVersion: v1.0 -$namespaces: - cwltool: "http://commonwl.org/cwltool#" -requirements: - cwltool:WorkReuse: - enableReuse: false -inputs: [] -outputs: - page: stdout -stdout: time.txt -baseCommand: python -arguments: - - "-c" - - valueFrom: | - import time - print(time.time()) diff --git a/src/cwl_utils/tests/test_extensions.py b/src/cwl_utils/tests/test_extensions.py deleted file mode 100644 index fa9044dd..00000000 --- a/src/cwl_utils/tests/test_extensions.py +++ /dev/null @@ -1,197 +0,0 @@ -from cwl_utils.parser import cwl_v1_0, cwl_v1_1, cwl_v1_2, load_document_by_uri - -from .util import get_path - - -def test_cuda_requirement_v1_0() -> None: - """Test that CUDARequirement objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/cuda-requirement_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_0.CUDARequirement) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:CUDARequirement" - - -def test_cuda_requirement_v1_1() -> None: - """Test that CUDARequirement objects are correctly loaded for CWL v1.1.""" - uri = get_path("testdata/extensions/cuda-requirement_v1_1.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_1.CUDARequirement) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:CUDARequirement" - - -def test_cuda_requirement_v1_2() -> None: - """Test that CUDARequirement objects are correctly loaded for CWL v1.2.""" - uri = get_path("testdata/extensions/cuda-requirement_v1_2.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_2.CUDARequirement) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:CUDARequirement" - - -def test_load_listing_requirement_v1_0() -> None: - """Test that LoadListingRequirement objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/load-listing-requirement_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_0.LoadListingRequirement) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:LoadListingRequirement" - - -def test_loop_v1_2() -> None: - """Test that Loop and LoopInput objects are correctly loaded for CWL v1.2.""" - uri = get_path("testdata/extensions/single-var-loop_v1_2.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - cwl_step = next(iter(cwl_obj.steps)) - loop_req = next(iter(cwl_step.requirements)) - assert isinstance(loop_req, cwl_v1_2.Loop) - assert isinstance(next(iter(loop_req.loop)), cwl_v1_2.LoopInput) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["steps"][0]["requirements"][0]["class"] == "cwltool:Loop" - - -def test_inplace_update_requirement_v1_0() -> None: - """Test that InplaceUpdateRequirement objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/inplace-update-requirement_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance( - next(iter(cwl_obj.requirements)), cwl_v1_0.InplaceUpdateRequirement - ) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:InplaceUpdateRequirement" - - -def test_mpi_requirement_v1_0() -> None: - """Test that MPIRequirement objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/mpi-requirement_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_0.MPIRequirement) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:MPIRequirement" - - -def test_mpi_requirement_v1_1() -> None: - """Test that MPIRequirement objects are correctly loaded for CWL v1.1.""" - uri = get_path("testdata/extensions/mpi-requirement_v1_1.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_1.MPIRequirement) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:MPIRequirement" - - -def test_mpi_requirement_v1_2() -> None: - """Test that MPIRequirement objects are correctly loaded for CWL v1.2.""" - uri = get_path("testdata/extensions/mpi-requirement_v1_2.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_2.MPIRequirement) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:MPIRequirement" - - -def test_network_access_v1_0() -> None: - """Test that NetworkAccess objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/network-access_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_0.NetworkAccess) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:NetworkAccess" - - -def test_process_generator_v1_0() -> None: - """Test that ProcessGenerator objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/process-generator_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(cwl_obj, cwl_v1_0.ProcessGenerator) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["class"] == "cwltool:ProcessGenerator" - - -def test_process_generator_v1_1() -> None: - """Test that ProcessGenerator objects are correctly loaded for CWL v1.1.""" - uri = get_path("testdata/extensions/process-generator_v1_1.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(cwl_obj, cwl_v1_1.ProcessGenerator) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["class"] == "cwltool:ProcessGenerator" - - -def test_process_generator_v1_2() -> None: - """Test that ProcessGenerator objects are correctly loaded for CWL v1.2.""" - uri = get_path("testdata/extensions/process-generator_v1_2.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(cwl_obj, cwl_v1_2.ProcessGenerator) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["class"] == "cwltool:ProcessGenerator" - - -def test_secrets_v1_0() -> None: - """Test that Secrets objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/secrets_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_0.Secrets) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:Secrets" - - -def test_secrets_v1_1() -> None: - """Test that Secrets objects are correctly loaded for CWL v1.1.""" - uri = get_path("testdata/extensions/secrets_v1_1.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_1.Secrets) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:Secrets" - - -def test_secrets_v1_2() -> None: - """Test that Secrets objects are correctly loaded for CWL v1.2.""" - uri = get_path("testdata/extensions/secrets_v1_2.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_2.Secrets) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:Secrets" - - -def test_shm_size_v1_0() -> None: - """Test that ShmSize objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/shm-size_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_0.ShmSize) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:ShmSize" - - -def test_shm_size_v1_1() -> None: - """Test that ShmSize objects are correctly loaded for CWL v1.1.""" - uri = get_path("testdata/extensions/shm-size_v1_1.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_1.ShmSize) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:ShmSize" - - -def test_shm_size_v1_2() -> None: - """Test that ShmSize objects are correctly loaded for CWL v1.2.""" - uri = get_path("testdata/extensions/shm-size_v1_2.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_2.ShmSize) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:ShmSize" - - -def test_time_limit_v1_0() -> None: - """Test that TimeLimit objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/time-limit_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_0.TimeLimit) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:TimeLimit" - - -def test_work_reuse_v1_0() -> None: - """Test that WorkReuse objects are correctly loaded for CWL v1.0.""" - uri = get_path("testdata/extensions/work-reuse_v1_0.cwl").as_uri() - cwl_obj = load_document_by_uri(uri) - assert isinstance(next(iter(cwl_obj.requirements)), cwl_v1_0.WorkReuse) - cwl_dict = cwl_obj.save(top=True) - assert cwl_dict["requirements"][0]["class"] == "cwltool:WorkReuse" diff --git a/src/cwl_utils/tests/test_parser.py b/src/cwl_utils/tests/test_parser.py index fc33596a..31cfc80f 100644 --- a/src/cwl_utils/tests/test_parser.py +++ b/src/cwl_utils/tests/test_parser.py @@ -3,11 +3,11 @@ from pytest import raises from ruamel.yaml.main import YAML +from schema_salad.schema import shortname import cwl_utils.parser.latest as latest from cwl_utils.errors import GraphTargetMissingException from cwl_utils.parser import ( - cwl_v1_2, cwl_version, load_document, load_document_by_uri, @@ -86,12 +86,12 @@ def test_latest_parser() -> None: def test_shortname() -> None: - assert cwl_v1_2.shortname("http://example.com/foo") == "foo" - assert cwl_v1_2.shortname("http://example.com/#bar") == "bar" - assert cwl_v1_2.shortname("http://example.com/foo/bar") == "bar" - assert cwl_v1_2.shortname("http://example.com/foo#bar") == "bar" - assert cwl_v1_2.shortname("http://example.com/#foo/bar") == "bar" - assert cwl_v1_2.shortname("http://example.com/foo#bar/baz") == "baz" + assert shortname("http://example.com/foo") == "foo" + assert shortname("http://example.com/#bar") == "bar" + assert shortname("http://example.com/foo/bar") == "bar" + assert shortname("http://example.com/foo#bar") == "bar" + assert shortname("http://example.com/#foo/bar") == "bar" + assert shortname("http://example.com/foo#bar/baz") == "baz" def test_get_id_from_graph() -> None: diff --git a/src/cwl_utils/tests/test_parser_utils.py b/src/cwl_utils/tests/test_parser_utils.py index 2f2610bb..81d5ff5a 100644 --- a/src/cwl_utils/tests/test_parser_utils.py +++ b/src/cwl_utils/tests/test_parser_utils.py @@ -8,6 +8,7 @@ from typing import cast import pytest +import schema_salad.metaschema from pytest import LogCaptureFixture, raises from schema_salad.exceptions import ValidationException @@ -20,7 +21,6 @@ import cwl_utils.parser.utils from cwl_utils.errors import WorkflowException from cwl_utils.parser import load_document_by_uri - from .util import get_path @@ -128,8 +128,6 @@ def test_static_checker_success(cwlVersion: str) -> None: "testdata/cond-wf-004.1.cwl", "testdata/cond-wf-005.1.cwl", "testdata/cond-single-source-wf-005.1.cwl", - "testdata/extensions/all-output-loop_v1_2.cwl", - "testdata/extensions/single-var-loop_v1_2.cwl", "testdata/wf2.cwl", ] ) @@ -341,9 +339,9 @@ def test_v1_0_type_output_source_record() -> None: process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_0.RecordSchema) + assert isinstance(source_type, schema_salad.metaschema.RecordSchema) fields = cast( - MutableSequence[cwl_utils.parser.cwl_v1_0.RecordField], source_type.fields + MutableSequence[schema_salad.metaschema.RecordField], source_type.fields ) assert len(fields) == 2 assert fields[0].type_ == "File" @@ -358,7 +356,7 @@ def test_v1_0_type_for_output_source_with_single_scatter_step() -> None: process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_0.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "string" @@ -370,8 +368,8 @@ def test_v1_0_type_for_output_source_with_nested_crossproduct_scatter_step() -> process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_0.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_0.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "string" @@ -382,7 +380,7 @@ def test_v1_0_type_for_output_source_with_flat_crossproduct_scatter_step() -> No source_type = cwl_utils.parser.utils.type_for_source( process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_0.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "string" @@ -395,8 +393,8 @@ def test_v1_0_type_for_source_with_multiple_entries_merge_nested() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_0.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_0.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "File" @@ -409,7 +407,7 @@ def test_v1_0_type_for_source_with_multiple_entries_merge_flattened() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_0.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "File" @@ -422,8 +420,8 @@ def test_v1_0_type_for_source_with_single_entry_merge_nested() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_0.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_0.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "File" @@ -436,7 +434,7 @@ def test_v1_0_type_for_source_with_single_entry_merge_flattened() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_0.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "File" @@ -694,9 +692,9 @@ def test_v1_1_type_output_source_record() -> None: process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_1.RecordSchema) + assert isinstance(source_type, schema_salad.metaschema.RecordSchema) fields = cast( - MutableSequence[cwl_utils.parser.cwl_v1_1.RecordField], source_type.fields + MutableSequence[schema_salad.metaschema.RecordField], source_type.fields ) assert len(fields) == 2 assert fields[0].type_ == "File" @@ -711,7 +709,7 @@ def test_v1_1_type_for_output_source_with_single_scatter_step() -> None: process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_1.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "string" @@ -723,8 +721,8 @@ def test_v1_1_type_for_output_source_with_nested_crossproduct_scatter_step() -> process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_1.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_1.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "string" @@ -736,7 +734,7 @@ def test_v1_1_type_for_output_source_with_flat_crossproduct_scatter_step() -> No process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_1.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "string" @@ -749,8 +747,8 @@ def test_v1_1_type_for_source_with_multiple_entries_merge_nested() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_1.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_1.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "File" @@ -763,7 +761,7 @@ def test_v1_1_type_for_source_with_multiple_entries_merge_flattened() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_1.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "File" @@ -776,8 +774,8 @@ def test_v1_1_type_for_source_with_single_entry_merge_nested() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_1.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_1.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "File" @@ -790,7 +788,7 @@ def test_v1_1_type_for_source_with_single_entry_merge_flattened() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_1.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "File" @@ -1048,9 +1046,9 @@ def test_v1_2_type_output_source_record() -> None: process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.RecordSchema) + assert isinstance(source_type, schema_salad.metaschema.RecordSchema) fields = cast( - MutableSequence[cwl_utils.parser.cwl_v1_2.RecordField], source_type.fields + MutableSequence[schema_salad.metaschema.RecordField], source_type.fields ) assert len(fields) == 2 assert fields[0].type_ == "File" @@ -1065,7 +1063,7 @@ def test_v1_2_type_for_output_source_with_single_scatter_step() -> None: process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "string" @@ -1077,8 +1075,8 @@ def test_v1_2_type_for_output_source_with_nested_crossproduct_scatter_step() -> process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "string" @@ -1090,7 +1088,7 @@ def test_v1_2_type_for_output_source_with_flat_crossproduct_scatter_step() -> No process=cwl_obj, sourcenames=cwl_obj.outputs[0].outputSource, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "string" @@ -1103,8 +1101,8 @@ def test_v1_2_type_for_source_with_multiple_entries_merge_nested() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "File" @@ -1117,7 +1115,7 @@ def test_v1_2_type_for_source_with_multiple_entries_merge_flattened() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "File" @@ -1130,8 +1128,8 @@ def test_v1_2_type_for_source_with_single_entry_merge_nested() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) - assert isinstance(source_type.items, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) + assert isinstance(source_type.items, schema_salad.metaschema.ArraySchema) assert source_type.items.items == "File" @@ -1144,7 +1142,7 @@ def test_v1_2_type_for_source_with_single_entry_merge_flattened() -> None: sourcenames=cwl_obj.steps[0].in_[0].source, linkMerge=cwl_obj.steps[0].in_[0].linkMerge, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "File" @@ -1181,7 +1179,7 @@ def test_v1_2_type_for_source_with_multiple_entries_all_non_null() -> None: sourcenames=cwl_obj.outputs[0].outputSource, pickValue=cwl_obj.outputs[0].pickValue, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "string" @@ -1218,5 +1216,5 @@ def test_v1_2_type_for_source_with_single_entry_all_non_null() -> None: sourcenames=cwl_obj.outputs[0].outputSource, pickValue=cwl_obj.outputs[0].pickValue, ) - assert isinstance(source_type, cwl_utils.parser.cwl_v1_2.ArraySchema) + assert isinstance(source_type, schema_salad.metaschema.ArraySchema) assert source_type.items == "string"