Improve iterable typing (1) (#79295)
This commit is contained in:
parent
fbcf6cb03c
commit
3a9ecab98a
3 changed files with 10 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
|||
"""Provide pre-made queries on top of the recorder component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Iterable
|
||||
from collections.abc import Callable, Collection, Iterable
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
|
@ -81,13 +81,13 @@ class Filters:
|
|||
|
||||
def __init__(self) -> None:
|
||||
"""Initialise the include and exclude filters."""
|
||||
self.excluded_entities: Iterable[str] = []
|
||||
self.excluded_domains: Iterable[str] = []
|
||||
self.excluded_entity_globs: Iterable[str] = []
|
||||
self.excluded_entities: Collection[str] = []
|
||||
self.excluded_domains: Collection[str] = []
|
||||
self.excluded_entity_globs: Collection[str] = []
|
||||
|
||||
self.included_entities: Iterable[str] = []
|
||||
self.included_domains: Iterable[str] = []
|
||||
self.included_entity_globs: Iterable[str] = []
|
||||
self.included_entities: Collection[str] = []
|
||||
self.included_domains: Collection[str] = []
|
||||
self.included_entity_globs: Collection[str] = []
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Return human readable excludes/includes."""
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""SQLAlchemy util functions."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Generator, Iterable
|
||||
from collections.abc import Callable, Generator
|
||||
from contextlib import contextmanager
|
||||
from datetime import date, datetime, timedelta
|
||||
import functools
|
||||
|
@ -180,7 +180,7 @@ def execute_stmt_lambda_element(
|
|||
start_time: datetime | None = None,
|
||||
end_time: datetime | None = None,
|
||||
yield_per: int | None = DEFAULT_YIELD_STATES_ROWS,
|
||||
) -> Iterable[Row]:
|
||||
) -> list[Row]:
|
||||
"""Execute a StatementLambdaElement.
|
||||
|
||||
If the time window passed is greater than one day
|
||||
|
|
|
@ -649,7 +649,7 @@ class HomeAssistant:
|
|||
else:
|
||||
await asyncio.sleep(0)
|
||||
|
||||
async def _await_and_log_pending(self, pending: Iterable[Awaitable[Any]]) -> None:
|
||||
async def _await_and_log_pending(self, pending: Collection[Awaitable[Any]]) -> None:
|
||||
"""Await and log tasks that take a long time."""
|
||||
wait_time = 0
|
||||
while pending:
|
||||
|
|
Loading…
Add table
Reference in a new issue