From 17c6ca6c7191c60bcbb4b8d82e11b40dd291c0e4 Mon Sep 17 00:00:00 2001 From: carstenschroeder Date: Sat, 30 Mar 2019 00:53:27 +0100 Subject: [PATCH] use the builtin asyncio function run_coroutine_threadsafe (#210) This asyncio util function is legacy from when we ran Python 3.4. --- docs/asyncio_working_with_async.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/asyncio_working_with_async.md b/docs/asyncio_working_with_async.md index 36016411..729a01bc 100644 --- a/docs/asyncio_working_with_async.md +++ b/docs/asyncio_working_with_async.md @@ -74,10 +74,10 @@ Sometimes it will happen that you’re in a thread and you want to call a functi In the following example, `say_hello` will schedule `async_say_hello` and block till the function has run and get the result back. ```python -from homeassistant.util.async_ import run_coroutine_threadsafe +import asyncio def say_hello(hass, target): - return run_coroutine_threadsafe( + return asyncio.run_coroutine_threadsafe( async_say_hello(hass, target), hass.loop).result() async def async_say_hello(hass, target):