Async syntax 8/8 (#17022)

* Async syntax 8

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

View file

@ -27,15 +27,13 @@ CONFIG_SCHEMA = vol.Schema({
}, extra=vol.ALLOW_EXTRA)
@asyncio.coroutine
def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up the shell_command component."""
conf = config.get(DOMAIN, {})
cache = {}
@asyncio.coroutine
def async_service_handler(service: ServiceCall) -> None:
async def async_service_handler(service: ServiceCall) -> None:
"""Execute a shell command service."""
cmd = conf[service.service]
@ -85,8 +83,8 @@ def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
stderr=asyncio.subprocess.PIPE,
)
process = yield from create_process
stdout_data, stderr_data = yield from process.communicate()
process = await create_process
stdout_data, stderr_data = await process.communicate()
if stdout_data:
_LOGGER.debug("Stdout of command: `%s`, return code: %s:\n%s",