Skip to content

Commit e79ee8a

Browse files
author
gdj0nes
committed
FIX: formatting
1 parent fa2c9fd commit e79ee8a

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

labelbox/data/annotation_types/data/raster.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class RasterData(BaseModel, ABC):
2323
arr: Optional[TypedArray[Literal['uint8']]] = None
2424

2525
@classmethod
26-
def from_2D_arr(cls, arr: Union[TypedArray[Literal['uint8']], TypedArray[Literal['int']]], **kwargs):
26+
def from_2D_arr(cls, arr: Union[TypedArray[Literal['uint8']],
27+
TypedArray[Literal['int']]], **kwargs):
2728
"""Construct from a 2D numpy array
2829
2930
Args:
@@ -44,7 +45,9 @@ def from_2D_arr(cls, arr: Union[TypedArray[Literal['uint8']], TypedArray[Literal
4445
if np.can_cast(arr, np.uint8):
4546
arr = arr.astype(np.uint8)
4647
else:
47-
raise ValueError("Could not cast array to uint8, check that values are between 0 and 255")
48+
raise ValueError(
49+
"Could not cast array to uint8, check that values are between 0 and 255"
50+
)
4851

4952
arr = np.stack((arr,) * 3, axis=-1)
5053
return cls(arr=arr, **kwargs)

labelbox/data/annotation_types/label.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55

66
from labelbox.orm.model import Entity
77
from labelbox.schema import ontology
8-
from .annotation import (
9-
ClassificationAnnotation,
10-
ObjectAnnotation,
11-
VideoClassificationAnnotation,
12-
VideoObjectAnnotation
13-
)
8+
from .annotation import (ClassificationAnnotation, ObjectAnnotation,
9+
VideoClassificationAnnotation, VideoObjectAnnotation)
1410
from .classification import ClassificationAnswer
1511
from .data import VideoData, TextData, ImageData, BaseData
1612
from .geometry import Mask
@@ -40,14 +36,10 @@ class Label(BaseModel):
4036
"""
4137
uid: Optional[Cuid] = None
4238
data: Union[BaseData]
43-
annotations: List[Union[
44-
ClassificationAnnotation,
45-
ObjectAnnotation,
46-
VideoObjectAnnotation,
47-
VideoClassificationAnnotation,
48-
ScalarMetric,
49-
ConfusionMatrixMetric
50-
]] = []
39+
annotations: List[Union[ClassificationAnnotation, ObjectAnnotation,
40+
VideoObjectAnnotation,
41+
VideoClassificationAnnotation, ScalarMetric,
42+
ConfusionMatrixMetric]] = []
5143
extra: Dict[str, Any] = {}
5244

5345
def object_annotations(self) -> List[ObjectAnnotation]:
@@ -63,13 +55,13 @@ def _get_annotations_by_type(self, annotation_type):
6355
]
6456

6557
def frame_annotations(
66-
self
58+
self
6759
) -> Dict[str, Union[VideoObjectAnnotation, VideoClassificationAnnotation]]:
6860
frame_dict = defaultdict(list)
6961
for annotation in self.annotations:
7062
if isinstance(
7163
annotation,
72-
(VideoObjectAnnotation, VideoClassificationAnnotation)):
64+
(VideoObjectAnnotation, VideoClassificationAnnotation)):
7365
frame_dict[annotation.frame].append(annotation)
7466
return frame_dict
7567

0 commit comments

Comments
 (0)