Skip to content

Commit faab9d3

Browse files
committed
bringing back prettyfication, annotations are pretty again!
1 parent e95b085 commit faab9d3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/superannotate/lib/core/usecases/annotations.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,18 @@ def validate_item_names(self):
774774

775775
self._item_names = [item.name for item in self._images.get_all(condition)]
776776

777+
def _prettify_annotations(self, annotations: List[dict]):
778+
restruct = {}
779+
780+
if self._item_names_provided:
781+
for annotation in annotations:
782+
restruct[annotation["metadata"]["name"]] = annotation
783+
try:
784+
return [restruct[x] for x in self._item_names]
785+
except KeyError:
786+
raise AppException("Broken data.")
787+
788+
return annotations
777789

778790
async def get_big_annotation(
779791
self,
@@ -858,7 +870,7 @@ def execute(self):
858870
self.reporter.log_warning(
859871
f"Could not find annotations for {items_count - received_items_count}/{items_count} items."
860872
)
861-
self._response.data = annotations
873+
self._response.data = self._prettify_annotations(annotations)
862874
return self._response
863875

864876

0 commit comments

Comments
 (0)