Enable strict typing for anel_pwrctrl (#106821)

This commit is contained in:
Marc Mueller 2024-01-01 20:14:34 +01:00 committed by GitHub
parent c37e268030
commit 06a5e25853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -65,6 +65,7 @@ homeassistant.components.ampio.*
homeassistant.components.analytics.*
homeassistant.components.android_ip_webcam.*
homeassistant.components.androidtv_remote.*
homeassistant.components.anel_pwrctrl.*
homeassistant.components.anova.*
homeassistant.components.anthemav.*
homeassistant.components.apcupsd.*

View File

@ -5,7 +5,7 @@ from datetime import timedelta
import logging
from typing import Any
from anel_pwrctrl import DeviceMaster
from anel_pwrctrl import Device, DeviceMaster, Switch
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
@ -72,7 +72,7 @@ def setup_platform(
class PwrCtrlSwitch(SwitchEntity):
"""Representation of a PwrCtrl switch."""
def __init__(self, port, parent_device):
def __init__(self, port: Switch, parent_device: PwrCtrlDevice) -> None:
"""Initialize the PwrCtrl switch."""
self._port = port
self._parent_device = parent_device
@ -96,11 +96,11 @@ class PwrCtrlSwitch(SwitchEntity):
class PwrCtrlDevice:
"""Device representation for per device throttling."""
def __init__(self, device):
def __init__(self, device: Device) -> None:
"""Initialize the PwrCtrl device."""
self._device = device
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self):
def update(self) -> None:
"""Update the device and all its switches."""
self._device.update()

View File

@ -410,6 +410,16 @@ disallow_untyped_defs = true
warn_return_any = 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.*]
check_untyped_defs = true
disallow_incomplete_defs = true