Fix asyncio.wait typing (#99726)

This commit is contained in:
Marc Mueller 2023-09-06 16:53:41 +02:00 committed by GitHub
parent 0b95e4ac17
commit 5d54660802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View File

@ -2,7 +2,6 @@
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
from collections.abc import Awaitable
from datetime import datetime, timedelta from datetime import datetime, timedelta
import logging import logging
from typing import Final from typing import Final
@ -152,7 +151,7 @@ async def async_setup_scanner(
async def perform_bluetooth_update() -> None: async def perform_bluetooth_update() -> None:
"""Discover Bluetooth devices and update status.""" """Discover Bluetooth devices and update status."""
_LOGGER.debug("Performing Bluetooth devices discovery and update") _LOGGER.debug("Performing Bluetooth devices discovery and update")
tasks: list[Awaitable[None]] = [] tasks: list[asyncio.Task[None]] = []
try: try:
if track_new: if track_new:

View File

@ -6,14 +6,7 @@ of entities and react to changes.
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
from collections.abc import ( from collections.abc import Callable, Collection, Coroutine, Iterable, Mapping
Awaitable,
Callable,
Collection,
Coroutine,
Iterable,
Mapping,
)
import concurrent.futures import concurrent.futures
from contextlib import suppress from contextlib import suppress
import datetime import datetime
@ -714,7 +707,9 @@ class HomeAssistant:
for task in tasks: for task in tasks:
_LOGGER.debug("Waiting for task: %s", task) _LOGGER.debug("Waiting for task: %s", task)
async def _await_and_log_pending(self, pending: Collection[Awaitable[Any]]) -> None: async def _await_and_log_pending(
self, pending: Collection[asyncio.Future[Any]]
) -> None:
"""Await and log tasks that take a long time.""" """Await and log tasks that take a long time."""
wait_time = 0 wait_time = 0
while pending: while pending: