1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 14:43:51 +00:00

[ruff] Enable SIM rules and fix code simplification violations (#9872)

This commit is contained in:
J. Nick Koston
2025-07-24 20:26:08 -10:00
committed by GitHub
parent cb87f156d0
commit ffebd30033
72 changed files with 400 additions and 432 deletions

View File

@@ -70,11 +70,13 @@ async def test_scheduler_defer_cancel(
test_complete_future.set_result(True)
return
if state.key == test_result_entity.key and not test_result_future.done():
# Event type should be "defer_executed_X" where X is the defer number
if state.event_type.startswith("defer_executed_"):
defer_num = int(state.event_type.split("_")[-1])
test_result_future.set_result(defer_num)
if (
state.key == test_result_entity.key
and not test_result_future.done()
and state.event_type.startswith("defer_executed_")
):
defer_num = int(state.event_type.split("_")[-1])
test_result_future.set_result(defer_num)
client.subscribe_states(on_state)