Async syntax 8/8 (#17022)

* Async syntax 8

* Pylint fixes
This commit is contained in:
cdce8p authored and Paulus Schoutsen committed 2018-10-01 08:52:42 +02:00
1 parent ea7b1e4573
commit 9aaf11de8c
54 files changed
+223 -382

No files matched your search

+3 -5
View File
@@ -53,8 +53,7 @@ CONFIG_SCHEMA = vol.Schema({
}, extra=vol.ALLOW_EXTRA)
@asyncio.coroutine
def async_setup(hass, config):
async def async_setup(hass, config):
"""Set up the REST command component."""
websession = async_get_clientsession(hass)
@@ -87,8 +86,7 @@ def async_setup(hass, config):
headers = {}
headers[hdrs.CONTENT_TYPE] = content_type
@asyncio.coroutine
def async_service_handler(service):
async def async_service_handler(service):
"""Execute a shell command service."""
payload = None
if template_payload:
@@ -98,7 +96,7 @@ def async_setup(hass, config):
try:
with async_timeout.timeout(timeout, loop=hass.loop):
request = yield from getattr(websession, method)(
request = await getattr(websession, method)(
template_url.async_render(variables=service.data),
data=payload,
auth=auth,