Skip to content

Commit 9dceb6e

Browse files
Narek MkhitaryanNarek Mkhitaryan
authored andcommitted
resolve conflicts merge from develop
2 parents cfd7d5d + 4823683 commit 9dceb6e

File tree

10 files changed

+287
-7
lines changed

10 files changed

+287
-7
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
build-n-publish:
99
name: Build and publish Python 🐍 distributions 📦 to PyPI
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111
steps:
1212
- uses: actions/checkout@v3
1313
- name: Set up Python

docs/source/userguide/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Initialization and authorization
3232
================================
3333

3434
To use the SDK, you need to create a config file with a team-specific authentication token. The token is available
35-
to team admins on the team settings page at https://app.superannotate.com/team.
35+
to team admins on the team settings page at https://doc.superannotate.com/docs/token-for-python-sdk#generate-a-token-for-python-sdk.
3636

3737
SAClient can be used with or without arguments
3838
______________________________________________

docs/source/userguide/setup_project.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ An annotation class for a project can be created with SDK's:
7474
7575
To create annotation classes in bulk with SuperAnnotate export format
7676
:file:`classes.json` (documentation at:
77-
https://app.superannotate.com/documentation Management Tools
77+
https://superannotate.readthedocs.io/en/stable/userguide/setup_project.html#working-with-annotation-classes Ma`nagement Tools
7878
-> Project Workflow part):
7979

8080
.. code-block:: python

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ minversion = 3.7
33
log_cli=true
44
python_files = test_*.py
55
;pytest_plugins = ['pytest_profiling']
6-
;addopts = -n 4 --dist loadscope
6+
;addopts = -n 6 --dist loadscope

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3116,7 +3116,7 @@ def add_contributors_to_project(
31163116
:param emails: users email
31173117
:type emails: list
31183118
3119-
:param role: user role to apply, one of Admin , Annotator , QA
3119+
:param role: user role to apply, one of ProjectAdmin , Annotator , QA
31203120
:type role: str
31213121
31223122
:return: lists of added, skipped contributors of the project

src/superannotate/lib/core/entities/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class TimedBaseModel(BaseModel):
5757
class BaseItemEntity(TimedBaseModel):
5858
id: Optional[int]
5959
name: Optional[str]
60+
folder_id: Optional[int]
6061
path: Optional[str] = Field(
6162
None, description="Item’s path in SuperAnnotate project"
6263
)

src/superannotate/lib/infrastructure/stream_data_handler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import threading
66
import time
77
import typing
8+
from contextlib import suppress
89
from functools import lru_cache
910
from typing import Callable
1011

@@ -42,6 +43,7 @@ def __init__(
4243
self._callback: Callable = callback
4344
self._map_function = map_function
4445
self._items_downloaded = 0
46+
self._active_sessions = set()
4547

4648
def get_json(self, data: bytes):
4749
try:
@@ -113,21 +115,26 @@ async def fetch(
113115
def _get_session(self, thread_id, ttl=None): # noqa
114116
del ttl
115117
del thread_id
116-
return AIOHttpSession(
118+
session = AIOHttpSession(
117119
headers=self._headers,
118120
timeout=TIMEOUT,
119121
connector=aiohttp.TCPConnector(
120122
ssl=self.VERIFY_SSL, keepalive_timeout=2**32
121123
),
122124
raise_for_status=True,
123125
)
126+
self._active_sessions.add(session)
127+
return session
124128

125129
def get_session(self):
126130
return self._get_session(
127131
thread_id=threading.get_ident(), ttl=round(time.time() / 360)
128132
)
129133

130134
def rest_session(self):
135+
for s in self._active_sessions:
136+
with suppress(Exception):
137+
s.close()
131138
self._get_session.cache_clear()
132139

133140
async def list_annotations(
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
[
2+
{
3+
"createdAt": "2025-02-28T07:47:01.000Z",
4+
"updatedAt": "2025-02-28T07:47:01.000Z",
5+
"id": 5566574,
6+
"project_id": 934113,
7+
"type": 1,
8+
"name": "r_1hb7yn",
9+
"color": "#52C1D3",
10+
"attribute_groups": [
11+
{
12+
"createdAt": "2025-02-28T07:47:01.000Z",
13+
"updatedAt": "2025-02-28T07:47:01.000Z",
14+
"id": 5417151,
15+
"group_type": "text",
16+
"class_id": 5566574,
17+
"name": "value_r_1hb7yn",
18+
"attributes": []
19+
}
20+
]
21+
},
22+
{
23+
"createdAt": "2025-02-28T07:47:01.000Z",
24+
"updatedAt": "2025-02-28T07:47:01.000Z",
25+
"id": 5566575,
26+
"project_id": 934113,
27+
"type": 1,
28+
"name": "r_djuko8",
29+
"color": "#31E52E",
30+
"attribute_groups": [
31+
{
32+
"createdAt": "2025-02-28T07:47:01.000Z",
33+
"updatedAt": "2025-02-28T07:47:01.000Z",
34+
"id": 5417152,
35+
"group_type": "radio",
36+
"class_id": 5566575,
37+
"name": "value_r_djuko8",
38+
"attributes": [
39+
{
40+
"createdAt": "2025-02-28T07:47:01.000Z",
41+
"updatedAt": "2025-02-28T07:47:01.000Z",
42+
"id": 11107671,
43+
"group_id": 5417152,
44+
"project_id": 934113,
45+
"name": "Option 1",
46+
"default": 0
47+
},
48+
{
49+
"createdAt": "2025-02-28T07:47:01.000Z",
50+
"updatedAt": "2025-02-28T07:47:01.000Z",
51+
"id": 11107672,
52+
"group_id": 5417152,
53+
"project_id": 934113,
54+
"name": "Option 2",
55+
"default": 0
56+
},
57+
{
58+
"createdAt": "2025-02-28T07:47:01.000Z",
59+
"updatedAt": "2025-02-28T07:47:01.000Z",
60+
"id": 11107673,
61+
"group_id": 5417152,
62+
"project_id": 934113,
63+
"name": "Option 3",
64+
"default": 0
65+
}
66+
],
67+
"default_value": null
68+
}
69+
]
70+
},
71+
{
72+
"createdAt": "2025-02-28T07:47:01.000Z",
73+
"updatedAt": "2025-02-28T07:47:01.000Z",
74+
"id": 5566576,
75+
"project_id": 934113,
76+
"type": 1,
77+
"name": "r_vezcsh",
78+
"color": "#4E5C9F",
79+
"attribute_groups": [
80+
{
81+
"createdAt": "2025-02-28T07:47:01.000Z",
82+
"updatedAt": "2025-02-28T07:47:01.000Z",
83+
"id": 5417153,
84+
"group_type": "text",
85+
"class_id": 5566576,
86+
"name": "value_r_vezcsh",
87+
"attributes": []
88+
}
89+
]
90+
},
91+
{
92+
"createdAt": "2025-02-28T07:47:01.000Z",
93+
"updatedAt": "2025-02-28T07:47:01.000Z",
94+
"id": 5566577,
95+
"project_id": 934113,
96+
"type": 1,
97+
"name": "r_r85m12",
98+
"color": "#665539",
99+
"attribute_groups": [
100+
{
101+
"createdAt": "2025-02-28T07:47:01.000Z",
102+
"updatedAt": "2025-02-28T07:47:01.000Z",
103+
"id": 5417154,
104+
"group_type": "text",
105+
"class_id": 5566577,
106+
"name": "value_r_r85m12",
107+
"attributes": []
108+
}
109+
]
110+
},
111+
{
112+
"createdAt": "2025-02-28T07:47:01.000Z",
113+
"updatedAt": "2025-02-28T07:47:01.000Z",
114+
"id": 5566578,
115+
"project_id": 934113,
116+
"type": 1,
117+
"name": "r_81z4ae",
118+
"color": "#938CF1",
119+
"attribute_groups": [
120+
{
121+
"createdAt": "2025-02-28T07:47:01.000Z",
122+
"updatedAt": "2025-02-28T07:47:01.000Z",
123+
"id": 5417155,
124+
"group_type": "numeric",
125+
"class_id": 5566578,
126+
"name": "value_r_81z4ae",
127+
"attributes": []
128+
}
129+
]
130+
},
131+
{
132+
"createdAt": "2025-02-28T07:47:01.000Z",
133+
"updatedAt": "2025-02-28T07:47:01.000Z",
134+
"id": 5566579,
135+
"project_id": 934113,
136+
"type": 1,
137+
"name": "r_4dxiz5",
138+
"color": "#46D225",
139+
"attribute_groups": [
140+
{
141+
"createdAt": "2025-02-28T07:47:01.000Z",
142+
"updatedAt": "2025-02-28T07:47:01.000Z",
143+
"id": 5417156,
144+
"group_type": "checklist",
145+
"class_id": 5566579,
146+
"name": "value_r_4dxiz5",
147+
"attributes": [
148+
{
149+
"createdAt": "2025-02-28T07:47:01.000Z",
150+
"updatedAt": "2025-02-28T07:47:01.000Z",
151+
"id": 11107674,
152+
"group_id": 5417156,
153+
"project_id": 934113,
154+
"name": "Option 1",
155+
"default": 0
156+
},
157+
{
158+
"createdAt": "2025-02-28T07:47:01.000Z",
159+
"updatedAt": "2025-02-28T07:47:01.000Z",
160+
"id": 11107675,
161+
"group_id": 5417156,
162+
"project_id": 934113,
163+
"name": "Option 2",
164+
"default": 0
165+
},
166+
{
167+
"createdAt": "2025-02-28T07:47:01.000Z",
168+
"updatedAt": "2025-02-28T07:47:01.000Z",
169+
"id": 11107676,
170+
"group_id": 5417156,
171+
"project_id": 934113,
172+
"name": "Option 3",
173+
"default": 0
174+
}
175+
],
176+
"default_value": []
177+
}
178+
]
179+
},
180+
{
181+
"createdAt": "2025-02-28T07:47:01.000Z",
182+
"updatedAt": "2025-02-28T07:47:01.000Z",
183+
"id": 5566580,
184+
"project_id": 934113,
185+
"type": 1,
186+
"name": "r_9xs2b6",
187+
"color": "#F99F14",
188+
"attribute_groups": [
189+
{
190+
"createdAt": "2025-02-28T07:47:01.000Z",
191+
"updatedAt": "2025-02-28T07:47:01.000Z",
192+
"id": 5417157,
193+
"group_type": "numeric",
194+
"class_id": 5566580,
195+
"name": "value_r_9xs2b6",
196+
"attributes": []
197+
}
198+
]
199+
},
200+
{
201+
"createdAt": "2025-02-28T07:47:01.000Z",
202+
"updatedAt": "2025-02-28T07:47:01.000Z",
203+
"id": 5566581,
204+
"project_id": 934113,
205+
"type": 1,
206+
"name": "r_mxhymc",
207+
"color": "#6FF2EF",
208+
"attribute_groups": [
209+
{
210+
"createdAt": "2025-02-28T07:47:01.000Z",
211+
"updatedAt": "2025-02-28T07:47:01.000Z",
212+
"id": 5417158,
213+
"group_type": "radio",
214+
"class_id": 5566581,
215+
"name": "value_r_mxhymc",
216+
"attributes": [
217+
{
218+
"createdAt": "2025-02-28T07:47:01.000Z",
219+
"updatedAt": "2025-02-28T07:47:01.000Z",
220+
"id": 11107677,
221+
"group_id": 5417158,
222+
"project_id": 934113,
223+
"name": "Option 1",
224+
"default": 0
225+
},
226+
{
227+
"createdAt": "2025-02-28T07:47:01.000Z",
228+
"updatedAt": "2025-02-28T07:47:01.000Z",
229+
"id": 11107678,
230+
"group_id": 5417158,
231+
"project_id": 934113,
232+
"name": "Option 2",
233+
"default": 0
234+
},
235+
{
236+
"createdAt": "2025-02-28T07:47:01.000Z",
237+
"updatedAt": "2025-02-28T07:47:01.000Z",
238+
"id": 11107679,
239+
"group_id": 5417158,
240+
"project_id": 934113,
241+
"name": "Option 3",
242+
"default": 0
243+
}
244+
],
245+
"default_value": null
246+
}
247+
]
248+
},
249+
{
250+
"createdAt": "2025-02-28T07:47:01.000Z",
251+
"updatedAt": "2025-02-28T07:47:01.000Z",
252+
"id": 5566582,
253+
"project_id": 934113,
254+
"type": 1,
255+
"name": "r_ydqb51",
256+
"color": "#06FBF2",
257+
"attribute_groups": [
258+
{
259+
"createdAt": "2025-02-28T07:47:01.000Z",
260+
"updatedAt": "2025-02-28T07:47:01.000Z",
261+
"id": 5417159,
262+
"group_type": "numeric",
263+
"class_id": 5566582,
264+
"name": "value_r_ydqb51",
265+
"attributes": []
266+
}
267+
]
268+
}
269+
]

tests/integration/items/test_get_item_metadata.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class TestGetEntityMetadataVector(BaseTestCase):
2020
EXPECTED_ITEM_METADATA = {
2121
"name": "example_image_1.jpg",
2222
"path": "TestGetEntityMetadataVector",
23+
"folder_id": None,
2324
"url": None,
2425
"annotator_email": None,
2526
"qa_email": None,

tests/integration/work_management/test_user_scoring.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ def test_set_get_scores_negative_cases(self):
251251
)
252252

253253
# case with duplicated acore names
254-
with self.assertRaisesRegexp(AppException, "Component IDs in scores data must be unique."):
254+
with self.assertRaisesRegexp(
255+
AppException, "Component IDs in scores data must be unique."
256+
):
255257
sa.set_user_scores(
256258
project=self.PROJECT_NAME,
257259
item=item_name,

0 commit comments

Comments
 (0)