From d69e76307f46e9ed3c49b3492843c9389c744890 Mon Sep 17 00:00:00 2001 From: asimaranov Date: Thu, 16 Dec 2021 20:24:50 +0300 Subject: [PATCH] Added missed type annotations --- aiogram/dispatcher/fsm/storage/mongo.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aiogram/dispatcher/fsm/storage/mongo.py b/aiogram/dispatcher/fsm/storage/mongo.py index be288350..0d1dd5c1 100644 --- a/aiogram/dispatcher/fsm/storage/mongo.py +++ b/aiogram/dispatcher/fsm/storage/mongo.py @@ -63,8 +63,8 @@ class MongoStorage(BaseStorage): with_destiny=with_destiny ) - def _get_db_filter(self, key: StorageKey): - db_filter = {'chat': key.chat_id, 'user': key.user_id} + def _get_db_filter(self, key: StorageKey) -> Dict[str, Any]: + db_filter: Dict[str, Any] = {'chat': key.chat_id, 'user': key.user_id} if self._with_bot_id: db_filter['bot_id'] = key.bot_id @@ -134,8 +134,8 @@ class MongoStorage(BaseStorage): bot: Bot, key: StorageKey, ) -> Dict[str, Any]: - result = await self._db[DATA].find_one( + result: Optional[Dict[str, Dict[str, Any]]] = await self._db[DATA].find_one( filter=self._get_db_filter(key) ) - return result.get('data') if result else {} + return result.get('data', default={}) if result else {}