Use PEP 695 for function annotations with scoping (#117787)

This commit is contained in:
Marc Mueller
2024-05-20 12:43:39 +02:00
committed by GitHub
parent f50973c76c
commit 7998f874c0
5 changed files with 14 additions and 23 deletions

View File

@ -129,7 +129,6 @@ FINAL_WRITE_STAGE_SHUTDOWN_TIMEOUT = 60
CLOSE_STAGE_SHUTDOWN_TIMEOUT = 30
_R = TypeVar("_R")
# Internal; not helpers.typing.UNDEFINED due to circular dependency
_UNDEF: dict[Any, Any] = {}
_SENTINEL = object()
@ -693,7 +692,7 @@ class HomeAssistant:
@overload
@callback
def _async_add_hass_job(
def _async_add_hass_job[_R](
self,
hassjob: HassJob[..., Coroutine[Any, Any, _R]],
*args: Any,
@ -702,7 +701,7 @@ class HomeAssistant:
@overload
@callback
def _async_add_hass_job(
def _async_add_hass_job[_R](
self,
hassjob: HassJob[..., Coroutine[Any, Any, _R] | _R],
*args: Any,
@ -710,7 +709,7 @@ class HomeAssistant:
) -> asyncio.Future[_R] | None: ...
@callback
def _async_add_hass_job(
def _async_add_hass_job[_R](
self,
hassjob: HassJob[..., Coroutine[Any, Any, _R] | _R],
*args: Any,
@ -882,7 +881,7 @@ class HomeAssistant:
@overload
@callback
def async_run_hass_job(
def async_run_hass_job[_R](
self,
hassjob: HassJob[..., Coroutine[Any, Any, _R]],
*args: Any,
@ -891,7 +890,7 @@ class HomeAssistant:
@overload
@callback
def async_run_hass_job(
def async_run_hass_job[_R](
self,
hassjob: HassJob[..., Coroutine[Any, Any, _R] | _R],
*args: Any,
@ -899,7 +898,7 @@ class HomeAssistant:
) -> asyncio.Future[_R] | None: ...
@callback
def async_run_hass_job(
def async_run_hass_job[_R](
self,
hassjob: HassJob[..., Coroutine[Any, Any, _R] | _R],
*args: Any,