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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View File

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

View File

@ -75,7 +75,7 @@ class BTHomeConfigFlow(ConfigFlow, domain=DOMAIN):
errors = {} errors = {}
if user_input is not None: if user_input is not None:
bindkey = user_input["bindkey"] bindkey: str = user_input["bindkey"]
if len(bindkey) != 32: if len(bindkey) != 32:
errors["bindkey"] = "expected_32_characters" errors["bindkey"] = "expected_32_characters"
@ -173,8 +173,8 @@ class BTHomeConfigFlow(ConfigFlow, domain=DOMAIN):
# Otherwise there wasn't actually encryption so abort # Otherwise there wasn't actually encryption so abort
return self.async_abort(reason="reauth_successful") return self.async_abort(reason="reauth_successful")
def _async_get_or_create_entry(self, bindkey=None): def _async_get_or_create_entry(self, bindkey: str | None = None) -> FlowResult:
data = {} data: dict[str, Any] = {}
if bindkey: if bindkey:
data["bindkey"] = bindkey data["bindkey"] = bindkey

View File

@ -66,7 +66,7 @@ async def async_validate_trigger_config(
hass: HomeAssistant, config: ConfigType hass: HomeAssistant, config: ConfigType
) -> ConfigType: ) -> ConfigType:
"""Validate trigger config.""" """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 config
) )

View File

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