Add strict typing to Vodafone Station (#139573)

pull/139444/head^2
Simone Chemelli 2025-03-01 14:22:14 +01:00 committed by GitHub
parent 91eba0855e
commit 679b57e450
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 2 deletions

View File

@ -528,6 +528,7 @@ homeassistant.components.vallox.*
homeassistant.components.valve.*
homeassistant.components.velbus.*
homeassistant.components.vlc_telnet.*
homeassistant.components.vodafone_station.*
homeassistant.components.wake_on_lan.*
homeassistant.components.wake_word.*
homeassistant.components.wallbox.*

View File

@ -3,7 +3,7 @@
from dataclasses import dataclass
from datetime import datetime, timedelta
from json.decoder import JSONDecodeError
from typing import Any
from typing import Any, cast
from aiovodafone import VodafoneStationDevice, VodafoneStationSercommApi, exceptions
@ -164,7 +164,7 @@ class VodafoneStationRouter(DataUpdateCoordinator[UpdateCoordinatorDataType]):
@property
def serial_number(self) -> str:
"""Device serial number."""
return self.data.sensors["sys_serial_number"]
return cast(str, self.data.sensors["sys_serial_number"])
@property
def device_info(self) -> DeviceInfo:

10
mypy.ini generated
View File

@ -5039,6 +5039,16 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.vodafone_station.*]
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.wake_on_lan.*]
check_untyped_defs = true
disallow_incomplete_defs = true