diff --git a/.strict-typing b/.strict-typing index 8e6e59c11d6..295a0a352e0 100644 --- a/.strict-typing +++ b/.strict-typing @@ -70,6 +70,7 @@ homeassistant.components.lookin.* homeassistant.components.mailbox.* homeassistant.components.media_player.* homeassistant.components.modbus.* +homeassistant.components.modem_callerid.* homeassistant.components.mysensors.* homeassistant.components.nam.* homeassistant.components.nanoleaf.* diff --git a/homeassistant/components/modem_callerid/config_flow.py b/homeassistant/components/modem_callerid/config_flow.py index fd90f46d94a..da552b26beb 100644 --- a/homeassistant/components/modem_callerid/config_flow.py +++ b/homeassistant/components/modem_callerid/config_flow.py @@ -6,6 +6,7 @@ from typing import Any from phone_modem import DEFAULT_PORT, PhoneModem import serial.tools.list_ports +from serial.tools.list_ports_common import ListPortInfo import voluptuous as vol from homeassistant import config_entries @@ -20,7 +21,7 @@ _LOGGER = logging.getLogger(__name__) DATA_SCHEMA = vol.Schema({"name": str, "device": str}) -def _generate_unique_id(port: Any) -> str: +def _generate_unique_id(port: ListPortInfo) -> str: """Generate unique id from usb attributes.""" return f"{port.vid}:{port.pid}_{port.serial_number}_{port.manufacturer}_{port.description}" diff --git a/homeassistant/components/modem_callerid/sensor.py b/homeassistant/components/modem_callerid/sensor.py index 469e8ecb994..372f9700201 100644 --- a/homeassistant/components/modem_callerid/sensor.py +++ b/homeassistant/components/modem_callerid/sensor.py @@ -63,7 +63,7 @@ async def async_setup_entry( ] ) - async def _async_on_hass_stop(self) -> None: + async def _async_on_hass_stop() -> None: """HA is shutting down, close modem port.""" if hass.data[DOMAIN][entry.entry_id][DATA_KEY_API]: await hass.data[DOMAIN][entry.entry_id][DATA_KEY_API].close() @@ -104,7 +104,7 @@ class ModemCalleridSensor(SensorEntity): await super().async_added_to_hass() @callback - def _async_incoming_call(self, new_state) -> None: + def _async_incoming_call(self, new_state: str) -> None: """Handle new states.""" self._attr_extra_state_attributes = {} if self.api.cid_name: diff --git a/mypy.ini b/mypy.ini index a4740a7fedc..8114e3d39f5 100644 --- a/mypy.ini +++ b/mypy.ini @@ -781,6 +781,17 @@ no_implicit_optional = true warn_return_any = true warn_unreachable = true +[mypy-homeassistant.components.modem_callerid.*] +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +no_implicit_optional = true +warn_return_any = true +warn_unreachable = true + [mypy-homeassistant.components.mysensors.*] check_untyped_defs = true disallow_incomplete_defs = true