Skip to content

Commit 7c4e4f2

Browse files
committed
Merge with develop
2 parents a144dbd + 115161a commit 7c4e4f2

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed

CHANGELOG.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,26 @@ History
66

77
All release highlights of this project will be documented in this file.
88

9+
4.4.23 - July 4, 2024
10+
_______________________
11+
12+
13+
**Updated**
14+
15+
- ``SAClient.prepare_export`` added the ability to export GenAI project data to a CSV file..
16+
17+
**Fixed**
18+
19+
- ``SAClient.upload_priority_scores`` fixed an issue arising from empty arguments
20+
921
4.4.22 - Jun 13, 2024
1022
_______________________
1123

1224

1325
**Updated**
1426

1527
- Dependencies, updated ``packaging``, ``superannotate-schemas``.
16-
- ``search_folders`` by multiple statuses.
28+
- ``SAClient.search_folders`` by multiple statuses.
1729

1830

1931
4.4.21 - May 23, 2024
@@ -22,8 +34,8 @@ _______________________
2234

2335
**Updated**
2436

25-
- Dependencies, removed ``email-validator``.
26-
- ``add_items_to_subset`` added GenAI projects support.
37+
- Dependencies, removed ``SAClientemail-validator``.
38+
- ``SAClient.add_items_to_subset`` added GenAI projects support.
2739

2840

2941

src/superannotate/__init__.py

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

55

6-
__version__ = "4.4.23dev"
6+
__version__ = "4.4.24dev1"
77

88
sys.path.append(os.path.split(os.path.realpath(__file__))[0])
99

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ def execute(self):
12281228
)
12291229
self._response.data = (uploaded_score_names, skipped_score_names)
12301230
else:
1231-
self.reporter.warning_messages("Empty scores.")
1231+
self.reporter.warning_messages.append("Empty scores.")
12321232
return self._response
12331233

12341234

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def __init__(
4646
only_pinned: bool,
4747
annotation_statuses: List[str] = None,
4848
integration_id: int = None,
49+
export_type: int = None,
4950
):
5051
super().__init__(),
5152
self._project = project
@@ -55,6 +56,7 @@ def __init__(
5556
self._include_fuse = include_fuse
5657
self._only_pinned = only_pinned
5758
self._integration_id = integration_id
59+
self._export_type = export_type
5860

5961
def validate_only_pinned(self):
6062
if (
@@ -75,6 +77,20 @@ def validate_fuse(self):
7577
f"{ProjectType.get_name(self._project.type)} attached with URLs"
7678
)
7779

80+
def validate_export_type(self):
81+
if self._export_type == 2:
82+
if (
83+
self._project.type != ProjectType.VECTOR.value
84+
or self._project.upload_state != constances.UploadState.EXTERNAL.value
85+
):
86+
raise AppValidationException(
87+
"COCO format is not supported for this project."
88+
)
89+
elif self._export_type == 3 and self._project.type != ProjectType.GEN_AI.value:
90+
raise AppValidationException(
91+
"CSV format is not supported for this project."
92+
)
93+
7894
def validate_folder_names(self):
7995
if self._folder_names:
8096
condition = Condition("project_id", self._project.id, EQ)
@@ -102,15 +118,17 @@ def execute(self):
102118
constances.AnnotationStatus.NOT_STARTED.name,
103119
constances.AnnotationStatus.SKIPPED.name,
104120
]
105-
106-
response = self._service_provider.prepare_export(
121+
kwargs = dict(
107122
project=self._project,
108123
folders=self._folder_names,
109124
annotation_statuses=self._annotation_statuses,
110125
include_fuse=self._include_fuse,
111126
only_pinned=self._only_pinned,
112127
integration_id=self._integration_id,
113128
)
129+
if self._export_type:
130+
kwargs["export_type"] = self._export_type
131+
response = self._service_provider.prepare_export(**kwargs)
114132
if not response.ok:
115133
raise AppException(response.error)
116134

src/superannotate/lib/infrastructure/serviceprovider.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def prepare_export(
152152
include_fuse: bool,
153153
only_pinned: bool,
154154
integration_id: int = None,
155+
export_type: int = None,
155156
):
156157
annotation_statuses = ",".join(
157158
[str(constants.AnnotationStatus.get_value(i)) for i in annotation_statuses]
@@ -164,6 +165,8 @@ def prepare_export(
164165
"coco": 0,
165166
"time": datetime.datetime.now().strftime("%b %d %Y %H:%M"),
166167
}
168+
if export_type:
169+
data["export_format"] = export_type
167170
if folders:
168171
data["folder_names"] = folders
169172
if integration_id is not None:

tests/integration/test_upload_priority_scores.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ class TestUploadPriorityScores(BaseTestCase):
1717
def folder_path(self):
1818
return os.path.join(Path(__file__).parent.parent, self.TEST_FOLDER_PATH)
1919

20+
def test_upload_empty_list(self):
21+
with self.assertLogs("sa", level="INFO") as cm:
22+
sa.upload_priority_scores(self.PROJECT_NAME, scores=[])
23+
assert (
24+
cm.output[0]
25+
== "INFO:sa:Uploading priority scores for 0 item(s) to TestUploadPriorityScores."
26+
)
27+
2028
def test_upload_priority_scores(self):
2129

2230
self._attach_items(count=4)

0 commit comments

Comments
 (0)