Fix CI (#42397)
parent
e552c9ba96
commit
bba770b411
|
@ -988,7 +988,7 @@ def async_track_template_result(
|
|||
action: TrackTemplateResultListener,
|
||||
raise_on_template_error: bool = False,
|
||||
) -> _TrackTemplateResultInfo:
|
||||
"""Add a listener that fires when a the result of a template changes.
|
||||
"""Add a listener that fires when the result of a template changes.
|
||||
|
||||
The action will fire with the initial result from the template, and
|
||||
then whenever the output from the template changes. The template will
|
||||
|
|
|
@ -146,10 +146,14 @@ def gen_result_wrapper(kls):
|
|||
class TupleWrapper(tuple, ResultWrapper):
|
||||
"""Wrap a tuple."""
|
||||
|
||||
# This is all magic to be allowed to subclass a tuple.
|
||||
|
||||
def __new__(cls, value: tuple, render_result: str) -> "TupleWrapper":
|
||||
"""Create a new tuple class."""
|
||||
return super().__new__(cls, tuple(value))
|
||||
|
||||
# pylint: disable=super-init-not-called
|
||||
|
||||
def __init__(self, value: tuple, render_result: str):
|
||||
"""Initialize a new tuple class."""
|
||||
self.render_result = render_result
|
||||
|
@ -398,7 +402,7 @@ class Template:
|
|||
|
||||
return self._parse_result(render_result)
|
||||
|
||||
def _parse_result(self, render_result: str) -> Any:
|
||||
def _parse_result(self, render_result: str) -> Any: # pylint: disable=no-self-use
|
||||
"""Parse the result."""
|
||||
try:
|
||||
result = literal_eval(render_result)
|
||||
|
|
|
@ -1771,7 +1771,7 @@ async def test_specifically_referenced_entity_is_not_rate_limited(hass):
|
|||
|
||||
async def test_track_two_templates_with_different_rate_limits(hass):
|
||||
"""Test two templates with different rate limits."""
|
||||
template_one = Template("{{ states | count }} ", hass)
|
||||
template_one = Template("{{ (states | count) + 0 }}", hass)
|
||||
template_five = Template("{{ states | count }}", hass)
|
||||
|
||||
refresh_runs = {
|
||||
|
|
Loading…
Reference in New Issue