Enable strict typing for arris_tg2492lg (#106838)

This commit is contained in:
Marc Mueller 2024-01-01 20:47:37 +01:00 committed by GitHub
parent 8501b2e71b
commit 33f8a364ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View File

@ -78,6 +78,7 @@ homeassistant.components.aprs.*
homeassistant.components.aqualogic.* homeassistant.components.aqualogic.*
homeassistant.components.aquostv.* homeassistant.components.aquostv.*
homeassistant.components.aranet.* homeassistant.components.aranet.*
homeassistant.components.arris_tg2492lg.*
homeassistant.components.aruba.* homeassistant.components.aruba.*
homeassistant.components.aseko_pool_live.* homeassistant.components.aseko_pool_live.*
homeassistant.components.assist_pipeline.* homeassistant.components.assist_pipeline.*

View File

@ -40,13 +40,13 @@ class ArrisDeviceScanner(DeviceScanner):
self.connect_box = connect_box self.connect_box = connect_box
self.last_results: list[Device] = [] self.last_results: list[Device] = []
def scan_devices(self): def scan_devices(self) -> list[str]:
"""Scan for new devices and return a list with found device IDs.""" """Scan for new devices and return a list with found device IDs."""
self._update_info() self._update_info()
return [device.mac for device in self.last_results] return [device.mac for device in self.last_results if device.mac]
def get_device_name(self, device): def get_device_name(self, device: str) -> str | None:
"""Return the name of the given device or None if we don't know.""" """Return the name of the given device or None if we don't know."""
name = next( name = next(
(result.hostname for result in self.last_results if result.mac == device), (result.hostname for result in self.last_results if result.mac == device),
@ -54,12 +54,12 @@ class ArrisDeviceScanner(DeviceScanner):
) )
return name return name
def _update_info(self): def _update_info(self) -> None:
"""Ensure the information from the Arris TG2492LG router is up to date.""" """Ensure the information from the Arris TG2492LG router is up to date."""
result = self.connect_box.get_connected_devices() result = self.connect_box.get_connected_devices()
last_results = [] last_results: list[Device] = []
mac_addresses = set() mac_addresses: set[str | None] = set()
for device in result: for device in result:
if device.online and device.mac not in mac_addresses: if device.online and device.mac not in mac_addresses:

View File

@ -540,6 +540,16 @@ disallow_untyped_defs = true
warn_return_any = true warn_return_any = true
warn_unreachable = true warn_unreachable = true
[mypy-homeassistant.components.arris_tg2492lg.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.aruba.*] [mypy-homeassistant.components.aruba.*]
check_untyped_defs = true check_untyped_defs = true
disallow_incomplete_defs = true disallow_incomplete_defs = true