mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Avoid some implicit generic Anys (#54577)
This commit is contained in:
@@ -9,6 +9,8 @@ import attr
|
||||
if TYPE_CHECKING:
|
||||
from .core import Context
|
||||
|
||||
# mypy: disallow-any-generics
|
||||
|
||||
|
||||
class HomeAssistantError(Exception):
|
||||
"""General Home Assistant exception occurred."""
|
||||
@@ -42,7 +44,7 @@ class ConditionError(HomeAssistantError):
|
||||
"""Return indentation."""
|
||||
return " " * indent + message
|
||||
|
||||
def output(self, indent: int) -> Generator:
|
||||
def output(self, indent: int) -> Generator[str, None, None]:
|
||||
"""Yield an indented representation."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@@ -58,7 +60,7 @@ class ConditionErrorMessage(ConditionError):
|
||||
# A message describing this error
|
||||
message: str = attr.ib()
|
||||
|
||||
def output(self, indent: int) -> Generator:
|
||||
def output(self, indent: int) -> Generator[str, None, None]:
|
||||
"""Yield an indented representation."""
|
||||
yield self._indent(indent, f"In '{self.type}' condition: {self.message}")
|
||||
|
||||
@@ -74,7 +76,7 @@ class ConditionErrorIndex(ConditionError):
|
||||
# The error that this error wraps
|
||||
error: ConditionError = attr.ib()
|
||||
|
||||
def output(self, indent: int) -> Generator:
|
||||
def output(self, indent: int) -> Generator[str, None, None]:
|
||||
"""Yield an indented representation."""
|
||||
if self.total > 1:
|
||||
yield self._indent(
|
||||
@@ -93,7 +95,7 @@ class ConditionErrorContainer(ConditionError):
|
||||
# List of ConditionErrors that this error wraps
|
||||
errors: Sequence[ConditionError] = attr.ib()
|
||||
|
||||
def output(self, indent: int) -> Generator:
|
||||
def output(self, indent: int) -> Generator[str, None, None]:
|
||||
"""Yield an indented representation."""
|
||||
for item in self.errors:
|
||||
yield from item.output(indent)
|
||||
|
||||
Reference in New Issue
Block a user