mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 23:41:48 -05:00
Enable strict-typing for Midea (#181775)
This commit is contained in:
@@ -390,6 +390,7 @@ homeassistant.components.media_player.*
|
||||
homeassistant.components.media_source.*
|
||||
homeassistant.components.met_eireann.*
|
||||
homeassistant.components.metoffice.*
|
||||
homeassistant.components.midea.*
|
||||
homeassistant.components.miele.*
|
||||
homeassistant.components.mikrotik.*
|
||||
homeassistant.components.min_max.*
|
||||
|
||||
@@ -77,7 +77,7 @@ def _select_and_connect(
|
||||
|
||||
Returns None if there is no device implementation for device_type.
|
||||
"""
|
||||
dm = device_selector(
|
||||
dm: MideaDevice | None = device_selector(
|
||||
"",
|
||||
device_id,
|
||||
device_type,
|
||||
|
||||
@@ -67,4 +67,4 @@ rules:
|
||||
# Platinum
|
||||
async-dependency: todo
|
||||
inject-websession: todo
|
||||
strict-typing: todo
|
||||
strict-typing: done
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Select for Midea."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import override
|
||||
from typing import cast, override
|
||||
|
||||
from midealocal.const import DeviceType
|
||||
|
||||
@@ -145,7 +145,9 @@ class MideaSelect(MideaEntity, SelectEntity):
|
||||
@override
|
||||
def options(self) -> list[str]:
|
||||
"""Return the list of valid options."""
|
||||
return getattr(self._device, self.entity_description.options_attribute)
|
||||
return cast(
|
||||
list[str], getattr(self._device, self.entity_description.options_attribute)
|
||||
)
|
||||
|
||||
@property
|
||||
@override
|
||||
|
||||
@@ -3658,6 +3658,16 @@ disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.midea.*]
|
||||
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.miele.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
||||
Reference in New Issue
Block a user