1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-08 09:38:58 +01:00

Prevent callback decorator on coroutine functions (#126429)

* Prevent callback decorator on async functions

* Adjust

* Adjust

* Adjust components

* Adjust tests

* Rename

* One more

* Adjust

* Adjust again

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
epenet
2024-09-23 02:55:55 +02:00
committed by GitHub
parent 113a792734
commit c759512c70
13 changed files with 22 additions and 20 deletions
+2 -2
View File
@@ -2194,7 +2194,7 @@ async def test_async_functions_with_callback(hass: HomeAssistant) -> None:
runs = []
@ha.callback
async def test():
async def test(): # pylint: disable=hass-async-callback-decorator
runs.append(True)
await hass.async_add_job(test)
@@ -2205,7 +2205,7 @@ async def test_async_functions_with_callback(hass: HomeAssistant) -> None:
assert len(runs) == 2
@ha.callback
async def service_handler(call):
async def service_handler(call): # pylint: disable=hass-async-callback-decorator
runs.append(True)
hass.services.async_register("test_domain", "test_service", service_handler)