Skip to content

Commit

Permalink
remove pydantic serializable Coordinate
Browse files Browse the repository at this point in the history
Not needed
  • Loading branch information
pattonw committed Aug 25, 2024
1 parent 6070c61 commit 6ab3d07
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions funlib/persistence/arrays/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
from funlib.geometry import Coordinate


class PydanticCoordinate(Coordinate):
@classmethod
def __get_validators__(cls):
yield cls.validate

@classmethod
def validate(cls, v, val_info):
return Coordinate(*v)


class MetaDataFormat(BaseModel):
offset_attr: str = "offset"
voxel_size_attr: str = "voxel_size"
Expand Down Expand Up @@ -120,9 +110,9 @@ def parse(
class MetaData:
def __init__(
self,
shape: PydanticCoordinate,
offset: Optional[PydanticCoordinate] = None,
voxel_size: Optional[PydanticCoordinate] = None,
shape: Coordinate,
offset: Optional[Coordinate] = None,
voxel_size: Optional[Coordinate] = None,
axis_names: Optional[list[str]] = None,
units: Optional[list[str]] = None,
):
Expand All @@ -135,15 +125,15 @@ def __init__(
self.validate()

@property
def offset(self) -> PydanticCoordinate:
def offset(self) -> Coordinate:
return (
self._offset
if self._offset is not None
else Coordinate((0,) * self.physical_dims)
)

@property
def voxel_size(self) -> PydanticCoordinate:
def voxel_size(self) -> Coordinate:
return (
self._voxel_size
if self._voxel_size is not None
Expand Down

0 comments on commit 6ab3d07

Please sign in to comment.