from _typeshed import Incomplete
from collections.abc import Callable, Coroutine
from dataclasses import dataclass
from homeassistant.core import HassJob as HassJob, HomeAssistant as HomeAssistant, callback as callback
from homeassistant.loader import bind_hass as bind_hass
from homeassistant.util.async_ import run_callback_threadsafe as run_callback_threadsafe
from homeassistant.util.logging import catch_log_exception as catch_log_exception
from typing import Any, Generic, TypeVarTuple, overload

_Ts = TypeVarTuple('_Ts')
_LOGGER: Incomplete
DATA_DISPATCHER: str

@dataclass(frozen=True)
class SignalType(Generic[*_Ts]):
    name: str
    def __hash__(self) -> int: ...
    def __eq__(self, other: Any) -> bool: ...
    def __init__(self, name) -> None: ...

_DispatcherDataType: Incomplete

@overload
def dispatcher_connect(hass: HomeAssistant, signal: SignalType[Unpack[_Ts]], target: Callable[[Unpack[_Ts]], None]) -> Callable[[], None]: ...
@overload
def dispatcher_connect(hass: HomeAssistant, signal: str, target: Callable[..., None]) -> Callable[[], None]: ...
def _async_remove_dispatcher(dispatchers: _DispatcherDataType[Unpack[_Ts]], signal: SignalType[Unpack[_Ts]] | str, target: Callable[[Unpack[_Ts]], Any] | Callable[..., Any]) -> None: ...
@overload
def async_dispatcher_connect(hass: HomeAssistant, signal: SignalType[Unpack[_Ts]], target: Callable[[Unpack[_Ts]], Any]) -> Callable[[], None]: ...
@overload
def async_dispatcher_connect(hass: HomeAssistant, signal: str, target: Callable[..., Any]) -> Callable[[], None]: ...
@overload
def dispatcher_send(hass: HomeAssistant, signal: SignalType[Unpack[_Ts]], *args: Unpack[_Ts]) -> None: ...
@overload
def dispatcher_send(hass: HomeAssistant, signal: str, *args: Any) -> None: ...
def _format_err(signal: SignalType[Unpack[_Ts]] | str, target: Callable[[Unpack[_Ts]], Any] | Callable[..., Any], *args: Any) -> str: ...
def _generate_job(signal: SignalType[Unpack[_Ts]] | str, target: Callable[[Unpack[_Ts]], Any] | Callable[..., Any]) -> HassJob[..., None | Coroutine[Any, Any, None]]: ...
@overload
def async_dispatcher_send(hass: HomeAssistant, signal: SignalType[Unpack[_Ts]], *args: Unpack[_Ts]) -> None: ...
@overload
def async_dispatcher_send(hass: HomeAssistant, signal: str, *args: Any) -> None: ...
