Collection of code styling tweaks (#87381)
This commit is contained in:
parent
e55f11296e
commit
3d557b5583
52 changed files with 274 additions and 156 deletions
|
@ -93,7 +93,8 @@ def find_existing_host(
|
|||
def ensure_pin_format(pin: str, allow_insecure_setup_codes: Any = None) -> str:
|
||||
"""Ensure a pin code is correctly formatted.
|
||||
|
||||
Ensures a pin code is in the format 111-11-111. Handles codes with and without dashes.
|
||||
Ensures a pin code is in the format 111-11-111.
|
||||
Handles codes with and without dashes.
|
||||
|
||||
If incorrect code is entered, an exception is raised.
|
||||
"""
|
||||
|
@ -284,7 +285,8 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
if self.controller is None:
|
||||
await self._async_setup_controller()
|
||||
|
||||
# mypy can't see that self._async_setup_controller() always sets self.controller or throws
|
||||
# mypy can't see that self._async_setup_controller() always
|
||||
# sets self.controller or throws
|
||||
assert self.controller
|
||||
|
||||
pairing = self.controller.load_pairing(
|
||||
|
@ -344,7 +346,8 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
if model in HOMEKIT_IGNORE:
|
||||
return self.async_abort(reason="ignored_model")
|
||||
|
||||
# If this is a HomeKit bridge/accessory exported by *this* HA instance ignore it.
|
||||
# If this is a HomeKit bridge/accessory exported
|
||||
# by *this* HA instance ignore it.
|
||||
if await self._hkid_is_homekit(hkid):
|
||||
return self.async_abort(reason="ignored_model")
|
||||
|
||||
|
@ -366,12 +369,11 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
return self.async_abort(reason="ignored_model")
|
||||
|
||||
# Late imports in case BLE is not available
|
||||
from aiohomekit.controller.ble.discovery import ( # pylint: disable=import-outside-toplevel
|
||||
BleDiscovery,
|
||||
)
|
||||
from aiohomekit.controller.ble.manufacturer_data import ( # pylint: disable=import-outside-toplevel
|
||||
HomeKitAdvertisement,
|
||||
)
|
||||
# pylint: disable-next=import-outside-toplevel
|
||||
from aiohomekit.controller.ble.discovery import BleDiscovery
|
||||
|
||||
# pylint: disable-next=import-outside-toplevel
|
||||
from aiohomekit.controller.ble.manufacturer_data import HomeKitAdvertisement
|
||||
|
||||
await self.async_set_unique_id(discovery_info.address)
|
||||
self._abort_if_unique_id_configured()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue