From 434a4050b950e9894dabc976e9cb431158ba505c Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 10 Dec 2024 13:39:34 +0000 Subject: [PATCH] Use JsonValue for unknown types --- src/ome_zarr_models/v04/_bioformats2raw.py | 6 +++--- src/ome_zarr_models/v04/axes.py | 6 ++++-- src/ome_zarr_models/v04/multiscales.py | 12 ++++++------ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/ome_zarr_models/v04/_bioformats2raw.py b/src/ome_zarr_models/v04/_bioformats2raw.py index 6c9c0d8..db706cb 100644 --- a/src/ome_zarr_models/v04/_bioformats2raw.py +++ b/src/ome_zarr_models/v04/_bioformats2raw.py @@ -1,6 +1,6 @@ -from typing import Any, Literal +from typing import Literal -from pydantic import Field +from pydantic import Field, JsonValue from ome_zarr_models.base import Base from ome_zarr_models.v04.plate import Plate @@ -13,4 +13,4 @@ class BioFormats2RawAttrs(Base): bioformats2raw_layout: Literal[3] = Field(..., alias="bioformats2raw.layout") plate: Plate | None = None - series: Any | None = None + series: JsonValue | None = None diff --git a/src/ome_zarr_models/v04/axes.py b/src/ome_zarr_models/v04/axes.py index 738e0f5..2287413 100644 --- a/src/ome_zarr_models/v04/axes.py +++ b/src/ome_zarr_models/v04/axes.py @@ -1,5 +1,7 @@ from collections.abc import Sequence -from typing import Any, Literal +from typing import Literal + +from pydantic import JsonValue from ome_zarr_models.base import Base @@ -18,7 +20,7 @@ class Axis(Base): name: str type: str | None = None - unit: str | Any | None = None + unit: str | JsonValue | None = None Axes = Sequence[Axis] diff --git a/src/ome_zarr_models/v04/multiscales.py b/src/ome_zarr_models/v04/multiscales.py index d1c40a5..765168f 100644 --- a/src/ome_zarr_models/v04/multiscales.py +++ b/src/ome_zarr_models/v04/multiscales.py @@ -6,9 +6,9 @@ from collections import Counter from collections.abc import Sequence -from typing import Annotated, Any, Self, get_args +from typing import Annotated, Literal, Self, get_args -from pydantic import AfterValidator, Field, model_validator +from pydantic import AfterValidator, Field, JsonValue, model_validator from ome_zarr_models._utils import duplicates from ome_zarr_models.base import Base @@ -203,11 +203,11 @@ class Multiscale(Base): AfterValidator(_ensure_axis_types), ] datasets: Datasets = Field(..., min_length=1) - version: Any | None = None + version: Literal["0.4"] | None = None coordinateTransformations: ValidTransform | None = None - metadata: Any = None - name: Any | None = None - type: Any = None + metadata: JsonValue = None + name: JsonValue | None = None + type: JsonValue = None @property def ndim(self) -> int: