cleaned optional not used

This commit is contained in:
Yannick Stephan
2025-02-09 10:33:15 +01:00
parent d267f06602
commit 31fe96d74a
7 changed files with 32 additions and 59 deletions

View File

@@ -32,10 +32,10 @@ class MongoKVStorage(BaseKVStorage):
async def all_keys(self) -> list[str]:
return [x["_id"] for x in self._data.find({}, {"_id": 1})]
async def get_by_id(self, id: str) -> Union[dict[str, Any], None]:
async def get_by_id(self, id: str) -> dict[str, Any]:
return self._data.find_one({"_id": id})
async def get_by_ids(self, ids: list[str]) -> list[Union[dict[str, Any], None]]:
async def get_by_ids(self, ids: list[str]) -> list[dict[str, Any]]:
return list(self._data.find({"_id": {"$in": ids}}))
async def filter_keys(self, data: list[str]) -> set[str]:
@@ -77,7 +77,7 @@ class MongoKVStorage(BaseKVStorage):
"""Drop the collection"""
await self._data.drop()
async def get_by_status_and_ids(
async def get_by_status(
self, status: str
) -> Union[list[dict[str, Any]], None]:
"""Get documents by status and ids"""