Improve async_track_template_result callback typing (#97135)

This commit is contained in:
Marc Mueller 2023-07-24 12:42:17 +02:00 committed by GitHub
parent c0da6b822e
commit 582499a260
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 228 additions and 72 deletions

View file

@ -26,6 +26,7 @@ from homeassistant.exceptions import (
from homeassistant.helpers import config_validation as cv, entity, template
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.event import (
EventStateChangedData,
TrackTemplate,
TrackTemplateResult,
async_track_template_result,
@ -37,6 +38,7 @@ from homeassistant.helpers.json import (
json_dumps,
)
from homeassistant.helpers.service import async_get_all_descriptions
from homeassistant.helpers.typing import EventType
from homeassistant.loader import (
Integration,
IntegrationNotFound,
@ -535,7 +537,8 @@ async def handle_render_template(
@callback
def _template_listener(
event: Event | None, updates: list[TrackTemplateResult]
event: EventType[EventStateChangedData] | None,
updates: list[TrackTemplateResult],
) -> None:
nonlocal info
track_template_result = updates.pop()