mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Improve ReloadServiceHelper typing (#117552)
This commit is contained in:
parent
9d10e42d79
commit
ab07bc5298
@ -3,13 +3,13 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections.abc import Awaitable, Callable, Iterable
|
from collections.abc import Awaitable, Callable, Coroutine, Iterable
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from functools import cache, partial
|
from functools import cache, partial
|
||||||
import logging
|
import logging
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import TYPE_CHECKING, Any, TypedDict, TypeGuard, TypeVar, cast
|
from typing import TYPE_CHECKING, Any, Generic, TypedDict, TypeGuard, TypeVar, cast
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -1156,7 +1156,7 @@ def verify_domain_control(
|
|||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
class ReloadServiceHelper:
|
class ReloadServiceHelper(Generic[_T]):
|
||||||
"""Helper for reload services.
|
"""Helper for reload services.
|
||||||
|
|
||||||
The helper has the following purposes:
|
The helper has the following purposes:
|
||||||
@ -1166,7 +1166,7 @@ class ReloadServiceHelper:
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
service_func: Callable[[ServiceCall], Awaitable],
|
service_func: Callable[[ServiceCall], Coroutine[Any, Any, Any]],
|
||||||
reload_targets_func: Callable[[ServiceCall], set[_T]],
|
reload_targets_func: Callable[[ServiceCall], set[_T]],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize ReloadServiceHelper."""
|
"""Initialize ReloadServiceHelper."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user