From 9af5e838c68000730b2781b39d87c5dcb1a0f504 Mon Sep 17 00:00:00 2001 From: tronikos Date: Thu, 9 Nov 2023 03:31:12 -0800 Subject: [PATCH] Add type annotation for service functions with response (#102813) Co-authored-by: Martin Hjelmare --- homeassistant/core.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/homeassistant/core.py b/homeassistant/core.py index ab0fa3b6892..d174786d968 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -1773,7 +1773,10 @@ class Service: self, func: Callable[ [ServiceCall], - Coroutine[Any, Any, ServiceResponse | EntityServiceResponse] | None, + Coroutine[Any, Any, ServiceResponse | EntityServiceResponse] + | ServiceResponse + | EntityServiceResponse + | None, ], schema: vol.Schema | None, domain: str, @@ -1865,7 +1868,7 @@ class ServiceRegistry: service: str, service_func: Callable[ [ServiceCall], - Coroutine[Any, Any, ServiceResponse] | None, + Coroutine[Any, Any, ServiceResponse] | ServiceResponse | None, ], schema: vol.Schema | None = None, ) -> None: @@ -1884,7 +1887,10 @@ class ServiceRegistry: service: str, service_func: Callable[ [ServiceCall], - Coroutine[Any, Any, ServiceResponse | EntityServiceResponse] | None, + Coroutine[Any, Any, ServiceResponse | EntityServiceResponse] + | ServiceResponse + | EntityServiceResponse + | None, ], schema: vol.Schema | None = None, supports_response: SupportsResponse = SupportsResponse.NONE,