Skip to content

Commit f1e19da

Browse files
author
Matt Sokoloff
committed
format and add cuid type
1 parent 6167d2a commit f1e19da

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

labelbox/data/annotation_types/annotation.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,5 @@ class VideoClassificationAnnotation(ClassificationAnnotation):
4949
frame: int
5050

5151

52-
AnnotationType = Union[ClassificationAnnotation, ObjectAnnotation]
53-
VideoAnnotationType = Union[VideoObjectAnnotation,
54-
VideoClassificationAnnotation]
55-
5652
VideoObjectAnnotation.update_forward_refs()
5753
ObjectAnnotation.update_forward_refs()

labelbox/data/annotation_types/feature.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from pydantic import BaseModel, root_validator
44

5+
from .types import Cuid
6+
57

68
class FeatureSchema(BaseModel):
79
"""
@@ -13,7 +15,7 @@ class FeatureSchema(BaseModel):
1315
to retroactively add schema ids by looking them up from the names.
1416
"""
1517
name: Optional[str] = None
16-
schema_id: Optional[str] = None
18+
schema_id: Optional[Cuid] = None
1719

1820
@root_validator
1921
def must_set_one(cls, values):

labelbox/data/annotation_types/label.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
from .data import VideoData, TextData, RasterData
99
from .geometry.mask import Mask
1010
from .metrics import Metric
11-
from .annotation import (AnnotationType, ClassificationAnnotation,
12-
ObjectAnnotation, VideoAnnotationType)
11+
from .annotation import (ClassificationAnnotation, ObjectAnnotation,
12+
VideoClassificationAnnotation, VideoObjectAnnotation)
1313

1414

1515
class Label(BaseModel):
1616
data: Union[VideoData, RasterData, TextData]
17-
annotations: List[Union[AnnotationType, VideoAnnotationType, Metric]] = []
17+
annotations: List[Union[ClassificationAnnotation, ObjectAnnotation,
18+
VideoObjectAnnotation,
19+
VideoClassificationAnnotation, Metric]] = []
1820
extra: Dict[str, Any] = {}
1921

2022
def add_url_to_data(self, signer) -> "Label":
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from pydantic import Field
2+
from typing_extensions import Annotated
3+
4+
Cuid = Annotated[str, Field(min_length=25, max_length=25)]

0 commit comments

Comments
 (0)