mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Enable strict typing for anel_pwrctrl (#106821)
This commit is contained in:
parent
c37e268030
commit
06a5e25853
@ -65,6 +65,7 @@ homeassistant.components.ampio.*
|
|||||||
homeassistant.components.analytics.*
|
homeassistant.components.analytics.*
|
||||||
homeassistant.components.android_ip_webcam.*
|
homeassistant.components.android_ip_webcam.*
|
||||||
homeassistant.components.androidtv_remote.*
|
homeassistant.components.androidtv_remote.*
|
||||||
|
homeassistant.components.anel_pwrctrl.*
|
||||||
homeassistant.components.anova.*
|
homeassistant.components.anova.*
|
||||||
homeassistant.components.anthemav.*
|
homeassistant.components.anthemav.*
|
||||||
homeassistant.components.apcupsd.*
|
homeassistant.components.apcupsd.*
|
||||||
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from anel_pwrctrl import DeviceMaster
|
from anel_pwrctrl import Device, DeviceMaster, Switch
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
|
||||||
@ -72,7 +72,7 @@ def setup_platform(
|
|||||||
class PwrCtrlSwitch(SwitchEntity):
|
class PwrCtrlSwitch(SwitchEntity):
|
||||||
"""Representation of a PwrCtrl switch."""
|
"""Representation of a PwrCtrl switch."""
|
||||||
|
|
||||||
def __init__(self, port, parent_device):
|
def __init__(self, port: Switch, parent_device: PwrCtrlDevice) -> None:
|
||||||
"""Initialize the PwrCtrl switch."""
|
"""Initialize the PwrCtrl switch."""
|
||||||
self._port = port
|
self._port = port
|
||||||
self._parent_device = parent_device
|
self._parent_device = parent_device
|
||||||
@ -96,11 +96,11 @@ class PwrCtrlSwitch(SwitchEntity):
|
|||||||
class PwrCtrlDevice:
|
class PwrCtrlDevice:
|
||||||
"""Device representation for per device throttling."""
|
"""Device representation for per device throttling."""
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device: Device) -> None:
|
||||||
"""Initialize the PwrCtrl device."""
|
"""Initialize the PwrCtrl device."""
|
||||||
self._device = device
|
self._device = device
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def update(self):
|
def update(self) -> None:
|
||||||
"""Update the device and all its switches."""
|
"""Update the device and all its switches."""
|
||||||
self._device.update()
|
self._device.update()
|
||||||
|
10
mypy.ini
10
mypy.ini
@ -410,6 +410,16 @@ disallow_untyped_defs = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
|
|
||||||
|
[mypy-homeassistant.components.anel_pwrctrl.*]
|
||||||
|
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.anova.*]
|
[mypy-homeassistant.components.anova.*]
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
disallow_incomplete_defs = true
|
disallow_incomplete_defs = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user