mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Import Generator from typing_extensions (1) (#118986)
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Generator, Sequence
|
||||
from collections.abc import Callable, Sequence
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from typing_extensions import Generator
|
||||
|
||||
from .util.event_type import EventType
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -138,7 +140,7 @@ class ConditionError(HomeAssistantError):
|
||||
"""Return indentation."""
|
||||
return " " * indent + message
|
||||
|
||||
def output(self, indent: int) -> Generator[str, None, None]:
|
||||
def output(self, indent: int) -> Generator[str]:
|
||||
"""Yield an indented representation."""
|
||||
raise NotImplementedError
|
||||
|
||||
@@ -154,7 +156,7 @@ class ConditionErrorMessage(ConditionError):
|
||||
# A message describing this error
|
||||
message: str
|
||||
|
||||
def output(self, indent: int) -> Generator[str, None, None]:
|
||||
def output(self, indent: int) -> Generator[str]:
|
||||
"""Yield an indented representation."""
|
||||
yield self._indent(indent, f"In '{self.type}' condition: {self.message}")
|
||||
|
||||
@@ -170,7 +172,7 @@ class ConditionErrorIndex(ConditionError):
|
||||
# The error that this error wraps
|
||||
error: ConditionError
|
||||
|
||||
def output(self, indent: int) -> Generator[str, None, None]:
|
||||
def output(self, indent: int) -> Generator[str]:
|
||||
"""Yield an indented representation."""
|
||||
if self.total > 1:
|
||||
yield self._indent(
|
||||
@@ -189,7 +191,7 @@ class ConditionErrorContainer(ConditionError):
|
||||
# List of ConditionErrors that this error wraps
|
||||
errors: Sequence[ConditionError]
|
||||
|
||||
def output(self, indent: int) -> Generator[str, None, None]:
|
||||
def output(self, indent: int) -> Generator[str]:
|
||||
"""Yield an indented representation."""
|
||||
for item in self.errors:
|
||||
yield from item.output(indent)
|
||||
|
||||
Reference in New Issue
Block a user