Correct typing in Insteon and activate mypy (#53222)

This commit is contained in:
jan iversen 2021-07-20 17:26:00 +02:00 committed by GitHub
parent c578541a82
commit f819be7acc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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):

View file

@ -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

View file

@ -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.*",