You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're on Python 3.5 so it's time to let go of @asyncio.coroutine. Migration of a piece of code is simple as they are functionally compatible:
Remove @asyncio.coroutine decorator
Add async before function definition: async def async_start(self):
Replace all yield from with await
For now, let's focus on updating all pieces of code for which we have tests. Let's not update the tests and the code in the same PR. Instead, do 1 PR for the code, 1 PR for the tests. That way we know we don't break things.
If you see an error that you can't await a generator context, it's because you're awaiting a function that doesn't have @asyncio.coroutine as the first decorator above the function name. In such cases, just replace decorator with async and you're good 👍
Python 3.5 also does a better job in warning when async methods have been called but not awaited. When you run py.test locally, note these warnings and please fix them 👍
To kick it off, here is a conversion of the core: #12610
The text was updated successfully, but these errors were encountered:
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
We're on Python 3.5 so it's time to let go of
@asyncio.coroutine
. Migration of a piece of code is simple as they are functionally compatible:@asyncio.coroutine
decoratorasync
before function definition:async def async_start(self):
yield from
withawait
For now, let's focus on updating all pieces of code for which we have tests. Let's not update the tests and the code in the same PR. Instead, do 1 PR for the code, 1 PR for the tests. That way we know we don't break things.
If you see an error that you can't await a generator context, it's because you're awaiting a function that doesn't have
@asyncio.coroutine
as the first decorator above the function name. In such cases, just replace decorator withasync
and you're good 👍Python 3.5 also does a better job in warning when async methods have been called but not awaited. When you run
py.test
locally, note these warnings and please fix them 👍To kick it off, here is a conversion of the core: #12610
The text was updated successfully, but these errors were encountered: