Skip to content

Commit

Permalink
fix type issues produced by new version of pydantic (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon authored Nov 26, 2024
1 parent 4b6adee commit 3671039
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/datachain/lib/dataset_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class DatasetInfo(DataModel):
finished_at: Optional[datetime] = Field(default=None)
num_objects: Optional[int] = Field(default=None)
size: Optional[int] = Field(default=None)
params: dict[str, str] = Field(default=dict)
metrics: dict[str, Any] = Field(default=dict)
params: dict[str, str] = Field(default={})
metrics: dict[str, Any] = Field(default={})
error_message: str = Field(default="")
error_stack: str = Field(default="")

Expand Down
10 changes: 5 additions & 5 deletions src/datachain/lib/webdataset_laion.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class WDSLaion(WDSBasic):
class LaionMeta(BaseModel):
file: File
index: Optional[int] = Field(default=None)
b32_img: list[float] = Field(default=None)
b32_txt: list[float] = Field(default=None)
l14_img: list[float] = Field(default=None)
l14_txt: list[float] = Field(default=None)
dedup: list[float] = Field(default=None)
b32_img: list[float] = Field(default=[])
b32_txt: list[float] = Field(default=[])
l14_img: list[float] = Field(default=[])
l14_txt: list[float] = Field(default=[])
dedup: list[float] = Field(default=[])


def process_laion_meta(file: File) -> Iterator[LaionMeta]:
Expand Down
4 changes: 2 additions & 2 deletions src/datachain/model/bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BBox(DataModel):
"""

title: str = Field(default="")
coords: list[int] = Field(default=None)
coords: list[int] = Field(default=[])

@staticmethod
def from_list(coords: list[float], title: str = "") -> "BBox":
Expand Down Expand Up @@ -60,7 +60,7 @@ class OBBox(DataModel):
"""

title: str = Field(default="")
coords: list[int] = Field(default=None)
coords: list[int] = Field(default=[])

@staticmethod
def from_list(coords: list[float], title: str = "") -> "OBBox":
Expand Down
10 changes: 5 additions & 5 deletions src/datachain/model/pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Pose(DataModel):
corresponds to a specific body part.
"""

x: list[int] = Field(default=None)
y: list[int] = Field(default=None)
x: list[int] = Field(default=[])
y: list[int] = Field(default=[])

@staticmethod
def from_list(points: list[list[float]]) -> "Pose":
Expand Down Expand Up @@ -55,9 +55,9 @@ class Pose3D(DataModel):
where each index corresponds to a specific body part.
"""

x: list[int] = Field(default=None)
y: list[int] = Field(default=None)
visible: list[float] = Field(default=None)
x: list[int] = Field(default=[])
y: list[int] = Field(default=[])
visible: list[float] = Field(default=[])

@staticmethod
def from_list(points: list[list[float]]) -> "Pose3D":
Expand Down
4 changes: 2 additions & 2 deletions src/datachain/model/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Segment(DataModel):
"""

title: str = Field(default="")
x: list[int] = Field(default=None)
y: list[int] = Field(default=None)
x: list[int] = Field(default=[])
y: list[int] = Field(default=[])

@staticmethod
def from_list(points: list[list[float]], title: str = "") -> "Segment":
Expand Down

0 comments on commit 3671039

Please sign in to comment.