mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Improve iterable typing (1) (#79295)
This commit is contained in:
parent
fbcf6cb03c
commit
3a9ecab98a
@ -1,7 +1,7 @@
|
|||||||
"""Provide pre-made queries on top of the recorder component."""
|
"""Provide pre-made queries on top of the recorder component."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable, Iterable
|
from collections.abc import Callable, Collection, Iterable
|
||||||
import json
|
import json
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@ -81,13 +81,13 @@ class Filters:
|
|||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialise the include and exclude filters."""
|
"""Initialise the include and exclude filters."""
|
||||||
self.excluded_entities: Iterable[str] = []
|
self.excluded_entities: Collection[str] = []
|
||||||
self.excluded_domains: Iterable[str] = []
|
self.excluded_domains: Collection[str] = []
|
||||||
self.excluded_entity_globs: Iterable[str] = []
|
self.excluded_entity_globs: Collection[str] = []
|
||||||
|
|
||||||
self.included_entities: Iterable[str] = []
|
self.included_entities: Collection[str] = []
|
||||||
self.included_domains: Iterable[str] = []
|
self.included_domains: Collection[str] = []
|
||||||
self.included_entity_globs: Iterable[str] = []
|
self.included_entity_globs: Collection[str] = []
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
"""Return human readable excludes/includes."""
|
"""Return human readable excludes/includes."""
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""SQLAlchemy util functions."""
|
"""SQLAlchemy util functions."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable, Generator, Iterable
|
from collections.abc import Callable, Generator
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
import functools
|
import functools
|
||||||
@ -180,7 +180,7 @@ def execute_stmt_lambda_element(
|
|||||||
start_time: datetime | None = None,
|
start_time: datetime | None = None,
|
||||||
end_time: datetime | None = None,
|
end_time: datetime | None = None,
|
||||||
yield_per: int | None = DEFAULT_YIELD_STATES_ROWS,
|
yield_per: int | None = DEFAULT_YIELD_STATES_ROWS,
|
||||||
) -> Iterable[Row]:
|
) -> list[Row]:
|
||||||
"""Execute a StatementLambdaElement.
|
"""Execute a StatementLambdaElement.
|
||||||
|
|
||||||
If the time window passed is greater than one day
|
If the time window passed is greater than one day
|
||||||
|
@ -649,7 +649,7 @@ class HomeAssistant:
|
|||||||
else:
|
else:
|
||||||
await asyncio.sleep(0)
|
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."""
|
"""Await and log tasks that take a long time."""
|
||||||
wait_time = 0
|
wait_time = 0
|
||||||
while pending:
|
while pending:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user