From 19ea95a6e4f210bb18c3606a7763c309ee35c113 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 15 Sep 2022 11:29:11 +0200 Subject: [PATCH] Enable disallow-any-generics in update (#78501) --- homeassistant/components/update/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/update/__init__.py b/homeassistant/components/update/__init__.py index 6cc03700ed8..9ec748c1ed5 100644 --- a/homeassistant/components/update/__init__.py +++ b/homeassistant/components/update/__init__.py @@ -73,10 +73,12 @@ __all__ = [ "UpdateEntityFeature", ] +# mypy: disallow-any-generics + async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up Select entities.""" - component = hass.data[DOMAIN] = EntityComponent( + component = hass.data[DOMAIN] = EntityComponent[UpdateEntity]( _LOGGER, DOMAIN, hass, SCAN_INTERVAL ) await component.async_setup(config) @@ -109,13 +111,13 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up a config entry.""" - component: EntityComponent = hass.data[DOMAIN] + component: EntityComponent[UpdateEntity] = hass.data[DOMAIN] return await component.async_setup_entry(entry) async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" - component: EntityComponent = hass.data[DOMAIN] + component: EntityComponent[UpdateEntity] = hass.data[DOMAIN] return await component.async_unload_entry(entry) @@ -437,11 +439,11 @@ class UpdateEntity(RestoreEntity): async def websocket_release_notes( hass: HomeAssistant, connection: websocket_api.connection.ActiveConnection, - msg: dict, + msg: dict[str, Any], ) -> None: """Get the full release notes for a entity.""" - component = hass.data[DOMAIN] - entity: UpdateEntity | None = component.get_entity(msg["entity_id"]) + component: EntityComponent[UpdateEntity] = hass.data[DOMAIN] + entity = component.get_entity(msg["entity_id"]) if entity is None: connection.send_error(