mirror of https://github.com/home-assistant/core
Enable strict typing for apcupsd (#84861)
This commit is contained in:
parent
7abff358a5
commit
06095b1fec
|
@ -58,6 +58,7 @@ homeassistant.components.amcrest.*
|
||||||
homeassistant.components.ampio.*
|
homeassistant.components.ampio.*
|
||||||
homeassistant.components.analytics.*
|
homeassistant.components.analytics.*
|
||||||
homeassistant.components.anthemav.*
|
homeassistant.components.anthemav.*
|
||||||
|
homeassistant.components.apcupsd.*
|
||||||
homeassistant.components.aqualogic.*
|
homeassistant.components.aqualogic.*
|
||||||
homeassistant.components.aseko_pool_live.*
|
homeassistant.components.aseko_pool_live.*
|
||||||
homeassistant.components.asuswrt.*
|
homeassistant.components.asuswrt.*
|
||||||
|
|
|
@ -62,7 +62,7 @@ class APCUPSdData:
|
||||||
"""Initialize the data object."""
|
"""Initialize the data object."""
|
||||||
self._host = host
|
self._host = host
|
||||||
self._port = port
|
self._port = port
|
||||||
self.status: dict[str, Any] = {}
|
self.status: dict[str, str] = {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str | None:
|
def name(self) -> str | None:
|
||||||
|
@ -100,7 +100,7 @@ class APCUPSdData:
|
||||||
return self.status.get("STATFLAG")
|
return self.status.get("STATFLAG")
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def update(self, **kwargs):
|
def update(self, **kwargs: Any) -> None:
|
||||||
"""Fetch the latest status from APCUPSd.
|
"""Fetch the latest status from APCUPSd.
|
||||||
|
|
||||||
Note that the result dict uses upper case for each resource, where our
|
Note that the result dict uses upper case for each resource, where our
|
||||||
|
|
|
@ -465,7 +465,7 @@ async def async_setup_entry(
|
||||||
async_add_entities(entities, update_before_add=True)
|
async_add_entities(entities, update_before_add=True)
|
||||||
|
|
||||||
|
|
||||||
def infer_unit(value):
|
def infer_unit(value: str) -> tuple[str, str | None]:
|
||||||
"""If the value ends with any of the units from ALL_UNITS.
|
"""If the value ends with any of the units from ALL_UNITS.
|
||||||
|
|
||||||
Split the unit off the end of the value and return the value, unit tuple
|
Split the unit off the end of the value and return the value, unit tuple
|
||||||
|
|
10
mypy.ini
10
mypy.ini
|
@ -333,6 +333,16 @@ disallow_untyped_defs = true
|
||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
|
|
||||||
|
[mypy-homeassistant.components.apcupsd.*]
|
||||||
|
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.aqualogic.*]
|
[mypy-homeassistant.components.aqualogic.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
|
Loading…
Reference in New Issue