Correct typing in Insteon and activate mypy (#53222)
This commit is contained in:
parent
c578541a82
commit
f819be7acc
5 changed files with 5 additions and 7 deletions
|
@ -1,4 +1,6 @@
|
|||
"""Support for INSTEON fans via PowerLinc Modem."""
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
|
||||
from homeassistant.components.fan import (
|
||||
|
@ -39,7 +41,7 @@ class InsteonFanEntity(InsteonEntity, FanEntity):
|
|||
"""An INSTEON fan entity."""
|
||||
|
||||
@property
|
||||
def percentage(self) -> int:
|
||||
def percentage(self) -> int | None:
|
||||
"""Return the current speed percentage."""
|
||||
if self._insteon_device_group.value is None:
|
||||
return None
|
||||
|
|
|
@ -110,4 +110,4 @@ def get_device_platforms(device):
|
|||
|
||||
def get_platform_groups(device, domain) -> dict:
|
||||
"""Return the platforms that a device belongs in."""
|
||||
return DEVICE_PLATFORM.get(type(device), {}).get(domain, {})
|
||||
return DEVICE_PLATFORM.get(type(device), {}).get(domain, {}) # type: ignore
|
||||
|
|
|
@ -161,7 +161,7 @@ TRIGGER_SCENE_SCHEMA = vol.Schema(
|
|||
ADD_DEFAULT_LINKS_SCHEMA = vol.Schema({vol.Required(CONF_ENTITY_ID): cv.entity_id})
|
||||
|
||||
|
||||
def normalize_byte_entry_to_int(entry: [int, bytes, str]):
|
||||
def normalize_byte_entry_to_int(entry: int | bytes | str):
|
||||
"""Format a hex entry value."""
|
||||
if isinstance(entry, int):
|
||||
if entry in range(0, 256):
|
||||
|
|
3
mypy.ini
3
mypy.ini
|
@ -1277,9 +1277,6 @@ ignore_errors = true
|
|||
[mypy-homeassistant.components.input_number.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.insteon.*]
|
||||
ignore_errors = true
|
||||
|
||||
[mypy-homeassistant.components.ipp.*]
|
||||
ignore_errors = true
|
||||
|
||||
|
|
|
@ -84,7 +84,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
|||
"homeassistant.components.influxdb.*",
|
||||
"homeassistant.components.input_datetime.*",
|
||||
"homeassistant.components.input_number.*",
|
||||
"homeassistant.components.insteon.*",
|
||||
"homeassistant.components.ipp.*",
|
||||
"homeassistant.components.isy994.*",
|
||||
"homeassistant.components.izone.*",
|
||||
|
|
Loading…
Add table
Reference in a new issue