Skip to content

Commit 1049fbb

Browse files
Narek MkhitaryanNarek Mkhitaryan
authored andcommitted
fix 2057_issue
1 parent fa66f95 commit 1049fbb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

docs/source/api_reference/helpers.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,3 @@ ________________________
2222
.. _ref_aggregate_annotations_as_df:
2323
.. automethod:: superannotate.SAClient.validate_annotations
2424
.. automethod:: superannotate.SAClient.aggregate_annotations_as_df
25-
26-
----------

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,20 @@ def prepare_annotation(self, annotation: dict, size) -> dict:
591591
)
592592
return annotation
593593

594+
@staticmethod
595+
def get_mask_path(path: str) -> str:
596+
if path.endswith(constants.PIXEL_ANNOTATION_POSTFIX):
597+
replacement = constants.PIXEL_ANNOTATION_POSTFIX
598+
else:
599+
replacement = ".json"
600+
parts = path.rsplit(replacement, 1)
601+
return constants.ANNOTATION_MASK_POSTFIX.join(parts)
602+
594603
async def get_annotation(
595604
self, path: str
596605
) -> (Optional[Tuple[io.StringIO]], Optional[io.BytesIO]):
597606
mask = None
598-
mask_path = path.replace(
599-
constants.PIXEL_ANNOTATION_POSTFIX, constants.ANNOTATION_MASK_POSTFIX
600-
)
607+
mask_path = self.get_mask_path(path)
601608
if self._client_s3_bucket:
602609
content = self.get_annotation_from_s3(self._client_s3_bucket, path).read()
603610
if self._project.type == constants.ProjectType.PIXEL.value:

0 commit comments

Comments
 (0)