From cfd7de1aa4ce309815078b98822bfee366804547 Mon Sep 17 00:00:00 2001 From: Artemy Efimov Date: Mon, 27 May 2024 13:18:05 +0500 Subject: [PATCH 1/2] Change `ApplicationModule._handler` type annotation --- lato/application_module.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lato/application_module.py b/lato/application_module.py index 78ce813..d788646 100644 --- a/lato/application_module.py +++ b/lato/application_module.py @@ -17,7 +17,9 @@ def __init__(self, name: str): :param name: Name of the module """ self.name: str = name - self._handlers: defaultdict[str, OrderedSet[Callable]] = defaultdict(OrderedSet) + self._handlers: defaultdict[HandlerAlias, OrderedSet[Callable]] = defaultdict( + OrderedSet + ) self._submodules: OrderedSet[ApplicationModule] = OrderedSet() @property From 1df4f7497499fc5bbe09c9d254b455e79fdfaab7 Mon Sep 17 00:00:00 2001 From: Artemy Efimov Date: Mon, 27 May 2024 13:18:43 +0500 Subject: [PATCH 2/2] Add return type annotation to `ApplicationModule.handler` method --- lato/application_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lato/application_module.py b/lato/application_module.py index d788646..bb23be5 100644 --- a/lato/application_module.py +++ b/lato/application_module.py @@ -36,7 +36,7 @@ def include_submodule(self, a_module: "ApplicationModule"): ), f"Can only include {ApplicationModule} instances, got {a_module}" self._submodules.add(a_module) - def handler(self, alias: HandlerAlias): + def handler(self, alias: HandlerAlias) -> Callable: """ Decorator for registering a handler. Handler can be aliased by a name or by a message type.