File tree Expand file tree Collapse file tree 4 files changed +7
-45
lines changed
Expand file tree Collapse file tree 4 files changed +7
-45
lines changed Original file line number Diff line number Diff line change @@ -331,15 +331,6 @@ async def list_small_annotations(
331331 ) -> List [dict ]:
332332 raise NotImplementedError
333333
334- @abstractmethod
335- def sort_items_by_size (
336- self ,
337- project : entities .ProjectEntity ,
338- folder : entities .FolderEntity ,
339- item_ids : List [int ],
340- ) -> Dict [str , List ]:
341- raise NotImplementedError
342-
343334 @abstractmethod
344335 def get_upload_chunks (
345336 self ,
Original file line number Diff line number Diff line change @@ -1737,7 +1737,6 @@ def execute(self):
17371737 )
17381738 )
17391739 except Exception as e :
1740- raise e
17411740 logger .error (e )
17421741 self ._response .errors = AppException ("Can't get annotations." )
17431742 return self ._response
Original file line number Diff line number Diff line change @@ -153,35 +153,6 @@ async def list_small_annotations(
153153 params = query_params ,
154154 )
155155
156- def sort_items_by_size (
157- self ,
158- project : entities .ProjectEntity ,
159- folder : entities .FolderEntity ,
160- item_ids : List [int ],
161- ) -> Dict [str , List ]:
162- chunk_size = 2000
163- query_params = {
164- "project_id" : project .id ,
165- "folder_id" : folder .id ,
166- }
167-
168- response_data = {"small" : [], "large" : []}
169- for i in range (0 , len (item_ids ), chunk_size ):
170- body = {
171- "item_ids" : item_ids [i : i + chunk_size ], # noqa
172- } # noqa
173- response = self .client .request (
174- url = urljoin (self .assets_provider_url , self .URL_CLASSIFY_ITEM_SIZE ),
175- method = "POST" ,
176- params = query_params ,
177- data = body ,
178- )
179- if not response .ok :
180- raise AppException (response .error )
181- response_data ["small" ].extend (response .data .get ("small" , []))
182- response_data ["large" ].extend (response .data .get ("large" , []))
183- return response_data
184-
185156 def get_upload_chunks (
186157 self ,
187158 project : entities .ProjectEntity ,
Original file line number Diff line number Diff line change 33
44from superannotate import SAClient
55
6-
76sa = SAClient ()
87
98
@@ -58,24 +57,26 @@ async def _test():
5857 asyncio .run (_test ())
5958
6059 def test_create_task_get_annotations_in_running_event_loop (self ):
61- async def _test ():
62- task1 = asyncio .create_task (self .nested ())
63- task2 = asyncio .create_task (self .nested ())
64- await task1
65- await task2
60+ async def _test ():
61+ task1 = asyncio .create_task (self .nested ())
62+ task2 = asyncio .create_task (self .nested ())
63+ await task1
64+ await task2
6665
6766 asyncio .run (_test ())
6867
6968 def test_gather_get_annotations_in_running_event_loop (self ):
7069 async def gather_test ():
7170 await asyncio .gather (self .nested (), self .nested ())
71+
7272 asyncio .run (gather_test ())
7373
7474 def test_gather_async_for (self ):
7575 async def gather_test ():
7676 async for _ in DummyIterator (delay = 0.01 , to = 2 ):
7777 annotations = sa .get_annotations (TestAsyncFunctions .PROJECT_NAME )
7878 assert len (annotations ) == 4
79+
7980 asyncio .run (gather_test ())
8081
8182 def test_upload_annotations_in_running_event_loop (self ):
You can’t perform that action at this time.
0 commit comments