diff --git a/devolo_plc_api/device.py b/devolo_plc_api/device.py index 4bf31a9..4bfdec8 100644 --- a/devolo_plc_api/device.py +++ b/devolo_plc_api/device.py @@ -171,12 +171,12 @@ async def _get_relevant_interfaces(self) -> list[str]: interface: list[str] = [] for adapter in get_adapters(): interface.extend( - cast(str, ip.ip) + cast("str", ip.ip) for ip in adapter.ips if ip.is_IPv4 and ip_address(self.ip) in ip_network(f"{ip.ip}/{ip.network_prefix}", strict=False) ) interface.extend( - cast(str, ip.ip[0]) + cast("str", ip.ip[0]) for ip in adapter.ips if ip.is_IPv6 and ip_address(self.ip) in ip_network(f"{ip.ip[0]}/{ip.network_prefix}", strict=False) ) diff --git a/devolo_plc_api/network/__init__.py b/devolo_plc_api/network/__init__.py index 88eab51..b741624 100644 --- a/devolo_plc_api/network/__init__.py +++ b/devolo_plc_api/network/__init__.py @@ -1,4 +1,5 @@ """Discover devices in your network.""" + from __future__ import annotations import asyncio @@ -69,6 +70,6 @@ def _interfaces() -> list[str]: """Get IP addresses not being localhost.""" interface: list[str] = [] for adapter in get_adapters(): - interface.extend(cast(str, ip.ip) for ip in adapter.ips if ip.is_IPv4 and ip.ip != "127.0.0.1") - interface.extend(cast(str, ip.ip[0]) for ip in adapter.ips if ip.is_IPv6 and ip.ip[0] != "::1") + interface.extend(cast("str", ip.ip) for ip in adapter.ips if ip.is_IPv4 and ip.ip != "127.0.0.1") + interface.extend(cast("str", ip.ip[0]) for ip in adapter.ips if ip.is_IPv6 and ip.ip[0] != "::1") return interface