@@ -682,11 +682,11 @@ async def add_documents_in_batches(
682682 >>> index = client.index("movies")
683683 >>> await index.add_documents_in_batches(documents)
684684 """
685- if not use_task_groups (): # pragma: no cover
685+ if not use_task_groups ():
686686 batches = [self .add_documents (x , primary_key ) for x in _batch (documents , batch_size )]
687687 return await asyncio .gather (* batches )
688688
689- async with asyncio .TaskGroup () as tg :
689+ async with asyncio .TaskGroup () as tg : # type: ignore[attr-defined]
690690 tasks = [
691691 tg .create_task (self .add_documents (x , primary_key ))
692692 for x in _batch (documents , batch_size )
@@ -756,7 +756,7 @@ async def add_documents_from_directory(
756756
757757 return [response ]
758758
759- if not use_task_groups (): # pragma: no cover
759+ if not use_task_groups ():
760760 add_documents = []
761761 for path in directory .iterdir ():
762762 if path .suffix == f".{ document_type } " :
@@ -777,7 +777,7 @@ async def add_documents_from_directory(
777777
778778 return responses
779779
780- async with asyncio .TaskGroup () as tg :
780+ async with asyncio .TaskGroup () as tg : # type: ignore[attr-defined]
781781 tasks = []
782782 all_results = []
783783 for i , path in enumerate (directory .iterdir ()):
@@ -1122,11 +1122,11 @@ async def update_documents_in_batches(
11221122 >>> index = client.index("movies")
11231123 >>> await index.update_documents_in_batches(documents)
11241124 """
1125- if not use_task_groups : # pragma: no cover
1125+ if not use_task_groups ():
11261126 batches = [self .update_documents (x , primary_key ) for x in _batch (documents , batch_size )]
11271127 return await asyncio .gather (* batches )
11281128
1129- async with asyncio .TaskGroup () as tg :
1129+ async with asyncio .TaskGroup () as tg : # type: ignore[attr-defined]
11301130 tasks = [
11311131 tg .create_task (self .update_documents (x , primary_key ))
11321132 for x in _batch (documents , batch_size )
@@ -1194,7 +1194,7 @@ async def update_documents_from_directory(
11941194 response = await self .update_documents (combined , primary_key )
11951195 return [response ]
11961196
1197- if not use_task_groups (): # pragma: no cover
1197+ if not use_task_groups ():
11981198 update_documents = []
11991199 for path in directory .iterdir ():
12001200 if path .suffix == f".{ document_type } " :
@@ -1214,7 +1214,7 @@ async def update_documents_from_directory(
12141214
12151215 return responses
12161216
1217- async with asyncio .TaskGroup () as tg :
1217+ async with asyncio .TaskGroup () as tg : # type: ignore[attr-defined]
12181218 tasks = []
12191219 results = []
12201220 for i , path in enumerate (directory .iterdir ()):
@@ -1294,7 +1294,7 @@ async def update_documents_from_directory_in_batches(
12941294 combined , batch_size = batch_size , primary_key = primary_key
12951295 )
12961296
1297- if not use_task_groups (): # pragma: no cover
1297+ if not use_task_groups ():
12981298 responses : list [TaskInfo ] = []
12991299
13001300 update_documents = []
@@ -1320,7 +1320,7 @@ async def update_documents_from_directory_in_batches(
13201320
13211321 return responses
13221322
1323- async with asyncio .TaskGroup () as tg :
1323+ async with asyncio .TaskGroup () as tg : # type: ignore[attr-defined]
13241324 results = []
13251325 tasks = []
13261326 for i , path in enumerate (directory .iterdir ()):
@@ -1610,11 +1610,11 @@ async def delete_documents_in_batches_by_filter(
16101610 >>> ]
16111611 >>> )
16121612 """
1613- if not use_task_groups : # pragma: no cover
1613+ if not use_task_groups ():
16141614 tasks = [self .delete_documents_by_filter (filter ) for filter in filters ]
16151615 return await asyncio .gather (* tasks )
16161616
1617- async with asyncio .TaskGroup () as tg :
1617+ async with asyncio .TaskGroup () as tg : # type: ignore[attr-defined]
16181618 tg_tasks = [
16191619 tg .create_task (self .delete_documents_by_filter (filter )) for filter in filters
16201620 ]
0 commit comments