@@ -26,21 +26,18 @@ def rle_decoding(rle_arr: List[int], w: int, h: int) -> np.ndarray:
2626 return mask .reshape ((w , h )).T
2727
2828
29- def get_annotation_lookup (
30- annotations : List [Union [ClassificationAnnotation , ObjectAnnotation ,
31- VideoMaskAnnotation , ScalarMetric ,
32- ConfusionMatrixMetric , RelationshipAnnotation ]]
33- ) -> defaultdict [Any , list ]:
29+ def get_annotation_lookup (annotations ):
3430 """Get annotations from Label.annotations objects
3531
3632 Args:
3733 annotations (Label.annotations): Annotations attached to labelbox Label object used as private method
3834 """
3935 annotation_lookup = defaultdict (list )
4036 for annotation in annotations :
41- annotation_lookup [getattr (annotation , 'image_id' , None ) or
42- getattr (annotation , 'name' , None )].append (annotation )
43- return annotation_lookup
37+ # Provide a default value of None if the attribute doesn't exist
38+ attribute_value = getattr (annotation , 'image_id' , None ) or getattr (annotation , 'name' , None )
39+ annotation_lookup [attribute_value ].append (annotation )
40+ return annotation_lookup
4441
4542
4643class SegmentInfo (pydantic_compat .BaseModel ):
0 commit comments