Skip to content

Commit e377520

Browse files
authored
Merge pull request #408 from superannotateai/friday-stremed-data-handeling
Fix data handler
2 parents 8493907 + c25b716 commit e377520

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2787,7 +2787,7 @@ def validate_annotations(
27872787
"""
27882788
with open(annotations_json) as file:
27892789
annotation_data = json.loads(file.read())
2790-
response = Controller.get_default().validate_annotations(
2790+
response = Controller.validate_annotations(
27912791
project_type, annotation_data, allow_extra=False
27922792
)
27932793
if response.errors:

src/superannotate/lib/infrastructure/controller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,13 +1544,14 @@ def delete_annotations(
15441544
)
15451545
return use_case.execute()
15461546

1547+
@staticmethod
15471548
def validate_annotations(
1548-
self, project_type: str, annotation: dict, allow_extra: bool = False
1549+
project_type: str, annotation: dict, allow_extra: bool = False
15491550
):
15501551
use_case = usecases.ValidateAnnotationUseCase(
15511552
project_type,
15521553
annotation,
1553-
validators=self.annotation_validators,
1554+
validators=AnnotationValidators(),
15541555
allow_extra=allow_extra,
15551556
)
15561557
return use_case.execute()

src/superannotate/lib/infrastructure/stream_data_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def map_image_names_to_fetch_streamed_data(data: List[str]):
1313

1414

1515
class StreamedAnnotations:
16-
DELIMITER = b'\n:)\n'
16+
DELIMITER = b"\\n;)\\n"
1717

1818
def __init__(self, headers: dict):
1919
self._headers = headers

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
import pytest
3+
4+
5+
@pytest.fixture(autouse=True)
6+
def tests_setup():
7+
os.environ.update({"SA_TESTING": "True"})

tests/integration/annotations/test_get_annotations.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def folder_path(self):
2323

2424
@pytest.mark.flaky(reruns=3)
2525
def test_get_annotations(self):
26+
sa.init()
2627
sa.upload_images_from_folder_to_project(
2728
self.PROJECT_NAME, self.folder_path, annotation_status="InProgress"
2829
)

tests/integration/annotations/test_get_annotations_per_frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def annotations_path(self):
3535
return os.path.join(self.folder_path, self.ANNOTATIONS_PATH)
3636

3737
def test_video_annotation_upload(self):
38+
sa.init()
3839
sa.create_annotation_classes_from_classes_json(self.PROJECT_NAME, self.classes_path)
3940

4041
_, _, _ = sa.attach_video_urls_to_project(

0 commit comments

Comments
 (0)