Enable strict typing for bthome (#107859)

This commit is contained in:
Marc Mueller
2024-01-12 12:56:13 +01:00
committed by GitHub
parent 96a9ebf137
commit 7e28c788cb
4 changed files with 15 additions and 4 deletions

View File

@ -110,6 +110,7 @@ homeassistant.components.bond.*
homeassistant.components.braviatv.*
homeassistant.components.brother.*
homeassistant.components.browser.*
homeassistant.components.bthome.*
homeassistant.components.button.*
homeassistant.components.calendar.*
homeassistant.components.camera.*

View File

@ -75,7 +75,7 @@ class BTHomeConfigFlow(ConfigFlow, domain=DOMAIN):
errors = {}
if user_input is not None:
bindkey = user_input["bindkey"]
bindkey: str = user_input["bindkey"]
if len(bindkey) != 32:
errors["bindkey"] = "expected_32_characters"
@ -173,8 +173,8 @@ class BTHomeConfigFlow(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

@ -66,7 +66,7 @@ async def async_validate_trigger_config(
hass: HomeAssistant, config: ConfigType
) -> ConfigType:
"""Validate trigger config."""
return SCHEMA_BY_EVENT_CLASS.get(config[CONF_TYPE], DEVICE_TRIGGER_BASE_SCHEMA)(
return SCHEMA_BY_EVENT_CLASS.get(config[CONF_TYPE], DEVICE_TRIGGER_BASE_SCHEMA)( # type: ignore[no-any-return]
config
)

View File

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