asyncio.ensure_future Python 3.5 (#13141)
This commit is contained in:
parent
9ee123f5ce
commit
890197e407
2 changed files with 2 additions and 14 deletions
|
@ -189,12 +189,7 @@ class SpcWebGateway:
|
|||
|
||||
def start_listener(self, async_callback, *args):
|
||||
"""Start the websocket listener."""
|
||||
try:
|
||||
from asyncio import ensure_future
|
||||
except ImportError:
|
||||
from asyncio import async as ensure_future
|
||||
|
||||
ensure_future(self._ws_listen(async_callback, *args))
|
||||
asyncio.ensure_future(self._ws_listen(async_callback, *args))
|
||||
|
||||
def _build_url(self, resource):
|
||||
return urljoin(self._api_url, "spc/{}".format(resource))
|
||||
|
|
|
@ -5,14 +5,7 @@ import logging
|
|||
from asyncio import coroutines
|
||||
from asyncio.futures import Future
|
||||
|
||||
try:
|
||||
# pylint: disable=ungrouped-imports
|
||||
from asyncio import ensure_future
|
||||
except ImportError:
|
||||
# Python 3.4.3 and earlier has this as async
|
||||
# pylint: disable=unused-import
|
||||
from asyncio import async
|
||||
ensure_future = async
|
||||
from asyncio import ensure_future
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
Loading…
Add table
Reference in a new issue