mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Python 3.5 async with (#13283)
This commit is contained in:
parent
05676ba18b
commit
f5093b474a
@ -311,7 +311,7 @@ class EntityPlatform(object):
|
|||||||
self.scan_interval)
|
self.scan_interval)
|
||||||
return
|
return
|
||||||
|
|
||||||
with (await self._process_updates):
|
async with self._process_updates:
|
||||||
tasks = []
|
tasks = []
|
||||||
for entity in self.entities.values():
|
for entity in self.entities.values():
|
||||||
if not entity.should_poll:
|
if not entity.should_poll:
|
||||||
|
@ -75,7 +75,7 @@ async def async_get_last_state(hass, entity_id: str):
|
|||||||
if _LOCK not in hass.data:
|
if _LOCK not in hass.data:
|
||||||
hass.data[_LOCK] = asyncio.Lock(loop=hass.loop)
|
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:
|
if DATA_RESTORE_CACHE not in hass.data:
|
||||||
await hass.async_add_job(
|
await hass.async_add_job(
|
||||||
_load_restore_cache, hass)
|
_load_restore_cache, hass)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user