@@ -29,18 +29,18 @@ def __repr__(self):
29
29
return (
30
30
f"{ self .__class__ .__name__ } ("
31
31
f"shape={ self .shape } , "
32
- f"labels={ self .get_labels (True )} "
32
+ f"labels={ self .get_labels (include_empty = True )} "
33
33
)
34
34
35
35
@property
36
- def shape (self ):
36
+ def shape (self ) -> ShapeEntity :
37
37
"""
38
38
Returns the shape that is in the annotation
39
39
"""
40
40
return self .__shape
41
41
42
42
@shape .setter
43
- def shape (self , value ):
43
+ def shape (self , value ) -> None :
44
44
self .__shape = value
45
45
46
46
def get_labels (self , include_empty : bool = False ) -> List [ScoredLabel ]:
@@ -67,15 +67,15 @@ def get_label_ids(self, include_empty: bool = False) -> Set[ID]:
67
67
if include_empty or (not label .is_empty )
68
68
}
69
69
70
- def append_label (self , label : ScoredLabel ):
70
+ def append_label (self , label : ScoredLabel ) -> None :
71
71
"""
72
72
Appends the scored label to the annotation.
73
73
74
74
:param label: the scored label to be appended to the annotation
75
75
"""
76
76
self .__labels .append (label )
77
77
78
- def set_labels (self , labels : List [ScoredLabel ]):
78
+ def set_labels (self , labels : List [ScoredLabel ]) -> None :
79
79
"""
80
80
Sets the labels of the annotation to be the input of the function.
81
81
@@ -86,7 +86,8 @@ def set_labels(self, labels: List[ScoredLabel]):
86
86
def __eq__ (self , other ):
87
87
if isinstance (other , Annotation ):
88
88
return (
89
- self .get_labels (True ) == other .get_labels (True )
89
+ self .get_labels (include_empty = True )
90
+ == other .get_labels (include_empty = True )
90
91
and self .shape == other .shape
91
92
)
92
93
return False
@@ -160,14 +161,14 @@ def __repr__(self):
160
161
)
161
162
162
163
@property
163
- def id_ (self ):
164
+ def id_ (self ) -> ID :
164
165
"""
165
166
Returns the ID of the AnnotationSceneEntity.
166
167
"""
167
168
return self .__id_
168
169
169
170
@id_ .setter
170
- def id_ (self , value ):
171
+ def id_ (self , value ) -> None :
171
172
self .__id_ = value
172
173
173
174
@property
@@ -181,36 +182,36 @@ def id(self, value):
181
182
self .__id_ = value
182
183
183
184
@property
184
- def kind (self ):
185
+ def kind (self ) -> AnnotationSceneKind :
185
186
"""
186
187
Returns the AnnotationSceneKind of the AnnotationSceneEntity.
187
188
"""
188
189
return self .__kind
189
190
190
191
@kind .setter
191
- def kind (self , value ):
192
+ def kind (self , value ) -> None :
192
193
self .__kind = value
193
194
194
195
@property
195
- def editor_name (self ):
196
+ def editor_name (self ) -> str :
196
197
"""
197
198
Returns the editor's name that made the AnnotationSceneEntity object.
198
199
"""
199
200
return self .__editor
200
201
201
202
@editor_name .setter
202
- def editor_name (self , value ):
203
+ def editor_name (self , value ) -> None :
203
204
self .__editor = value
204
205
205
206
@property
206
- def creation_date (self ):
207
+ def creation_date (self ) -> datetime . datetime :
207
208
"""
208
209
Returns the creation date of the AnnotationSceneEntity object.
209
210
"""
210
211
return self .__creation_date
211
212
212
213
@creation_date .setter
213
- def creation_date (self , value ):
214
+ def creation_date (self , value ) -> None :
214
215
self .__creation_date = value
215
216
216
217
@property
@@ -231,7 +232,7 @@ def shapes(self) -> List[ShapeEntity]:
231
232
"""
232
233
return [annotation .shape for annotation in self .annotations ]
233
234
234
- def contains_any (self , labels : List [LabelEntity ]):
235
+ def contains_any (self , labels : List [LabelEntity ]) -> bool :
235
236
"""
236
237
Checks whether the annotation contains any labels in the input parameter.
237
238
@@ -249,13 +250,13 @@ def contains_any(self, labels: List[LabelEntity]):
249
250
!= 0
250
251
)
251
252
252
- def append_annotation (self , annotation : Annotation ):
253
+ def append_annotation (self , annotation : Annotation ) -> None :
253
254
"""
254
255
Appends the passed annotation to the list of annotations present in the AnnotationSceneEntity object.
255
256
"""
256
257
self .annotations .append (annotation )
257
258
258
- def append_annotations (self , annotations : List [Annotation ]):
259
+ def append_annotations (self , annotations : List [Annotation ]) -> None :
259
260
"""
260
261
Adds a list of annotations to the annotation scene.
261
262
"""
@@ -272,7 +273,7 @@ def get_labels(self, include_empty: bool = False) -> List[LabelEntity]:
272
273
273
274
labels : Dict [str , LabelEntity ] = {}
274
275
for annotation in self .annotations :
275
- for label in annotation .get_labels (include_empty ):
276
+ for label in annotation .get_labels (include_empty = include_empty ):
276
277
id_ = label .id_
277
278
if id_ not in labels :
278
279
labels [id_ ] = label .get_label ()
0 commit comments