Fix asyncio.gather call (#107500)
This commit is contained in:
parent
3709475cb5
commit
442eb68d92
1 changed files with 5 additions and 3 deletions
|
@ -2,8 +2,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Coroutine
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import aiohttp
|
||||
from aiohttp.hdrs import CONTENT_TYPE
|
||||
|
@ -267,11 +269,11 @@ class MicrosoftFace:
|
|||
"""Store group/person data and IDs."""
|
||||
return self._store
|
||||
|
||||
async def update_store(self):
|
||||
async def update_store(self) -> None:
|
||||
"""Load all group/person data into local store."""
|
||||
groups = await self.call_api("get", "persongroups")
|
||||
|
||||
remove_tasks = []
|
||||
remove_tasks: list[Coroutine[Any, Any, None]] = []
|
||||
new_entities = []
|
||||
for group in groups:
|
||||
g_id = group["personGroupId"]
|
||||
|
@ -293,7 +295,7 @@ class MicrosoftFace:
|
|||
self._store[g_id][person["name"]] = person["personId"]
|
||||
|
||||
if remove_tasks:
|
||||
await asyncio.gather(remove_tasks)
|
||||
await asyncio.gather(*remove_tasks)
|
||||
await self._component.async_add_entities(new_entities)
|
||||
|
||||
async def call_api(self, method, function, data=None, binary=False, params=None):
|
||||
|
|
Loading…
Add table
Reference in a new issue