Skip to content

Commit 0a0cd06

Browse files
chore(pre-commit.ci): auto fixes
1 parent d73bace commit 0a0cd06

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

switchbot/const/lock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class LockStatus(Enum):
1515

1616

1717
class QuickKeyFunction(Enum):
18-
"""Action of the Lock Ultra Quick Key.
18+
"""
19+
Action of the Lock Ultra Quick Key.
1920
2021
Value is the 2-bit function field of the Quick Key config byte. Lock Ultra.
2122
"""

switchbot/devices/lock.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,19 @@ async def half_lock(self) -> bool:
158158
)
159159

160160
async def get_quick_key(self) -> dict[str, Any] | None:
161-
"""Return the Quick Key settings (Lock Ultra only).
161+
"""
162+
Return the Quick Key settings (Lock Ultra only).
162163
163164
Returns
165+
-------
164166
``{"enabled": bool, "double_press": bool, "function": QuickKeyFunction}``,
165167
or ``None`` if it can't be read.
168+
166169
"""
167170
if self._model not in COMMAND_GET_QUICK_KEY:
168-
raise SwitchbotOperationError(f"Quick Key is not supported on {self._model}")
171+
raise SwitchbotOperationError(
172+
f"Quick Key is not supported on {self._model}"
173+
)
169174
result = await self._send_command(
170175
key=COMMAND_GET_QUICK_KEY[self._model], retry=self._retry_count
171176
)
@@ -193,14 +198,17 @@ async def set_quick_key(
193198
double_press: bool | None = None,
194199
function: QuickKeyFunction | None = None,
195200
) -> bool:
196-
"""Update one or more Quick Key settings (Lock Ultra only).
201+
"""
202+
Update one or more Quick Key settings (Lock Ultra only).
197203
198204
Only the fields you pass are changed (a masked write); the others keep their
199205
current value. Returns ``True`` if the lock acknowledges with the requested
200206
bits set.
201207
"""
202208
if self._model not in COMMAND_SET_QUICK_KEY_PREFIX:
203-
raise SwitchbotOperationError(f"Quick Key is not supported on {self._model}")
209+
raise SwitchbotOperationError(
210+
f"Quick Key is not supported on {self._model}"
211+
)
204212
mask = 0
205213
value = 0
206214
if enabled is not None:

tests/test_lock.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,9 @@ async def test_set_quick_key_masked_write():
897897
"""Setting only the function sends a masked write of just those bits."""
898898
device = create_device_for_command_testing(SwitchbotModel.LOCK_ULTRA)
899899
with patch.object(
900-
device, "_send_command", return_value=b"\x01\xc9" # echo 0xc9 = Unlock Only
900+
device,
901+
"_send_command",
902+
return_value=b"\x01\xc9", # echo 0xc9 = Unlock Only
901903
) as mock_send_command:
902904
result = await device.set_quick_key(function=QuickKeyFunction.UNLOCK_ONLY)
903905
prefix = lock.COMMAND_SET_QUICK_KEY_PREFIX[SwitchbotModel.LOCK_ULTRA]

0 commit comments

Comments
 (0)