88import sys
99import uuid as _uuid__
1010from collections.abc import Collection
11- from mypy_extensions import trait
1211from typing import ClassVar
1312
1413from schema_salad.runtime import (
14+ Saveable,
1515 file_uri,
1616 parse_errors,
1717 prefix_url,
2323 from typing import Self
2424else:
2525 from typing_extensions import Self
26+
2627import schema_salad.metaschema
2728
2829import copy
29-
3030from collections.abc import MutableSequence, Sequence, MutableMapping
3131from io import StringIO
3232from itertools import chain
33- from typing import Any, Final, cast, Generic, TypeVar
33+ from typing import Any, Final, cast, Generic
3434from urllib.parse import urldefrag, urlsplit, urlunsplit
3535
3636from ruamel.yaml.comments import CommentedMap
3737
3838from schema_salad.exceptions import ValidationException, SchemaSaladException
39- from schema_salad.runtime import LoadingOptions, convert_typing, extract_type, Saveable
39+ from schema_salad.runtime import (
40+ LoadingOptions,
41+ convert_typing,
42+ extract_type,
43+ SaveableType,
44+ )
4045from schema_salad.sourceline import SourceLine, add_lc_filename
41- from schema_salad.utils import yaml_no_ts
42-
43- S = TypeVar("S", bound=Saveable)
44-
46+ from schema_salad.utils import yaml_no_ts # requires schema-salad v8.2+
4547
4648_vocab: Final[dict[str, str]] = {}
4749_rvocab: Final[dict[str, str]] = {}
@@ -287,10 +289,10 @@ def load(
287289 return self.inner.load(r, baseuri, loadingOptions, docRoot, lc=lc)
288290
289291
290- class _RecordLoader(_Loader, Generic[S ]):
292+ class _RecordLoader(_Loader, Generic[SaveableType ]):
291293 def __init__(
292294 self,
293- classtype: type[S ],
295+ classtype: type[SaveableType ],
294296 container: str | None = None,
295297 no_link_check: bool | None = None,
296298 ) -> None:
@@ -305,7 +307,7 @@ def load(
305307 loadingOptions: LoadingOptions,
306308 docRoot: str | None = None,
307309 lc: Any | None = None,
308- ) -> S :
310+ ) -> SaveableType :
309311 if not isinstance(doc, MutableMapping):
310312 raise ValidationException(
311313 f"Value is a {convert_typing(extract_type(type(doc)))}, "
@@ -1633,9 +1635,9 @@ def fromDoc(
16331635
16341636 vocab = _vocab | loadingOptions.vocab
16351637 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
1636- raise ValidationException(f"tried `{cls.__name__}` but")
1638+ raise ValidationException(f"tried `{cls.__name__}` but")
16371639 except ValidationException as e:
1638- raise e
1640+ raise e
16391641 location = None
16401642 if "location" in _doc:
16411643 try:
@@ -2377,9 +2379,9 @@ def fromDoc(
23772379
23782380 vocab = _vocab | loadingOptions.vocab
23792381 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
2380- raise ValidationException(f"tried `{cls.__name__}` but")
2382+ raise ValidationException(f"tried `{cls.__name__}` but")
23812383 except ValidationException as e:
2382- raise e
2384+ raise e
23832385 location = None
23842386 if "location" in _doc:
23852387 try:
@@ -2651,12 +2653,10 @@ def save(
26512653 )
26522654
26532655
2654- @trait
26552656class SchemaBase(Saveable):
26562657 pass
26572658
26582659
2659- @trait
26602660class Parameter(SchemaBase):
26612661 """
26622662 Define an input or output parameter to a process.
@@ -2666,22 +2666,18 @@ class Parameter(SchemaBase):
26662666 pass
26672667
26682668
2669- @trait
26702669class InputBinding(Saveable):
26712670 pass
26722671
26732672
2674- @trait
26752673class OutputBinding(Saveable):
26762674 pass
26772675
26782676
2679- @trait
26802677class InputSchema(SchemaBase):
26812678 pass
26822679
26832680
2684- @trait
26852681class OutputSchema(SchemaBase):
26862682 pass
26872683
@@ -6525,7 +6521,6 @@ def save(
65256521 )
65266522
65276523
6528- @trait
65296524class ProcessRequirement(Saveable):
65306525 """
65316526 A process requirement declares a prerequisite that may or must be fulfilled before executing a process. See ```Process.hints`` <#process>`__ and ```Process.requirements`` <#process>`__.
@@ -6537,7 +6532,6 @@ class ProcessRequirement(Saveable):
65376532 pass
65386533
65396534
6540- @trait
65416535class Process(Saveable):
65426536 """
65436537 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.
@@ -6609,9 +6603,9 @@ def fromDoc(
66096603
66106604 vocab = _vocab | loadingOptions.vocab
66116605 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
6612- raise ValidationException(f"tried `{cls.__name__}` but")
6606+ raise ValidationException(f"tried `{cls.__name__}` but")
66136607 except ValidationException as e:
6614- raise e
6608+ raise e
66156609 expressionLib = None
66166610 if "expressionLib" in _doc:
66176611 try:
@@ -6789,9 +6783,9 @@ def fromDoc(
67896783
67906784 vocab = _vocab | loadingOptions.vocab
67916785 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
6792- raise ValidationException(f"tried `{cls.__name__}` but")
6786+ raise ValidationException(f"tried `{cls.__name__}` but")
67936787 except ValidationException as e:
6794- raise e
6788+ raise e
67956789 try:
67966790 if _doc.get("types") is None:
67976791 raise ValidationException("missing required field `types`", None, [])
@@ -12077,9 +12071,9 @@ def fromDoc(
1207712071
1207812072 vocab = _vocab | loadingOptions.vocab
1207912073 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
12080- raise ValidationException(f"tried `{cls.__name__}` but")
12074+ raise ValidationException(f"tried `{cls.__name__}` but")
1208112075 except ValidationException as e:
12082- raise e
12076+ raise e
1208312077 try:
1208412078 if _doc.get("inputs") is None:
1208512079 raise ValidationException("missing required field `inputs`", None, [])
@@ -13066,9 +13060,9 @@ def fromDoc(
1306613060
1306713061 vocab = _vocab | loadingOptions.vocab
1306813062 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
13069- raise ValidationException(f"tried `{cls.__name__}` but")
13063+ raise ValidationException(f"tried `{cls.__name__}` but")
1307013064 except ValidationException as e:
13071- raise e
13065+ raise e
1307213066 dockerPull = None
1307313067 if "dockerPull" in _doc:
1307413068 try:
@@ -13531,9 +13525,9 @@ def fromDoc(
1353113525
1353213526 vocab = _vocab | loadingOptions.vocab
1353313527 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
13534- raise ValidationException(f"tried `{cls.__name__}` but")
13528+ raise ValidationException(f"tried `{cls.__name__}` but")
1353513529 except ValidationException as e:
13536- raise e
13530+ raise e
1353713531 try:
1353813532 if _doc.get("packages") is None:
1353913533 raise ValidationException("missing required field `packages`", None, [])
@@ -14230,9 +14224,9 @@ def fromDoc(
1423014224
1423114225 vocab = _vocab | loadingOptions.vocab
1423214226 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
14233- raise ValidationException(f"tried `{cls.__name__}` but")
14227+ raise ValidationException(f"tried `{cls.__name__}` but")
1423414228 except ValidationException as e:
14235- raise e
14229+ raise e
1423614230 try:
1423714231 if _doc.get("listing") is None:
1423814232 raise ValidationException("missing required field `listing`", None, [])
@@ -14408,9 +14402,9 @@ def fromDoc(
1440814402
1440914403 vocab = _vocab | loadingOptions.vocab
1441014404 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
14411- raise ValidationException(f"tried `{cls.__name__}` but")
14405+ raise ValidationException(f"tried `{cls.__name__}` but")
1441214406 except ValidationException as e:
14413- raise e
14407+ raise e
1441414408 try:
1441514409 if _doc.get("envDef") is None:
1441614410 raise ValidationException("missing required field `envDef`", None, [])
@@ -14584,9 +14578,9 @@ def fromDoc(
1458414578
1458514579 vocab = _vocab | loadingOptions.vocab
1458614580 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
14587- raise ValidationException(f"tried `{cls.__name__}` but")
14581+ raise ValidationException(f"tried `{cls.__name__}` but")
1458814582 except ValidationException as e:
14589- raise e
14583+ raise e
1459014584 extension_fields: MutableMapping[str, Any] = {}
1459114585 for k in _doc.keys():
1459214586 if k not in cls.attrs:
@@ -14755,9 +14749,9 @@ def fromDoc(
1475514749
1475614750 vocab = _vocab | loadingOptions.vocab
1475714751 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
14758- raise ValidationException(f"tried `{cls.__name__}` but")
14752+ raise ValidationException(f"tried `{cls.__name__}` but")
1475914753 except ValidationException as e:
14760- raise e
14754+ raise e
1476114755 coresMin = None
1476214756 if "coresMin" in _doc:
1476314757 try:
@@ -15990,9 +15984,9 @@ def fromDoc(
1599015984
1599115985 vocab = _vocab | loadingOptions.vocab
1599215986 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
15993- raise ValidationException(f"tried `{cls.__name__}` but")
15987+ raise ValidationException(f"tried `{cls.__name__}` but")
1599415988 except ValidationException as e:
15995- raise e
15989+ raise e
1599615990 try:
1599715991 if _doc.get("inputs") is None:
1599815992 raise ValidationException("missing required field `inputs`", None, [])
@@ -17188,7 +17182,6 @@ def save(
1718817182 )
1718917183
1719017184
17191- @trait
1719217185class Sink(Saveable):
1719317186 pass
1719417187
@@ -18651,9 +18644,9 @@ def fromDoc(
1865118644
1865218645 vocab = _vocab | loadingOptions.vocab
1865318646 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
18654- raise ValidationException(f"tried `{cls.__name__}` but")
18647+ raise ValidationException(f"tried `{cls.__name__}` but")
1865518648 except ValidationException as e:
18656- raise e
18649+ raise e
1865718650 try:
1865818651 if _doc.get("inputs") is None:
1865918652 raise ValidationException("missing required field `inputs`", None, [])
@@ -19213,9 +19206,9 @@ def fromDoc(
1921319206
1921419207 vocab = _vocab | loadingOptions.vocab
1921519208 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
19216- raise ValidationException(f"tried `{cls.__name__}` but")
19209+ raise ValidationException(f"tried `{cls.__name__}` but")
1921719210 except ValidationException as e:
19218- raise e
19211+ raise e
1921919212 extension_fields: MutableMapping[str, Any] = {}
1922019213 for k in _doc.keys():
1922119214 if k not in cls.attrs:
@@ -19334,9 +19327,9 @@ def fromDoc(
1933419327
1933519328 vocab = _vocab | loadingOptions.vocab
1933619329 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
19337- raise ValidationException(f"tried `{cls.__name__}` but")
19330+ raise ValidationException(f"tried `{cls.__name__}` but")
1933819331 except ValidationException as e:
19339- raise e
19332+ raise e
1934019333 extension_fields: MutableMapping[str, Any] = {}
1934119334 for k in _doc.keys():
1934219335 if k not in cls.attrs:
@@ -19455,9 +19448,9 @@ def fromDoc(
1945519448
1945619449 vocab = _vocab | loadingOptions.vocab
1945719450 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
19458- raise ValidationException(f"tried `{cls.__name__}` but")
19451+ raise ValidationException(f"tried `{cls.__name__}` but")
1945919452 except ValidationException as e:
19460- raise e
19453+ raise e
1946119454 extension_fields: MutableMapping[str, Any] = {}
1946219455 for k in _doc.keys():
1946319456 if k not in cls.attrs:
@@ -19576,9 +19569,9 @@ def fromDoc(
1957619569
1957719570 vocab = _vocab | loadingOptions.vocab
1957819571 if class_ not in (cls.__name__, vocab.get(cls.__name__)):
19579- raise ValidationException(f"tried `{cls.__name__}` but")
19572+ raise ValidationException(f"tried `{cls.__name__}` but")
1958019573 except ValidationException as e:
19581- raise e
19574+ raise e
1958219575 extension_fields: MutableMapping[str, Any] = {}
1958319576 for k in _doc.keys():
1958419577 if k not in cls.attrs:
0 commit comments