Improve ReloadServiceHelper typing (#117552)

This commit is contained in:
Marc Mueller 2024-05-16 12:47:43 +02:00 committed by GitHub
parent 9d10e42d79
commit ab07bc5298
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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."""