Skip to content

Commit

Permalink
fix: On discussion with Sergei, actually Should be UUID (#810)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim-Encord authored Dec 3, 2024
1 parent 648cab1 commit ccf5863
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 5 additions & 4 deletions encord/objects/ontology_labels_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any, Dict, Iterable, List, Optional, Sequence, Set, Type, Union
from uuid import UUID

from encord.client import EncordClientProject
from encord.client import LabelRow as OrmLabelRow
Expand Down Expand Up @@ -408,14 +409,14 @@ def audio_num_channels(self) -> Optional[int]:
return self._label_row_read_only_data.audio_num_channels

@property
def backing_item_uuid(self) -> Optional[str]:
def backing_item_uuid(self) -> Optional[UUID]:
"""
Returns the unique identifier (UUID) for the backing storage item associated with this label row.
The backing item UUID represents the storage reference for the data linked to the row.
While it is always included in server responses, it is marked as optional for backward compatibility with earlier versions.
Returns:
Optional[str]: The backing storage item id or None if not found.
Optional[UUID]: The backing storage item id or None if not found.
"""
# TODO: Mark required in 0.2 release
return self._label_row_read_only_data.backing_item_uuid
Expand Down Expand Up @@ -1589,7 +1590,7 @@ class LabelRowReadOnlyData:
last_edited_at: Optional[datetime]
data_hash: str
data_type: DataType
backing_item_uuid: Optional[str]
backing_item_uuid: Optional[UUID]
label_status: LabelStatus
annotation_task_status: Optional[AnnotationTaskStatus]
workflow_graph_node: Optional[WorkflowGraphNode]
Expand Down
5 changes: 3 additions & 2 deletions encord/orm/label_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dataclasses import asdict, dataclass
from enum import Enum
from typing import Any, Dict, List, Optional
from uuid import UUID

from pydantic import Field

Expand Down Expand Up @@ -291,7 +292,7 @@ class LabelRowMetadata(Formatter):
"""Only available for certain read requests"""
is_valid: bool = True

backing_item_uuid: Optional[str] = None
backing_item_uuid: Optional[UUID] = None

@classmethod
def from_dict(cls, json_dict: Dict) -> LabelRowMetadata:
Expand Down Expand Up @@ -428,7 +429,7 @@ class LabelRowMetadataDTO(BaseDTO):
"""Only available for certain read requests"""
is_valid: bool = True

backing_item_uuid: Optional[str] = None
backing_item_uuid: Optional[UUID] = None


def label_row_metadata_dto_to_label_row_metadata(label_row_metadata_dto: LabelRowMetadataDTO) -> LabelRowMetadata:
Expand Down

0 comments on commit ccf5863

Please sign in to comment.