Skip to content

Commit 78bb72d

Browse files
committed
remove async in for loop
1 parent 34a8f0b commit 78bb72d

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

astropylibrarian/algolia/client.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,12 @@ async def __aexit__(
8282
await self.algolia_client.close()
8383
self._logger.debug("Finished closing algolia client")
8484

85-
async def browse_objects(
86-
self, browse_params: BrowseParamsObject
87-
) -> BrowseResponse:
85+
async def browse_objects(self, browse_params: BrowseParamsObject) -> BrowseResponse:
8886
return await self.algolia_client.browse_objects(
8987
index_name=self.name, aggregator=None, browse_params=browse_params
9088
)
9189

92-
async def save_objects(
93-
self, objects: list[dict[str, Any]]
94-
) -> list[BatchResponse]:
90+
async def save_objects(self, objects: list[dict[str, Any]]) -> list[BatchResponse]:
9591
return await self.algolia_client.save_objects(self.name, objects)
9692

9793
async def delete_objects(self, objectids: list[str]) -> list[BatchResponse]:
@@ -148,9 +144,7 @@ async def browse_objects(
148144
for _ in range(5):
149145
yield {}
150146

151-
async def delete_objects(
152-
self, objectids: list[str]
153-
) -> list[DeletedAtResponse]:
147+
async def delete_objects(self, objectids: list[str]) -> list[DeletedAtResponse]:
154148
return [DeletedAtResponse(task_id=0, deleted_at="") for _ in objectids]
155149

156150

astropylibrarian/workflows/expirerecords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def expire_old_records(
3636
attributes_to_highlight=[],
3737
)
3838
old_object_ids: List[str] = []
39-
async for r in algolia_index.browse_objects(obj):
39+
for r in algolia_index.browse_objects(obj):
4040
# Double check that we're deleting the right things.
4141
if r["root_url"] != root_url:
4242
logger.warning("root_url does not match: %s", r["baseUrl"])

0 commit comments

Comments
 (0)