Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
raman325 committed Jan 30, 2024
1 parent 91e3542 commit 05f18b3
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 13 deletions.
19 changes: 12 additions & 7 deletions custom_components/lock_code_manager/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Lock Code Manager Integration."""

from __future__ import annotations

import asyncio
Expand Down Expand Up @@ -243,10 +244,14 @@ async def async_update_listener(hass: HomeAssistant, config_entry: ConfigEntry)
)
async_dispatcher_send(hass, f"{DOMAIN}_{entry_id}_add_locks", locks_to_add)
for lock_entity_id in locks_to_add:
lock = hass.data[DOMAIN][entry_id][CONF_LOCKS][
lock_entity_id
] = async_create_lock_instance(
hass, dr.async_get(hass), er.async_get(hass), config_entry, lock_entity_id
lock = hass.data[DOMAIN][entry_id][CONF_LOCKS][lock_entity_id] = (
async_create_lock_instance(
hass,
dr.async_get(hass),
er.async_get(hass),
config_entry,
lock_entity_id,
)
)
await lock.async_setup()

Expand All @@ -270,9 +275,9 @@ async def async_update_listener(hass: HomeAssistant, config_entry: ConfigEntry)
_LOGGER.debug(
"%s (%s): Creating coordinator for lock %s", entry_id, entry_title, lock
)
coordinator = hass.data[DOMAIN][entry_id][COORDINATORS][
lock_entity_id
] = LockUsercodeUpdateCoordinator(hass, lock)
coordinator = hass.data[DOMAIN][entry_id][COORDINATORS][lock_entity_id] = (
LockUsercodeUpdateCoordinator(hass, lock)
)
await coordinator.async_config_entry_first_refresh()
for slot_num in new_slots:
_LOGGER.debug(
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sensor for lock_code_manager."""

from __future__ import annotations

import asyncio
Expand Down
7 changes: 4 additions & 3 deletions custom_components/lock_code_manager/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Adds config flow for lock_code_manager."""

from __future__ import annotations

import logging
Expand Down Expand Up @@ -163,9 +164,9 @@ async def async_step_code_slot(
if user_input.get(CONF_ENABLED) and not user_input.get(CONF_PIN):
errors[CONF_PIN] = "missing_pin_if_enabled"
else:
self.data[CONF_SLOTS][
int(self.slots_to_configure.pop(0))
] = CODE_SLOT_SCHEMA(user_input)
self.data[CONF_SLOTS][int(self.slots_to_configure.pop(0))] = (
CODE_SLOT_SCHEMA(user_input)
)
if not self.slots_to_configure:
return self.async_create_entry(title=self.title, data=self.data)

Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants for lock_code_manager."""

from __future__ import annotations

from homeassistant.const import CONF_ENABLED, CONF_NAME, CONF_PIN, Platform
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/coordinator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Lock Code Manager Coordinators."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/entity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base entity class for Lock Code Manager."""

from __future__ import annotations

import copy
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exceptions for lock_code_manager."""

from __future__ import annotations

from homeassistant.exceptions import HomeAssistantError
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers for lock_code_manager."""

from __future__ import annotations

import copy
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/number.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Number for lock_code_manager."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
There should be one file per integration, named after the integration.
"""

from ._base import BaseLock
from .zwave_js import ZWaveJSLock

Expand Down
9 changes: 6 additions & 3 deletions custom_components/lock_code_manager/providers/_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base integration module."""

from __future__ import annotations

from dataclasses import dataclass, field
Expand Down Expand Up @@ -246,9 +247,11 @@ def fire_code_slot_event(
event_data={
ATTR_NOTIFICATION_SOURCE: notification_source,
ATTR_ENTITY_ID: lock_entity_id,
ATTR_STATE: state.state
if (state := self.hass.states.get(lock_entity_id))
else "",
ATTR_STATE: (
state.state
if (state := self.hass.states.get(lock_entity_id))
else ""
),
ATTR_ACTION_TEXT: action_text,
ATTR_CODE_SLOT: code_slot or 0,
ATTR_CODE_SLOT_NAME: name_state.state if name_state else "",
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/providers/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants for integrations module."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/providers/zwave_js.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for Z-Wave JS locks."""

from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sensor for lock_code_manager."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/switch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Switch for lock_code_manager."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions custom_components/lock_code_manager/text.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Text for lock_code_manager."""

from __future__ import annotations

import logging
Expand Down

0 comments on commit 05f18b3

Please sign in to comment.