Skip to content

Commit fa3ea6d

Browse files
jmchiltonclaude
andcommitted
Regenerate pydantic models with schema-salad-plus-pydantic 0.1.3
Fixes mypy errors in discriminator functions and load_document code. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5369588 commit fa3ea6d

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Optional dependencies
22
schema-salad[pycodegen]
3-
schema-salad-plus-pydantic
3+
schema-salad-plus-pydantic>=0.1.3
44
# Needs to validate v1.2
55
cwltool>=3.0.20200807132242
66

gxformat2/schema/gxformat2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,6 @@ def load_document(path: str | Path) -> GalaxyWorkflow | list[GalaxyWorkflow]:
370370
return _load_single(data)
371371

372372

373-
def _load_single(data: dict[str, Any]) -> GalaxyWorkflow | list[GalaxyWorkflow]:
373+
def _load_single(data: dict[str, Any]) -> GalaxyWorkflow:
374374
"""Load a single document dict."""
375375
return GalaxyWorkflow.model_validate(data)

gxformat2/schema/gxformat2_strict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,6 @@ def load_document(path: str | Path) -> GalaxyWorkflow | list[GalaxyWorkflow]:
370370
return _load_single(data)
371371

372372

373-
def _load_single(data: dict[str, Any]) -> GalaxyWorkflow | list[GalaxyWorkflow]:
373+
def _load_single(data: dict[str, Any]) -> GalaxyWorkflow:
374374
"""Load a single document dict."""
375375
return GalaxyWorkflow.model_validate(data)

gxformat2/schema/native.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,20 @@ class NativeStepType(str, Enum):
5555

5656

5757
def _discriminate_creator(v: Any) -> str:
58-
disc_map = {"Person": "NativeCreatorPerson", "Organization": "NativeCreatorOrganization"}
58+
disc_map: dict[str, str] = {"Person": "NativeCreatorPerson", "Organization": "NativeCreatorOrganization"}
5959
if isinstance(v, dict):
60-
disc_val = v.get("class")
60+
disc_val: str = str(v.get("class", ""))
6161
else:
62-
disc_val = getattr(v, "class", None)
62+
disc_val = str(getattr(v, "class", ""))
6363
return disc_map.get(disc_val, disc_val)
6464

6565

6666
def _discriminate_comments(v: Any) -> str:
67-
disc_map = {"text": "NativeTextComment", "markdown": "NativeMarkdownComment", "frame": "NativeFrameComment", "freehand": "NativeFreehandComment"}
67+
disc_map: dict[str, str] = {"text": "NativeTextComment", "markdown": "NativeMarkdownComment", "frame": "NativeFrameComment", "freehand": "NativeFreehandComment"}
6868
if isinstance(v, dict):
69-
disc_val = v.get("type")
69+
disc_val: str = str(v.get("type", ""))
7070
else:
71-
disc_val = getattr(v, "type", None)
71+
disc_val = str(getattr(v, "type", ""))
7272
return disc_map.get(disc_val, disc_val)
7373

7474

@@ -452,6 +452,6 @@ def load_document(path: str | Path) -> NativeGalaxyWorkflow | list[NativeGalaxyW
452452
return _load_single(data)
453453

454454

455-
def _load_single(data: dict[str, Any]) -> NativeGalaxyWorkflow | list[NativeGalaxyWorkflow]:
455+
def _load_single(data: dict[str, Any]) -> NativeGalaxyWorkflow:
456456
"""Load a single document dict."""
457457
return NativeGalaxyWorkflow.model_validate(data)

gxformat2/schema/native_strict.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,20 @@ class NativeStepType(str, Enum):
5555

5656

5757
def _discriminate_creator(v: Any) -> str:
58-
disc_map = {"Person": "NativeCreatorPerson", "Organization": "NativeCreatorOrganization"}
58+
disc_map: dict[str, str] = {"Person": "NativeCreatorPerson", "Organization": "NativeCreatorOrganization"}
5959
if isinstance(v, dict):
60-
disc_val = v.get("class")
60+
disc_val: str = str(v.get("class", ""))
6161
else:
62-
disc_val = getattr(v, "class", None)
62+
disc_val = str(getattr(v, "class", ""))
6363
return disc_map.get(disc_val, disc_val)
6464

6565

6666
def _discriminate_comments(v: Any) -> str:
67-
disc_map = {"text": "NativeTextComment", "markdown": "NativeMarkdownComment", "frame": "NativeFrameComment", "freehand": "NativeFreehandComment"}
67+
disc_map: dict[str, str] = {"text": "NativeTextComment", "markdown": "NativeMarkdownComment", "frame": "NativeFrameComment", "freehand": "NativeFreehandComment"}
6868
if isinstance(v, dict):
69-
disc_val = v.get("type")
69+
disc_val: str = str(v.get("type", ""))
7070
else:
71-
disc_val = getattr(v, "type", None)
71+
disc_val = str(getattr(v, "type", ""))
7272
return disc_map.get(disc_val, disc_val)
7373

7474

@@ -452,6 +452,6 @@ def load_document(path: str | Path) -> NativeGalaxyWorkflow | list[NativeGalaxyW
452452
return _load_single(data)
453453

454454

455-
def _load_single(data: dict[str, Any]) -> NativeGalaxyWorkflow | list[NativeGalaxyWorkflow]:
455+
def _load_single(data: dict[str, Any]) -> NativeGalaxyWorkflow:
456456
"""Load a single document dict."""
457457
return NativeGalaxyWorkflow.model_validate(data)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test = [
6464
]
6565
dev = [
6666
"schema-salad[pycodegen]",
67-
"schema-salad-plus-pydantic",
67+
"schema-salad-plus-pydantic>=0.1.3",
6868
"cwltool>=3.0.20200807132242",
6969
]
7070

0 commit comments

Comments
 (0)