Python 3.5 async with (#13283)

This commit is contained in:
Otto Winter 2018-03-17 12:27:21 +01:00 committed by GitHub
parent 05676ba18b
commit f5093b474a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -311,7 +311,7 @@ class EntityPlatform(object):
self.scan_interval)
return
with (await self._process_updates):
async with self._process_updates:
tasks = []
for entity in self.entities.values():
if not entity.should_poll:

View File

@ -75,7 +75,7 @@ async def async_get_last_state(hass, entity_id: str):
if _LOCK not in hass.data:
hass.data[_LOCK] = asyncio.Lock(loop=hass.loop)
with (await hass.data[_LOCK]):
async with hass.data[_LOCK]:
if DATA_RESTORE_CACHE not in hass.data:
await hass.async_add_job(
_load_restore_cache, hass)