From d565c01569c06bb78bfd0c06d3f9bb45e17d78bc Mon Sep 17 00:00:00 2001 From: darksidecat Date: Sun, 19 Jun 2022 11:05:33 +0300 Subject: [PATCH] full implement deepcopy with memo dict, add typehints --- aiogram/dispatcher/fsm/state.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aiogram/dispatcher/fsm/state.py b/aiogram/dispatcher/fsm/state.py index b1841a4b..8431d744 100644 --- a/aiogram/dispatcher/fsm/state.py +++ b/aiogram/dispatcher/fsm/state.py @@ -1,5 +1,5 @@ import inspect -from typing import Any, Iterator, Optional, Tuple, Type, no_type_check +from typing import Any, Dict, Iterator, Optional, Tuple, Type, no_type_check from ...types import TelegramObject @@ -54,10 +54,11 @@ class State: return True return raw_state == self.state - def __copy__(self): + def __copy__(self) -> "State": return self - def __deepcopy__(self, memo=None): + def __deepcopy__(self, memo: Dict[int, "State"]) -> "State": + memo[id(self)] = self return self