Skip to content

Commit ffe9446

Browse files
authored
Merge pull request #686 from superannotateai/develop
Develop
2 parents 6aca620 + 4023f22 commit ffe9446

File tree

6 files changed

+41
-8
lines changed

6 files changed

+41
-8
lines changed

CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ History
66

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

9+
4.4.21 - May 23, 2024
10+
_______________________
11+
12+
13+
**Updated**
14+
15+
- Dependencies, removed ``email-validator``.
16+
- ``add_items_to_subset`` added GenAI projects support.
17+
18+
919

1020
4.4.20 - April 11, 2024
1121
_______________________

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ boto3~=1.26
44
opencv-python-headless~=4.7
55
packaging~=23.1
66
plotly~=5.14
7-
email-validator~=2.0
87
pandas~=2.0
98
ffmpeg-python~=0.2
109
pillow>=9.5,~=10.0

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.20"
6+
__version__ = "4.4.21"
77

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

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ def __init__(
14641464
self._folder = folder
14651465
self._service_provider = service_provider
14661466
self._items = items
1467-
self._item_name_id_map = {}
1467+
self._item_id_name_map = {}
14681468
self._item_names_provided = True
14691469
self._big_annotations_queue = None
14701470

@@ -1499,9 +1499,8 @@ def _prettify_annotations(self, annotations: List[dict]):
14991499
if names_provided:
15001500
re_struct[annotation["metadata"]["name"]] = annotation
15011501
else:
1502-
re_struct[
1503-
self._item_name_id_map[annotation["metadata"]["name"]]
1504-
] = annotation
1502+
if annotation["metadata"]["id"] in self._item_id_name_map.keys():
1503+
re_struct[annotation["metadata"]["id"]] = annotation
15051504
try:
15061505
return [re_struct[x] for x in self._items if x in re_struct]
15071506
except KeyError:
@@ -1589,7 +1588,7 @@ def execute(self):
15891588
if not response.ok:
15901589
raise AppException(response.error)
15911590
items: List[BaseItemEntity] = response.data
1592-
self._item_name_id_map = {i.name: i.id for i in items}
1591+
self._item_id_name_map = {i.id: i.name for i in items}
15931592
len_items, len_provided_items = len(items), len(self._items)
15941593
if len_items != len_provided_items:
15951594
self.reporter.log_warning(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ def __build_query_string(self, path, item_names):
972972
_, folder = extract_project_folder(path)
973973
if not folder:
974974
folder = "root"
975-
query_str = f"metadata(name IN {str(item_names)}) AND folder={folder}"
975+
query_str = f"metadata(name IN {str(item_names)}) AND folderName={folder}"
976976

977977
return query_str
978978

tests/integration/annotations/test_get_annotations.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
class TestGetAnnotations(BaseTestCase):
1414
PROJECT_NAME = "Test-get_annotations"
1515
FOLDER_NAME = "Test-get_annotations"
16+
FOLDER_NAME_2 = "Test-get_annotations_2"
1617
PROJECT_DESCRIPTION = "Desc"
1718
PROJECT_TYPE = "Vector"
1819
TEST_FOLDER_PATH = "data_set/sample_project_vector"
@@ -57,6 +58,30 @@ def test_get_annotations_by_ids(self):
5758

5859
self.assertEqual(len(annotations), 4)
5960

61+
def test_get_annotations_by_ids_with_duplicate_names(self):
62+
sa.create_folder(self.PROJECT_NAME, self.FOLDER_NAME_2)
63+
self._attach_items(count=4, folder=self.FOLDER_NAME_2) # noqa
64+
self._attach_items(count=4) # noqa
65+
66+
sa.create_annotation_classes_from_classes_json(
67+
self.PROJECT_NAME, f"{self.folder_path}/classes/classes.json"
68+
)
69+
_, _, _ = sa.upload_annotations_from_folder_to_project(
70+
self.PROJECT_NAME, self.folder_path
71+
)
72+
_, _, _ = sa.upload_annotations_from_folder_to_project(
73+
f"{self.PROJECT_NAME}/{self.FOLDER_NAME_2}", self.folder_path
74+
)
75+
items = sa.search_items(self.PROJECT_NAME)
76+
folder_items = sa.search_items(f"{self.PROJECT_NAME}/{self.FOLDER_NAME_2}")
77+
all_items = items + folder_items
78+
79+
annotations = sa.get_annotations(
80+
self._project["id"], [i["id"] for i in all_items]
81+
)
82+
83+
self.assertEqual(len(annotations), 8)
84+
6085
def test_get_annotations_by_wrong_item_ids(self):
6186
annotations = sa.get_annotations(self._project["id"], [1, 2, 3])
6287

0 commit comments

Comments
 (0)