Improve typing in core service registration (#63005)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-30 21:18:10 +01:00 committed by GitHub
parent 1320f27fd7
commit 9971831b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -1330,7 +1330,7 @@ class ServiceRegistry:
self,
domain: str,
service: str,
service_func: Callable,
service_func: Callable[[ServiceCall], Awaitable[None] | None],
schema: vol.Schema | None = None,
) -> None:
"""
@ -1347,7 +1347,7 @@ class ServiceRegistry:
self,
domain: str,
service: str,
service_func: Callable,
service_func: Callable[[ServiceCall], Awaitable[None] | None],
schema: vol.Schema | None = None,
) -> None:
"""

View file

@ -198,7 +198,7 @@ class EntityComponent:
if isinstance(schema, dict):
schema = cv.make_entity_service_schema(schema)
async def handle_service(call: Callable) -> None:
async def handle_service(call: ServiceCall) -> None:
"""Handle the service."""
await self.hass.helpers.service.entity_service_call(
self._platforms.values(), func, call, required_features

View file

@ -716,7 +716,7 @@ def async_register_admin_service(
hass: HomeAssistant,
domain: str,
service: str,
service_func: Callable[[ServiceCall], Awaitable | None],
service_func: Callable[[ServiceCall], Awaitable[None] | None],
schema: vol.Schema = vol.Schema({}, extra=vol.PREVENT_EXTRA),
) -> None:
"""Register a service that requires admin access."""