From e9e7b0725268c255987d69a9b6f097dc363cb5d7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 Aug 2025 11:11:54 +0000 Subject: [PATCH] Fix Python 3.12 compatibility by converting PEP 695 syntax to traditional Generic syntax Co-authored-by: frenck <195327+frenck@users.noreply.github.com> --- homeassistant/helpers/update_coordinator.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/homeassistant/helpers/update_coordinator.py b/homeassistant/helpers/update_coordinator.py index 16f3b9b6964..3a0865e1cbb 100644 --- a/homeassistant/helpers/update_coordinator.py +++ b/homeassistant/helpers/update_coordinator.py @@ -36,7 +36,9 @@ from .typing import UNDEFINED, UndefinedType REQUEST_REFRESH_DEFAULT_COOLDOWN = 10 REQUEST_REFRESH_DEFAULT_IMMEDIATE = True -_DataT = TypeVar("_DataT", default=dict[str, Any]) +_DataT = TypeVar("_DataT") +_BaseDataUpdateCoordinatorT = TypeVar("_BaseDataUpdateCoordinatorT") +_DataUpdateCoordinatorT = TypeVar("_DataUpdateCoordinatorT") class UpdateFailed(HomeAssistantError): @@ -539,9 +541,7 @@ class TimestampDataUpdateCoordinator(DataUpdateCoordinator[_DataT]): self.last_update_success_time = utcnow() -class BaseCoordinatorEntity[ - _BaseDataUpdateCoordinatorT: BaseDataUpdateCoordinatorProtocol -](entity.Entity): +class BaseCoordinatorEntity(entity.Entity, Generic[_BaseDataUpdateCoordinatorT]): """Base class for all Coordinator entities.""" def __init__( @@ -578,11 +578,7 @@ class BaseCoordinatorEntity[ """ -class CoordinatorEntity[ - _DataUpdateCoordinatorT: DataUpdateCoordinator[Any] = DataUpdateCoordinator[ - dict[str, Any] - ] -](BaseCoordinatorEntity[_DataUpdateCoordinatorT]): +class CoordinatorEntity(BaseCoordinatorEntity[_DataUpdateCoordinatorT], Generic[_DataUpdateCoordinatorT]): """A class for entities using DataUpdateCoordinator.""" def __init__(