From a56f281859899b0d8724cd7bf6547a203d530527 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 29 Sep 2022 12:10:31 +0200 Subject: [PATCH 1/2] Improve iterable typing (2) --- homeassistant/components/homekit/__init__.py | 2 +- homeassistant/components/lifx/discovery.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index ee53c6da6658b5..c203d674710ad6 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -489,7 +489,7 @@ def __init__( advertise_ip: str | None, entry_id: str, entry_title: str, - devices: Iterable[str] | None = None, + devices: list[str] | None = None, ) -> None: """Initialize a HomeKit object.""" self.hass = hass diff --git a/homeassistant/components/lifx/discovery.py b/homeassistant/components/lifx/discovery.py index 6e1507c92ca7f9..2689feb2d1abc9 100644 --- a/homeassistant/components/lifx/discovery.py +++ b/homeassistant/components/lifx/discovery.py @@ -2,7 +2,7 @@ from __future__ import annotations import asyncio -from collections.abc import Iterable +from collections.abc import Iterable, ValuesView from aiolifx.aiolifx import LifxDiscovery, Light, ScanManager @@ -17,7 +17,7 @@ DEFAULT_TIMEOUT = 8.5 -async def async_discover_devices(hass: HomeAssistant) -> Iterable[Light]: +async def async_discover_devices(hass: HomeAssistant) -> ValuesView[Light]: """Discover lifx devices.""" all_lights: dict[str, Light] = {} broadcast_addrs = await network.async_get_ipv4_broadcast_addresses(hass) From caee6bed67f3c5488190fde679fbe6b01288ba98 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 29 Sep 2022 15:52:14 +0200 Subject: [PATCH 2/2] Use collection --- homeassistant/components/lifx/discovery.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/lifx/discovery.py b/homeassistant/components/lifx/discovery.py index 2689feb2d1abc9..a4072ee23effbb 100644 --- a/homeassistant/components/lifx/discovery.py +++ b/homeassistant/components/lifx/discovery.py @@ -2,7 +2,7 @@ from __future__ import annotations import asyncio -from collections.abc import Iterable, ValuesView +from collections.abc import Collection, Iterable from aiolifx.aiolifx import LifxDiscovery, Light, ScanManager @@ -17,7 +17,7 @@ DEFAULT_TIMEOUT = 8.5 -async def async_discover_devices(hass: HomeAssistant) -> ValuesView[Light]: +async def async_discover_devices(hass: HomeAssistant) -> Collection[Light]: """Discover lifx devices.""" all_lights: dict[str, Light] = {} broadcast_addrs = await network.async_get_ipv4_broadcast_addresses(hass)