Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asyncio.gather call #107500

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions homeassistant/components/microsoft_face/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -267,11 +269,11 @@
"""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"]
Expand All @@ -293,7 +295,7 @@
self._store[g_id][person["name"]] = person["personId"]

if remove_tasks:
await asyncio.gather(remove_tasks)
await asyncio.gather(*remove_tasks)

Check warning on line 298 in homeassistant/components/microsoft_face/__init__.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/microsoft_face/__init__.py#L298

Added line #L298 was not covered by tests
await self._component.async_add_entities(new_entities)

async def call_api(self, method, function, data=None, binary=False, params=None):
Expand Down
Loading