Skip to content

Commit ef863e1

Browse files
committed
Update __init__.py
1 parent 03b5448 commit ef863e1

File tree

6 files changed

+14
-54
lines changed

6 files changed

+14
-54
lines changed

src/superannotate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import sys
33

4-
__version__ = "4.4.2dev3"
4+
__version__ = "4.4.2dev5"
55

66
sys.path.append(os.path.split(os.path.realpath(__file__))[0])
77

src/superannotate/lib/core/service_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Config:
9999
extra = Extra.allow
100100

101101
def __init__(self, response=None, content_type=None, dispatcher: Callable = None):
102-
if not response:
102+
if response is None:
103103
super().__init__()
104104
return
105105
data = {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import json
66
import os
77
import platform
8-
import queue
98
import sys
10-
import threading
119
import time
1210
from dataclasses import dataclass
1311
from datetime import datetime
@@ -1159,6 +1157,8 @@ def iter_errors(self, instance, _schema=None):
11591157
try:
11601158
for error in errors:
11611159
# set details if not already set by the called fn
1160+
if isinstance(error, StopIteration):
1161+
return
11621162
error._set(
11631163
validator=k,
11641164
validator_value=v,
@@ -1168,7 +1168,7 @@ def iter_errors(self, instance, _schema=None):
11681168
if k != "$ref":
11691169
error.schema_path.appendleft(k)
11701170
yield error
1171-
except StopIteration:
1171+
except RuntimeError:
11721172
pass
11731173
finally:
11741174
if scope:
@@ -1219,6 +1219,8 @@ def execute(self) -> Response:
12191219
errors_report: List[Tuple[str, str]] = []
12201220
if errors:
12211221
for error in errors:
1222+
if not error:
1223+
continue
12221224
real_path = extract_path(error.path)
12231225
if not error.context:
12241226
errors_report.append(("".join(real_path), error.message))

src/superannotate/lib/infrastructure/services.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,7 @@ class SuperannotateBackendService(BaseBackendService):
289289
URL_DELETE_ANNOTATIONS = "annotations/remove"
290290
URL_DELETE_ANNOTATIONS_PROGRESS = "annotations/getRemoveStatus"
291291
URL_GET_LIMITS = "project/{}/limitationDetails"
292-
URL_GET_ANNOTATIONS = (
293-
"https://assets-provider.devsuperannotate.com/api/v1/annotations/stream"
294-
)
292+
URL_GET_ANNOTATIONS = "items/annotations/download"
295293
URL_UPLOAD_PRIORITY_SCORES = "images/updateEntropy"
296294
URL_GET_INTEGRATIONS = "integrations"
297295
URL_ATTACH_INTEGRATIONS = "image/integration/create"
@@ -556,7 +554,6 @@ def create_annotation_classes(
556554
params=params,
557555
data={"classes": data},
558556
content_type=List[AnnotationClassEntity],
559-
# dispatcher=lambda x: x.pop("data")
560557
)
561558

562559
def get_project_workflows(self, project_id: int, team_id: int):
@@ -1156,7 +1153,7 @@ def get_annotations(
11561153

11571154
return loop.run_until_complete(
11581155
handler.get_data(
1159-
url=self.URL_GET_ANNOTATIONS,
1156+
url=urljoin(self.assets_provider_url, self.URL_GET_ANNOTATIONS),
11601157
data=items,
11611158
params=query_params,
11621159
chunk_size=self.DEFAULT_CHUNK_SIZE,
@@ -1194,7 +1191,7 @@ async def download_annotations(
11941191
)
11951192

11961193
return await handler.download_data(
1197-
url=self.URL_GET_ANNOTATIONS,
1194+
url=urljoin(self.assets_provider_url, self.URL_GET_ANNOTATIONS),
11981195
data=items,
11991196
params=query_params,
12001197
chunk_size=self.DEFAULT_CHUNK_SIZE,

tests/integration/annotations/test_missing_annotation_upload.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -65,43 +65,3 @@ def test_missing_pre_annotation_upload(self):
6565
self.assertEqual(len(could_not_upload), 0)
6666
self.assertEqual(len(missing_images), 1)
6767

68-
self.assertTrue(
69-
any(
70-
[
71-
True
72-
for path in uploaded
73-
if "sample_project_vector_for_checks/example_image_1.jpg___objects.json"
74-
in path
75-
]
76-
)
77-
)
78-
self.assertTrue(
79-
any(
80-
[
81-
True
82-
for path in uploaded
83-
if "sample_project_vector_for_checks/example_image_2.jpg___objects.json"
84-
in path
85-
]
86-
)
87-
)
88-
self.assertTrue(
89-
any(
90-
[
91-
True
92-
for path in uploaded
93-
if "sample_project_vector_for_checks/example_image_4.jpg___objects.json"
94-
in path
95-
]
96-
)
97-
)
98-
self.assertTrue(
99-
any(
100-
[
101-
True
102-
for path in missing_images
103-
if "sample_project_vector_for_checks/example_image_5.jpg___objects.json"
104-
in path
105-
]
106-
)
107-
)

tests/integration/annotations/test_upload_annotations_from_folder_to_project.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ def test_annotation_folder_upload_download(self):
4343
def test_upload_big_annotations(self):
4444
sa.attach_items(
4545
self.PROJECT_NAME,
46-
[{"name": f"aearth_mov_00{i}.jpg", "url": f"url_{i}"} for i in range(1, 2)] # noqa
46+
[{"name": f"aearth_mov_00{i}.jpg", "url": f"url_{i}"} for i in range(1, 6)] # noqa
4747
)
4848
sa.create_annotation_classes_from_classes_json(
4949
self.PROJECT_NAME, f"{self.big_annotations_folder_path}/classes/classes.json"
5050
)
51-
_, _, _ = sa.upload_annotations_from_folder_to_project(
51+
uploaded, _, _ = sa.upload_annotations_from_folder_to_project(
5252
self.PROJECT_NAME, self.big_annotations_folder_path
5353
)
54+
assert uploaded == 5
5455
annotations = sa.get_annotations(self.PROJECT_NAME)
55-
assert len(annotations) == 5
56+
assert all([annotation["instances"] > 1 for annotation in annotations])

0 commit comments

Comments
 (0)