-
-
Notifications
You must be signed in to change notification settings - Fork 28.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed to async/await #13246
Changed to async/await #13246
Conversation
@@ -392,8 +383,8 @@ def async_update_status(self): | |||
self._group_name = group_name | |||
# the sleep is needed to make sure that the | |||
# devices is synced | |||
yield from asyncio.sleep(1, loop=self._hass.loop) | |||
yield from self.async_trigger_sync_on_all() | |||
time.sleep(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined name 'time'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never ever use time.sleep
. It blocks the event loop or executor thread (depending on context). Keep using asyncio.sleep because you're inside an async context and that won't block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was confused :)
I've changed it back now
@asyncio.coroutine | ||
def _start_poll_command(self): | ||
|
||
async def _start_poll_command(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)
@@ -254,16 +249,16 @@ def force_update_sync_status( | |||
on_updated_cb() | |||
return True | |||
|
|||
@asyncio.coroutine | |||
def _start_poll_command(self): | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line contains whitespace
|
||
@asyncio.coroutine | ||
def force_update_sync_status( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line contains whitespace
|
||
@asyncio.coroutine | ||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): | ||
async def async_setup_platform(hass, config, async_add_devices, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
Description:
Checklist:
tox
. Your PR cannot be merged unless tests passIf the code does not interact with devices: