From 96928b581401f43c877f418b9f740bdbda962395 Mon Sep 17 00:00:00 2001 From: Vladimir Korsakov Date: Sat, 9 Mar 2024 20:28:14 +0300 Subject: [PATCH 1/2] Fix typehint for start_data property --- src/aiogram_dialog/api/protocols/manager.py | 2 +- src/aiogram_dialog/manager/manager.py | 2 +- src/aiogram_dialog/manager/sub_manager.py | 2 +- src/aiogram_dialog/tools/preview.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/aiogram_dialog/api/protocols/manager.py b/src/aiogram_dialog/api/protocols/manager.py index 824ebe52..73defde8 100644 --- a/src/aiogram_dialog/api/protocols/manager.py +++ b/src/aiogram_dialog/api/protocols/manager.py @@ -92,7 +92,7 @@ def dialog_data(self) -> Dict: @property @abstractmethod - def start_data(self) -> Dict: + def start_data(self) -> Data: """Start data for current context.""" raise NotImplementedError diff --git a/src/aiogram_dialog/manager/manager.py b/src/aiogram_dialog/manager/manager.py index 687294ef..ed4fd11c 100644 --- a/src/aiogram_dialog/manager/manager.py +++ b/src/aiogram_dialog/manager/manager.py @@ -74,7 +74,7 @@ def dialog_data(self) -> Dict: return self.current_context().dialog_data @property - def start_data(self) -> Dict: + def start_data(self) -> Data: """Start data for current context.""" return self.current_context().start_data diff --git a/src/aiogram_dialog/manager/sub_manager.py b/src/aiogram_dialog/manager/sub_manager.py index 592f2991..82f2a2d0 100644 --- a/src/aiogram_dialog/manager/sub_manager.py +++ b/src/aiogram_dialog/manager/sub_manager.py @@ -40,7 +40,7 @@ def dialog_data(self) -> Dict: return self.current_context().dialog_data @property - def start_data(self) -> Dict: + def start_data(self) -> Data: """Start data for current context.""" return self.manager.start_data diff --git a/src/aiogram_dialog/tools/preview.py b/src/aiogram_dialog/tools/preview.py index db22caae..07343c90 100644 --- a/src/aiogram_dialog/tools/preview.py +++ b/src/aiogram_dialog/tools/preview.py @@ -179,7 +179,7 @@ async def mark_closed(self) -> None: pass @property - def start_data(self) -> Dict: + def start_data(self) -> Data: return {} @property From 27386cab7bca6b648873119fc117cd0c2118095c Mon Sep 17 00:00:00 2001 From: Vladimir Korsakov Date: Sat, 9 Mar 2024 20:35:54 +0300 Subject: [PATCH 2/2] Fix typehint for start_data in internals --- src/aiogram_dialog/api/protocols/dialog.py | 2 +- src/aiogram_dialog/dialog.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aiogram_dialog/api/protocols/dialog.py b/src/aiogram_dialog/api/protocols/dialog.py index 25d81873..40fac5cc 100644 --- a/src/aiogram_dialog/api/protocols/dialog.py +++ b/src/aiogram_dialog/api/protocols/dialog.py @@ -37,7 +37,7 @@ async def process_close( async def process_start( self, manager: "DialogManager", - start_data: Any, + start_data: Data, state: Optional[State] = None, ) -> None: raise NotImplementedError diff --git a/src/aiogram_dialog/dialog.py b/src/aiogram_dialog/dialog.py index 64b4e563..bb6932b4 100644 --- a/src/aiogram_dialog/dialog.py +++ b/src/aiogram_dialog/dialog.py @@ -84,7 +84,7 @@ def states(self) -> List[State]: async def process_start( self, manager: DialogManager, - start_data: Any, + start_data: Data, state: Optional[State] = None, ) -> None: if state is None: