Skip to content

Commit 3d2fe43

Browse files
Regenerate parsers with native ints
1 parent 1ed986c commit 3d2fe43

File tree

6 files changed

+203
-197
lines changed

6 files changed

+203
-197
lines changed

cwl_utils/parser/cwl_v1_0.py

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from collections.abc import Collection # pylint: disable=unused-import # noqa: F401
1919
from io import StringIO
2020
from itertools import chain
21-
from mypy_extensions import trait
21+
from mypy_extensions import i32, i64, trait
2222
from typing import Any, Final, Generic, TypeAlias, TypeVar, cast
2323
from typing import ClassVar, Literal, Mapping # pylint: disable=unused-import # noqa: F401
2424
from urllib.parse import quote, urldefrag, urlparse, urlsplit, urlunsplit
@@ -265,7 +265,7 @@ def load_field(
265265

266266

267267
save_type: TypeAlias = (
268-
None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str
268+
None | MutableMapping[str, Any] | MutableSequence[Any] | i32 | i64 | float | bool | str
269269
)
270270

271271

@@ -343,7 +343,7 @@ def save(
343343
for key in val:
344344
newdict[key] = save(val[key], top=False, base_url=base_url, relative_uris=relative_uris)
345345
return newdict
346-
if val is None or isinstance(val, (int, float, bool, str)):
346+
if val is None or isinstance(val, (i32, i64, float, bool, str)):
347347
return val
348348
raise Exception("Not Saveable: %s" % type(val))
349349

@@ -3974,7 +3974,7 @@ def __init__(
39743974
nameroot: None | str = None,
39753975
nameext: None | str = None,
39763976
checksum: None | str = None,
3977-
size: None | int = None,
3977+
size: None | i32 = None,
39783978
secondaryFiles: None | Sequence[Directory | File] = None,
39793979
format: None | str = None,
39803980
contents: None | str = None,
@@ -3989,7 +3989,7 @@ def __init__(
39893989
self.loadingOptions = loadingOptions
39903990
else:
39913991
self.loadingOptions = LoadingOptions()
3992-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#File"
3992+
self.class_: Final[str] = "File"
39933993
self.location = location
39943994
self.path = path
39953995
self.basename = basename
@@ -4395,7 +4395,7 @@ def __init__(
43954395
self.loadingOptions = loadingOptions
43964396
else:
43974397
self.loadingOptions = LoadingOptions()
4398-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#Directory"
4398+
self.class_: Final[str] = "Directory"
43994399
self.location = location
44004400
self.path = path
44014401
self.basename = basename
@@ -8484,7 +8484,7 @@ def __init__(
84848484
self.loadingOptions = loadingOptions
84858485
else:
84868486
self.loadingOptions = LoadingOptions()
8487-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#InlineJavascriptRequirement"
8487+
self.class_: Final[str] = "InlineJavascriptRequirement"
84888488
self.expressionLib = expressionLib
84898489

84908490
attrs: ClassVar[Collection[str]] = frozenset(["class", "expressionLib"])
@@ -8665,7 +8665,7 @@ def __init__(
86658665
self.loadingOptions = loadingOptions
86668666
else:
86678667
self.loadingOptions = LoadingOptions()
8668-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#SchemaDefRequirement"
8668+
self.class_: Final[str] = "SchemaDefRequirement"
86698669
self.types = types
86708670

86718671
attrs: ClassVar[Collection[str]] = frozenset(["class", "types"])
@@ -9389,7 +9389,7 @@ def save(
93899389
def __init__(
93909390
self,
93919391
loadContents: None | bool = None,
9392-
position: None | int = None,
9392+
position: None | i32 = None,
93939393
prefix: None | str = None,
93949394
separate: None | bool = None,
93959395
itemSeparator: None | str = None,
@@ -14687,9 +14687,9 @@ def __init__(
1468714687
stdin: None | str = None,
1468814688
stderr: None | str = None,
1468914689
stdout: None | str = None,
14690-
successCodes: None | Sequence[int] = None,
14691-
temporaryFailCodes: None | Sequence[int] = None,
14692-
permanentFailCodes: None | Sequence[int] = None,
14690+
successCodes: None | Sequence[i32] = None,
14691+
temporaryFailCodes: None | Sequence[i32] = None,
14692+
permanentFailCodes: None | Sequence[i32] = None,
1469314693
extension_fields: MutableMapping[str, Any] | None = None,
1469414694
loadingOptions: LoadingOptions | None = None,
1469514695
) -> None:
@@ -14709,7 +14709,7 @@ def __init__(
1470914709
self.label = label
1471014710
self.doc = doc
1471114711
self.cwlVersion = cwlVersion
14712-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#CommandLineTool"
14712+
self.class_: Final[str] = "CommandLineTool"
1471314713
self.baseCommand = baseCommand
1471414714
self.arguments = arguments
1471514715
self.stdin = stdin
@@ -15243,7 +15243,7 @@ def __init__(
1524315243
self.loadingOptions = loadingOptions
1524415244
else:
1524515245
self.loadingOptions = LoadingOptions()
15246-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#DockerRequirement"
15246+
self.class_: Final[str] = "DockerRequirement"
1524715247
self.dockerPull = dockerPull
1524815248
self.dockerLoad = dockerLoad
1524915249
self.dockerFile = dockerFile
@@ -15434,7 +15434,7 @@ def __init__(
1543415434
self.loadingOptions = loadingOptions
1543515435
else:
1543615436
self.loadingOptions = LoadingOptions()
15437-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#SoftwareRequirement"
15437+
self.class_: Final[str] = "SoftwareRequirement"
1543815438
self.packages = packages
1543915439

1544015440
attrs: ClassVar[Collection[str]] = frozenset(["class", "packages"])
@@ -16132,7 +16132,7 @@ def __init__(
1613216132
self.loadingOptions = loadingOptions
1613316133
else:
1613416134
self.loadingOptions = LoadingOptions()
16135-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#InitialWorkDirRequirement"
16135+
self.class_: Final[str] = "InitialWorkDirRequirement"
1613616136
self.listing = listing
1613716137

1613816138
attrs: ClassVar[Collection[str]] = frozenset(["class", "listing"])
@@ -16308,7 +16308,7 @@ def __init__(
1630816308
self.loadingOptions = loadingOptions
1630916309
else:
1631016310
self.loadingOptions = LoadingOptions()
16311-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#EnvVarRequirement"
16311+
self.class_: Final[str] = "EnvVarRequirement"
1631216312
self.envDef = envDef
1631316313

1631416314
attrs: ClassVar[Collection[str]] = frozenset(["class", "envDef"])
@@ -16433,7 +16433,7 @@ def __init__(
1643316433
self.loadingOptions = loadingOptions
1643416434
else:
1643516435
self.loadingOptions = LoadingOptions()
16436-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#ShellCommandRequirement"
16436+
self.class_: Final[str] = "ShellCommandRequirement"
1643716437

1643816438
attrs: ClassVar[Collection[str]] = frozenset(["class"])
1643916439

@@ -17011,14 +17011,14 @@ def save(
1701117011

1701217012
def __init__(
1701317013
self,
17014-
coresMin: None | int | str = None,
17015-
coresMax: None | int | str = None,
17016-
ramMin: None | int | str = None,
17017-
ramMax: None | int | str = None,
17018-
tmpdirMin: None | int | str = None,
17019-
tmpdirMax: None | int | str = None,
17020-
outdirMin: None | int | str = None,
17021-
outdirMax: None | int | str = None,
17014+
coresMin: None | i32 | str = None,
17015+
coresMax: None | i32 | str = None,
17016+
ramMin: None | i32 | str = None,
17017+
ramMax: None | i32 | str = None,
17018+
tmpdirMin: None | i32 | str = None,
17019+
tmpdirMax: None | i32 | str = None,
17020+
outdirMin: None | i32 | str = None,
17021+
outdirMax: None | i32 | str = None,
1702217022
extension_fields: MutableMapping[str, Any] | None = None,
1702317023
loadingOptions: LoadingOptions | None = None,
1702417024
) -> None:
@@ -17030,7 +17030,7 @@ def __init__(
1703017030
self.loadingOptions = loadingOptions
1703117031
else:
1703217032
self.loadingOptions = LoadingOptions()
17033-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#ResourceRequirement"
17033+
self.class_: Final[str] = "ResourceRequirement"
1703417034
self.coresMin = coresMin
1703517035
self.coresMax = coresMax
1703617036
self.ramMin = ramMin
@@ -18270,7 +18270,7 @@ def __init__(
1827018270
self.label = label
1827118271
self.doc = doc
1827218272
self.cwlVersion = cwlVersion
18273-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#ExpressionTool"
18273+
self.class_: Final[str] = "ExpressionTool"
1827418274
self.expression = expression
1827518275

1827618276
attrs: ClassVar[Collection[str]] = frozenset(
@@ -20995,7 +20995,7 @@ def __init__(
2099520995
self.label = label
2099620996
self.doc = doc
2099720997
self.cwlVersion = cwlVersion
20998-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#Workflow"
20998+
self.class_: Final[str] = "Workflow"
2099920999
self.steps = steps
2100021000

2100121001
attrs: ClassVar[Collection[str]] = frozenset(
@@ -21128,7 +21128,7 @@ def __init__(
2112821128
self.loadingOptions = loadingOptions
2112921129
else:
2113021130
self.loadingOptions = LoadingOptions()
21131-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#SubworkflowFeatureRequirement"
21131+
self.class_: Final[str] = "SubworkflowFeatureRequirement"
2113221132

2113321133
attrs: ClassVar[Collection[str]] = frozenset(["class"])
2113421134

@@ -21247,7 +21247,7 @@ def __init__(
2124721247
self.loadingOptions = loadingOptions
2124821248
else:
2124921249
self.loadingOptions = LoadingOptions()
21250-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#ScatterFeatureRequirement"
21250+
self.class_: Final[str] = "ScatterFeatureRequirement"
2125121251

2125221252
attrs: ClassVar[Collection[str]] = frozenset(["class"])
2125321253

@@ -21366,7 +21366,7 @@ def __init__(
2136621366
self.loadingOptions = loadingOptions
2136721367
else:
2136821368
self.loadingOptions = LoadingOptions()
21369-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#MultipleInputFeatureRequirement"
21369+
self.class_: Final[str] = "MultipleInputFeatureRequirement"
2137021370

2137121371
attrs: ClassVar[Collection[str]] = frozenset(["class"])
2137221372

@@ -21485,7 +21485,7 @@ def __init__(
2148521485
self.loadingOptions = loadingOptions
2148621486
else:
2148721487
self.loadingOptions = LoadingOptions()
21488-
self.class_: Final[str] = "https://w3id.org/cwl/cwl#StepInputExpressionRequirement"
21488+
self.class_: Final[str] = "StepInputExpressionRequirement"
2148921489

2149021490
attrs: ClassVar[Collection[str]] = frozenset(["class"])
2149121491

@@ -21659,7 +21659,7 @@ def __init__(
2165921659
self.loadingOptions = loadingOptions
2166021660
else:
2166121661
self.loadingOptions = LoadingOptions()
21662-
self.class_: Final[str] = "http://commonwl.org/cwltool#LoadListingRequirement"
21662+
self.class_: Final[str] = "LoadListingRequirement"
2166321663
self.loadListing = loadListing
2166421664

2166521665
attrs: ClassVar[Collection[str]] = frozenset(["class", "loadListing"])
@@ -21835,7 +21835,7 @@ def __init__(
2183521835
self.loadingOptions = loadingOptions
2183621836
else:
2183721837
self.loadingOptions = LoadingOptions()
21838-
self.class_: Final[str] = "http://commonwl.org/cwltool#InplaceUpdateRequirement"
21838+
self.class_: Final[str] = "InplaceUpdateRequirement"
2183921839
self.inplaceUpdate = inplaceUpdate
2184021840

2184121841
attrs: ClassVar[Collection[str]] = frozenset(["class", "inplaceUpdate"])
@@ -22004,7 +22004,7 @@ def __init__(
2200422004
self.loadingOptions = loadingOptions
2200522005
else:
2200622006
self.loadingOptions = LoadingOptions()
22007-
self.class_: Final[str] = "http://commonwl.org/cwltool#Secrets"
22007+
self.class_: Final[str] = "Secrets"
2200822008
self.secrets = secrets
2200922009

2201022010
attrs: ClassVar[Collection[str]] = frozenset(["class", "secrets"])
@@ -22175,7 +22175,7 @@ def save(
2217522175

2217622176
def __init__(
2217722177
self,
22178-
timelimit: int | str,
22178+
timelimit: i32 | str,
2217922179
extension_fields: MutableMapping[str, Any] | None = None,
2218022180
loadingOptions: LoadingOptions | None = None,
2218122181
) -> None:
@@ -22187,7 +22187,7 @@ def __init__(
2218722187
self.loadingOptions = loadingOptions
2218822188
else:
2218922189
self.loadingOptions = LoadingOptions()
22190-
self.class_: Final[str] = "http://commonwl.org/cwltool#TimeLimit"
22190+
self.class_: Final[str] = "TimeLimit"
2219122191
self.timelimit = timelimit
2219222192

2219322193
attrs: ClassVar[Collection[str]] = frozenset(["class", "timelimit"])
@@ -22375,7 +22375,7 @@ def __init__(
2237522375
self.loadingOptions = loadingOptions
2237622376
else:
2237722377
self.loadingOptions = LoadingOptions()
22378-
self.class_: Final[str] = "http://commonwl.org/cwltool#WorkReuse"
22378+
self.class_: Final[str] = "WorkReuse"
2237922379
self.enableReuse = enableReuse
2238022380

2238122381
attrs: ClassVar[Collection[str]] = frozenset(["class", "enableReuse"])
@@ -22570,7 +22570,7 @@ def __init__(
2257022570
self.loadingOptions = loadingOptions
2257122571
else:
2257222572
self.loadingOptions = LoadingOptions()
22573-
self.class_: Final[str] = "http://commonwl.org/cwltool#NetworkAccess"
22573+
self.class_: Final[str] = "NetworkAccess"
2257422574
self.networkAccess = networkAccess
2257522575

2257622576
attrs: ClassVar[Collection[str]] = frozenset(["class", "networkAccess"])
@@ -23210,7 +23210,7 @@ def __init__(
2321023210
self.label = label
2321123211
self.doc = doc
2321223212
self.cwlVersion = cwlVersion
23213-
self.class_: Final[str] = "http://commonwl.org/cwltool#ProcessGenerator"
23213+
self.class_: Final[str] = "ProcessGenerator"
2321423214
self.run = run
2321523215

2321623216
attrs: ClassVar[Collection[str]] = frozenset(
@@ -23391,7 +23391,7 @@ def save(
2339123391

2339223392
def __init__(
2339323393
self,
23394-
processes: int | str,
23394+
processes: i32 | str,
2339523395
extension_fields: MutableMapping[str, Any] | None = None,
2339623396
loadingOptions: LoadingOptions | None = None,
2339723397
) -> None:
@@ -23403,7 +23403,7 @@ def __init__(
2340323403
self.loadingOptions = loadingOptions
2340423404
else:
2340523405
self.loadingOptions = LoadingOptions()
23406-
self.class_: Final[str] = "http://commonwl.org/cwltool#MPIRequirement"
23406+
self.class_: Final[str] = "MPIRequirement"
2340723407
self.processes = processes
2340823408

2340923409
attrs: ClassVar[Collection[str]] = frozenset(["class", "processes"])
@@ -23751,8 +23751,8 @@ def __init__(
2375123751
self,
2375223752
cudaComputeCapability: Sequence[str] | str,
2375323753
cudaVersionMin: str,
23754-
cudaDeviceCountMax: None | int | str = None,
23755-
cudaDeviceCountMin: None | int | str = None,
23754+
cudaDeviceCountMax: None | i32 | str = None,
23755+
cudaDeviceCountMin: None | i32 | str = None,
2375623756
extension_fields: MutableMapping[str, Any] | None = None,
2375723757
loadingOptions: LoadingOptions | None = None,
2375823758
) -> None:
@@ -23764,7 +23764,7 @@ def __init__(
2376423764
self.loadingOptions = loadingOptions
2376523765
else:
2376623766
self.loadingOptions = LoadingOptions()
23767-
self.class_: Final[str] = "http://commonwl.org/cwltool#CUDARequirement"
23767+
self.class_: Final[str] = "CUDARequirement"
2376823768
self.cudaComputeCapability = cudaComputeCapability
2376923769
self.cudaDeviceCountMax = cudaDeviceCountMax
2377023770
self.cudaDeviceCountMin = cudaDeviceCountMin
@@ -23945,7 +23945,7 @@ def __init__(
2394523945
self.loadingOptions = loadingOptions
2394623946
else:
2394723947
self.loadingOptions = LoadingOptions()
23948-
self.class_: Final[str] = "http://commonwl.org/cwltool#ShmSize"
23948+
self.class_: Final[str] = "ShmSize"
2394923949
self.shmSize = shmSize
2395023950

2395123951
attrs: ClassVar[Collection[str]] = frozenset(["class", "shmSize"])
@@ -24197,11 +24197,12 @@ def __init__(
2419724197
})
2419824198

2419924199
strtype: Final = _PrimitiveLoader(str)
24200-
inttype: Final = _PrimitiveLoader(int)
24200+
inttype: Final = _PrimitiveLoader(i32)
2420124201
floattype: Final = _PrimitiveLoader(float)
2420224202
booltype: Final = _PrimitiveLoader(bool)
2420324203
None_type: Final = _PrimitiveLoader(type(None))
2420424204
Any_type: Final = _AnyLoader()
24205+
longtype: Final = _PrimitiveLoader(i64)
2420524206
PrimitiveTypeLoader: Final = _EnumLoader(
2420624207
(
2420724208
"null",
@@ -25549,6 +25550,7 @@ def __init__(
2554925550
(
2555025551
booltype,
2555125552
inttype,
25553+
longtype,
2555225554
floattype,
2555325555
strtype,
2555425556
FileLoader,
@@ -25558,7 +25560,7 @@ def __init__(
2555825560
)
2555925561
)
2556025562
CWLObjectType: TypeAlias = (
25561-
"Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | int | str"
25563+
"Directory | File | Mapping[str, CWLObjectType | None] | Sequence[CWLObjectType | None] | bool | float | i32 | i64 | str"
2556225564
)
2556325565

2556425566

0 commit comments

Comments
 (0)