Enable strict typing for xiaomi_ble (#107948)

pull/107968/head
Marc Mueller 2024-01-13 16:57:54 +01:00 committed by GitHub
parent 45fec1d404
commit 0cc43d0915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 4 deletions

View File

@ -447,6 +447,7 @@ homeassistant.components.withings.*
homeassistant.components.wiz.*
homeassistant.components.wled.*
homeassistant.components.worldclock.*
homeassistant.components.xiaomi_ble.*
homeassistant.components.yale_smart_alarm.*
homeassistant.components.yalexs_ble.*
homeassistant.components.youtube.*

View File

@ -128,7 +128,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
)
)
async def _async_poll(service_info: BluetoothServiceInfoBleak):
async def _async_poll(service_info: BluetoothServiceInfoBleak) -> SensorUpdate:
# BluetoothServiceInfoBleak is defined in HA, otherwise would just pass it
# directly to the Xiaomi code
# Make sure the device we have is one that we can connect with

View File

@ -280,8 +280,8 @@ class XiaomiConfigFlow(ConfigFlow, domain=DOMAIN):
# Otherwise there wasn't actually encryption so abort
return self.async_abort(reason="reauth_successful")
def _async_get_or_create_entry(self, bindkey=None):
data = {}
def _async_get_or_create_entry(self, bindkey: str | None = None) -> FlowResult:
data: dict[str, Any] = {}
if bindkey:
data["bindkey"] = bindkey

View File

@ -65,7 +65,7 @@ async def async_validate_trigger_config(
"""Validate trigger config."""
device_id = config[CONF_DEVICE_ID]
if model_data := _async_trigger_model_data(hass, device_id):
return model_data.schema(config)
return model_data.schema(config) # type: ignore[no-any-return]
return config

View File

@ -4233,6 +4233,16 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.xiaomi_ble.*]
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.yale_smart_alarm.*]
check_untyped_defs = true
disallow_incomplete_defs = true