Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
test_no_color_channels_value | (mock_openzwave) | Test value changed for rgb lights. | Test value changed for rgb lights. | def test_no_color_channels_value(mock_openzwave):
"""Test value changed for rgb lights."""
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
value = MockValue(data=0, node=node)
color = MockValue(data="#0000000000", node=node)
values = MockLightValues(primary=value, color=color)
... | [
"def",
"test_no_color_channels_value",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"command_classes",
"=",
"[",
"const",
".",
"COMMAND_CLASS_SWITCH_COLOR",
"]",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"0",
",",
"node",
"=",
"node",... | [
369,
0
] | [
377,
34
] | python | en | ['en', 'en', 'en'] | True |
test_rgb_value_changed | (mock_openzwave) | Test value changed for rgb lights. | Test value changed for rgb lights. | def test_rgb_value_changed(mock_openzwave):
"""Test value changed for rgb lights."""
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
value = MockValue(data=0, node=node)
color = MockValue(data="#0000000000", node=node)
# Supports RGB only
color_channels = MockValue(data=0x1C,... | [
"def",
"test_rgb_value_changed",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"command_classes",
"=",
"[",
"const",
".",
"COMMAND_CLASS_SWITCH_COLOR",
"]",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"0",
",",
"node",
"=",
"node",
")"... | [
380,
0
] | [
395,
46
] | python | en | ['en', 'en', 'en'] | True |
test_rgbww_value_changed | (mock_openzwave) | Test value changed for rgb lights. | Test value changed for rgb lights. | def test_rgbww_value_changed(mock_openzwave):
"""Test value changed for rgb lights."""
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
value = MockValue(data=0, node=node)
color = MockValue(data="#0000000000", node=node)
# Supports RGB, Warm White
color_channels = MockValue(d... | [
"def",
"test_rgbww_value_changed",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"command_classes",
"=",
"[",
"const",
".",
"COMMAND_CLASS_SWITCH_COLOR",
"]",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"0",
",",
"node",
"=",
"node",
"... | [
398,
0
] | [
415,
36
] | python | en | ['en', 'en', 'en'] | True |
test_rgbcw_value_changed | (mock_openzwave) | Test value changed for rgb lights. | Test value changed for rgb lights. | def test_rgbcw_value_changed(mock_openzwave):
"""Test value changed for rgb lights."""
node = MockNode(command_classes=[const.COMMAND_CLASS_SWITCH_COLOR])
value = MockValue(data=0, node=node)
color = MockValue(data="#0000000000", node=node)
# Supports RGB, Cold White
color_channels = MockValue(d... | [
"def",
"test_rgbcw_value_changed",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"command_classes",
"=",
"[",
"const",
".",
"COMMAND_CLASS_SWITCH_COLOR",
"]",
")",
"value",
"=",
"MockValue",
"(",
"data",
"=",
"0",
",",
"node",
"=",
"node",
"... | [
418,
0
] | [
435,
36
] | python | en | ['en', 'en', 'en'] | True |
test_ct_value_changed | (mock_openzwave) | Test value changed for zw098 lights. | Test value changed for zw098 lights. | def test_ct_value_changed(mock_openzwave):
"""Test value changed for zw098 lights."""
node = MockNode(
manufacturer_id="0086",
product_id="0062",
command_classes=[const.COMMAND_CLASS_SWITCH_COLOR],
)
value = MockValue(data=0, node=node)
color = MockValue(data="#0000000000", n... | [
"def",
"test_ct_value_changed",
"(",
"mock_openzwave",
")",
":",
"node",
"=",
"MockNode",
"(",
"manufacturer_id",
"=",
"\"0086\"",
",",
"product_id",
"=",
"\"0062\"",
",",
"command_classes",
"=",
"[",
"const",
".",
"COMMAND_CLASS_SWITCH_COLOR",
"]",
",",
")",
"v... | [
438,
0
] | [
462,
52
] | python | en | ['en', 'en', 'en'] | True |
MockLightValues.__init__ | (self, **kwargs) | Initialize the mock zwave values. | Initialize the mock zwave values. | def __init__(self, **kwargs):
"""Initialize the mock zwave values."""
self.dimming_duration = None
self.color = None
self.color_channels = None
super().__init__(**kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"dimming_duration",
"=",
"None",
"self",
".",
"color",
"=",
"None",
"self",
".",
"color_channels",
"=",
"None",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs... | [
23,
4
] | [
28,
34
] | python | en | ['en', 'en', 'en'] | True |
test_available_template_with_entities | (hass) | Test availability templates with values from other entities. | Test availability templates with values from other entities. | async def test_available_template_with_entities(hass):
"""Test availability templates with values from other entities."""
await setup.async_setup_component(
hass,
"light",
{
"light": {
"platform": "template",
"lights": {
"te... | [
"async",
"def",
"test_available_template_with_entities",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"t... | [
1078,
0
] | [
1125,
82
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_availability_template_keeps_component_available | (hass, caplog) | Test that an invalid availability keeps the device available. | Test that an invalid availability keeps the device available. | async def test_invalid_availability_template_keeps_component_available(hass, caplog):
"""Test that an invalid availability keeps the device available."""
await setup.async_setup_component(
hass,
"light",
{
"light": {
"platform": "template",
"li... | [
"async",
"def",
"test_invalid_availability_template_keeps_component_available",
"(",
"hass",
",",
"caplog",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
... | [
1128,
0
] | [
1165,
62
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass) | Test unique_id option only creates one light per id. | Test unique_id option only creates one light per id. | async def test_unique_id(hass):
"""Test unique_id option only creates one light per id."""
await setup.async_setup_component(
hass,
"light",
{
"light": {
"platform": "template",
"lights": {
"test_template_light_01": {
... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"test_template_light_01\"... | [
1168,
0
] | [
1208,
44
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.setup_method | (self, method) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self, method):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.calls = []
@callback
def record_call(service):
"""Track function calls."""
self.calls.append(service)
self.hass.servi... | [
"def",
"setup_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"self",
".",
"calls",
"=",
"[",
"]",
"@",
"callback",
"def",
"record_call",
"(",
"service",
")",
":",
"\"\"\"Track function calls.\"\"... | [
31,
4
] | [
41,
70
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.teardown_method | (self, method) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self, method):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
",",
"method",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
43,
4
] | [
45,
24
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_template_state_invalid | (self) | Test template state with render error. | Test template state with render error. | def test_template_state_invalid(self):
"""Test template state with render error."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": ... | [
"def",
"test_template_state_invalid",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"pl... | [
47,
4
] | [
85,
39
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_template_state_text | (self) | Test the state text of a template. | Test the state text of a template. | def test_template_state_text(self):
"""Test the state text of a template."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "templa... | [
"def",
"test_template_state_text",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platf... | [
87,
4
] | [
134,
39
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_template_state_boolean | (self, expected_state, template) | Test the setting of the state with boolean on. | Test the setting of the state with boolean on. | def test_template_state_boolean(self, expected_state, template):
"""Test the setting of the state with boolean on."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
... | [
"def",
"test_template_state_boolean",
"(",
"self",
",",
"expected_state",
",",
"template",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
... | [
140,
4
] | [
178,
44
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_template_syntax_error | (self) | Test templating syntax error. | Test templating syntax error. | def test_template_syntax_error(self):
"""Test templating syntax error."""
with assert_setup_component(0, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template"... | [
"def",
"test_template_syntax_error",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"pla... | [
180,
4
] | [
217,
43
] | python | ca | ['ca', 'de', 'en'] | False |
TestTemplateLight.test_invalid_name_does_not_create | (self) | Test invalid name. | Test invalid name. | def test_invalid_name_does_not_create(self):
"""Test invalid name."""
with assert_setup_component(0, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
... | [
"def",
"test_invalid_name_does_not_create",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
... | [
219,
4
] | [
256,
43
] | python | en | ['en', 'et', 'en'] | True |
TestTemplateLight.test_invalid_light_does_not_create | (self) | Test invalid light. | Test invalid light. | def test_invalid_light_does_not_create(self):
"""Test invalid light."""
with assert_setup_component(0, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
... | [
"def",
"test_invalid_light_does_not_create",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
... | [
258,
4
] | [
276,
43
] | python | en | ['en', 'et', 'en'] | True |
TestTemplateLight.test_no_lights_does_not_create | (self) | Test if there are no lights no creation. | Test if there are no lights no creation. | def test_no_lights_does_not_create(self):
"""Test if there are no lights no creation."""
with assert_setup_component(0, "light"):
assert setup.setup_component(
self.hass, "light", {"light": {"platform": "template"}}
)
self.hass.block_till_done()
s... | [
"def",
"test_no_lights_does_not_create",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\... | [
278,
4
] | [
289,
43
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_missing_key | (self, missing_key, count) | Test missing template. | Test missing template. | def test_missing_key(self, missing_key, count):
"""Test missing template."""
light = {
"light": {
"platform": "template",
"lights": {
"light_one": {
"value_template": "{{ 1== 1}}",
"turn_on": ... | [
"def",
"test_missing_key",
"(",
"self",
",",
"missing_key",
",",
"count",
")",
":",
"light",
"=",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"light_one\"",
":",
"{",
"\"value_template\"",
":",
"\"{{ 1== 1}}\... | [
294,
4
] | [
332,
47
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_on_action | (self) | Test on action. | Test on action. | def test_on_action(self):
"""Test on action."""
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
"lights": {
"test_template_light": {
... | [
"def",
"test_on_action",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"test_template_light\"",... | [
334,
4
] | [
376,
35
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_on_action_optimistic | (self) | Test on action with optimistic state. | Test on action with optimistic state. | def test_on_action_optimistic(self):
"""Test on action with optimistic state."""
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
"lights": {
"test_te... | [
"def",
"test_on_action_optimistic",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"test_templat... | [
378,
4
] | [
421,
38
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_off_action | (self) | Test off action. | Test off action. | def test_off_action(self):
"""Test off action."""
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
"lights": {
"test_template_light": {
... | [
"def",
"test_off_action",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"test_template_light\""... | [
423,
4
] | [
465,
35
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_off_action_optimistic | (self) | Test off action with optimistic state. | Test off action with optimistic state. | def test_off_action_optimistic(self):
"""Test off action with optimistic state."""
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
"lights": {
"test_... | [
"def",
"test_off_action_optimistic",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"test_templa... | [
467,
4
] | [
507,
39
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_white_value_action_no_template | (self) | Test setting white value with optimistic template. | Test setting white value with optimistic template. | def test_white_value_action_no_template(self):
"""Test setting white value with optimistic template."""
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
"lights": {
... | [
"def",
"test_white_value_action_no_template",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"te... | [
509,
4
] | [
556,
57
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_white_value_template | (self, expected_white_value, template) | Test the template for the white value. | Test the template for the white value. | def test_white_value_template(self, expected_white_value, template):
"""Test the template for the white value."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
... | [
"def",
"test_white_value_template",
"(",
"self",
",",
"expected_white_value",
",",
"template",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\""... | [
568,
4
] | [
608,
74
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_level_action_no_template | (self) | Test setting brightness with optimistic template. | Test setting brightness with optimistic template. | def test_level_action_no_template(self):
"""Test setting brightness with optimistic template."""
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
"lights": {
... | [
"def",
"test_level_action_no_template",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"test_tem... | [
610,
4
] | [
656,
56
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_level_template | (self, expected_level, template) | Test the template for the level. | Test the template for the level. | def test_level_template(self, expected_level, template):
"""Test the template for the level."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
... | [
"def",
"test_level_template",
"(",
"self",
",",
"expected_level",
",",
"template",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"... | [
668,
4
] | [
708,
67
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_temperature_template | (self, expected_temp, template) | Test the template for the temperature. | Test the template for the temperature. | def test_temperature_template(self, expected_temp, template):
"""Test the template for the temperature."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
... | [
"def",
"test_temperature_template",
"(",
"self",
",",
"expected_temp",
",",
"template",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
","... | [
721,
4
] | [
761,
66
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_temperature_action_no_template | (self) | Test setting temperature with optimistic template. | Test setting temperature with optimistic template. | def test_temperature_action_no_template(self):
"""Test setting temperature with optimistic template."""
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
"lights": {
... | [
"def",
"test_temperature_action_no_template",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"te... | [
763,
4
] | [
809,
56
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_friendly_name | (self) | Test the accessibility of the friendly_name attribute. | Test the accessibility of the friendly_name attribute. | def test_friendly_name(self):
"""Test the accessibility of the friendly_name attribute."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"plat... | [
"def",
"test_friendly_name",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\""... | [
811,
4
] | [
852,
72
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_icon_template | (self) | Test icon template. | Test icon template. | def test_icon_template(self):
"""Test icon template."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
... | [
"def",
"test_icon_template",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\""... | [
854,
4
] | [
903,
54
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_entity_picture_template | (self) | Test entity_picture template. | Test entity_picture template. | def test_entity_picture_template(self):
"""Test entity_picture template."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "templat... | [
"def",
"test_entity_picture_template",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"p... | [
905,
4
] | [
954,
71
] | python | en | ['fr', 'en', 'en'] | True |
TestTemplateLight.test_color_action_no_template | (self) | Test setting color with optimistic template. | Test setting color with optimistic template. | def test_color_action_no_template(self):
"""Test setting color with optimistic template."""
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"platform": "template",
"lights": {
... | [
"def",
"test_color_action_no_template",
"(",
"self",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",
"\"light\"",
":",
"{",
"\"platform\"",
":",
"\"template\"",
",",
"\"lights\"",
":",
"{",
"\"test_tem... | [
956,
4
] | [
1021,
44
] | python | en | ['en', 'en', 'en'] | True |
TestTemplateLight.test_color_template | (self, expected_hs, template) | Test the template for the color. | Test the template for the color. | def test_color_template(self, expected_hs, template):
"""Test the template for the color."""
with assert_setup_component(1, "light"):
assert setup.setup_component(
self.hass,
"light",
{
"light": {
"pl... | [
"def",
"test_color_template",
"(",
"self",
",",
"expected_hs",
",",
"template",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"light\"",
")",
":",
"assert",
"setup",
".",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"light\"",
",",
"{",... | [
1035,
4
] | [
1075,
62
] | python | en | ['en', 'en', 'en'] | True |
teardown | () | Stop everything that was started. | Stop everything that was started. | def teardown():
"""Stop everything that was started."""
dt_util.set_default_time_zone(DEFAULT_TIME_ZONE) | [
"def",
"teardown",
"(",
")",
":",
"dt_util",
".",
"set_default_time_zone",
"(",
"DEFAULT_TIME_ZONE",
")"
] | [
47,
0
] | [
49,
52
] | python | en | ['en', 'en', 'en'] | True |
test_track_point_in_time | (hass) | Test track point in time. | Test track point in time. | async def test_track_point_in_time(hass):
"""Test track point in time."""
before_birthday = datetime(1985, 7, 9, 12, 0, 0, tzinfo=dt_util.UTC)
birthday_paulus = datetime(1986, 7, 9, 12, 0, 0, tzinfo=dt_util.UTC)
after_birthday = datetime(1987, 7, 9, 12, 0, 0, tzinfo=dt_util.UTC)
runs = []
asyn... | [
"async",
"def",
"test_track_point_in_time",
"(",
"hass",
")",
":",
"before_birthday",
"=",
"datetime",
"(",
"1985",
",",
"7",
",",
"9",
",",
"12",
",",
"0",
",",
"0",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"birthday_paulus",
"=",
"datetime",
"... | [
52,
0
] | [
92,
25
] | python | en | ['en', 'en', 'en'] | True |
test_track_point_in_time_drift_rearm | (hass) | Test tasks with the time rolling backwards. | Test tasks with the time rolling backwards. | async def test_track_point_in_time_drift_rearm(hass):
"""Test tasks with the time rolling backwards."""
specific_runs = []
now = dt_util.utcnow()
time_that_will_not_match_right_away = datetime(
now.year + 1, 5, 24, 21, 59, 55, tzinfo=dt_util.UTC
)
async_track_point_in_utc_time(
... | [
"async",
"def",
"test_track_point_in_time_drift_rearm",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"time_that_will_not_match_right_away",
"=",
"datetime",
"(",
"now",
".",
"year",
"+",
"1",
",",
"5",
... | [
95,
0
] | [
124,
34
] | python | en | ['en', 'en', 'en'] | True |
test_track_state_change_from_to_state_match | (hass) | Test track_state_change with from and to state matchers. | Test track_state_change with from and to state matchers. | async def test_track_state_change_from_to_state_match(hass):
"""Test track_state_change with from and to state matchers."""
from_and_to_state_runs = []
only_from_runs = []
only_to_runs = []
match_all_runs = []
no_to_from_specified_runs = []
def from_and_to_state_callback(entity_id, old_stat... | [
"async",
"def",
"test_track_state_change_from_to_state_match",
"(",
"hass",
")",
":",
"from_and_to_state_runs",
"=",
"[",
"]",
"only_from_runs",
"=",
"[",
"]",
"only_to_runs",
"=",
"[",
"]",
"match_all_runs",
"=",
"[",
"]",
"no_to_from_specified_runs",
"=",
"[",
"... | [
127,
0
] | [
208,
46
] | python | en | ['en', 'en', 'en'] | True |
test_track_state_change | (hass) | Test track_state_change. | Test track_state_change. | async def test_track_state_change(hass):
"""Test track_state_change."""
# 2 lists to track how often our callbacks get called
specific_runs = []
wildcard_runs = []
wildercard_runs = []
def specific_run_callback(entity_id, old_state, new_state):
specific_runs.append(1)
# This is the... | [
"async",
"def",
"test_track_state_change",
"(",
"hass",
")",
":",
"# 2 lists to track how often our callbacks get called",
"specific_runs",
"=",
"[",
"]",
"wildcard_runs",
"=",
"[",
"]",
"wildercard_runs",
"=",
"[",
"]",
"def",
"specific_run_callback",
"(",
"entity_id",... | [
211,
0
] | [
288,
36
] | python | en | ['en', 'en', 'en'] | False |
test_async_track_state_change_filtered | (hass) | Test async_track_state_change_filtered. | Test async_track_state_change_filtered. | async def test_async_track_state_change_filtered(hass):
"""Test async_track_state_change_filtered."""
single_entity_id_tracker = []
multiple_entity_id_tracker = []
@ha.callback
def single_run_callback(event):
old_state = event.data.get("old_state")
new_state = event.data.get("new_st... | [
"async",
"def",
"test_async_track_state_change_filtered",
"(",
"hass",
")",
":",
"single_entity_id_tracker",
"=",
"[",
"]",
"multiple_entity_id_tracker",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"single_run_callback",
"(",
"event",
")",
":",
"old_state",
... | [
291,
0
] | [
424,
31
] | python | en | ['en', 'en', 'en'] | False |
test_async_track_state_change_event | (hass) | Test async_track_state_change_event. | Test async_track_state_change_event. | async def test_async_track_state_change_event(hass):
"""Test async_track_state_change_event."""
single_entity_id_tracker = []
multiple_entity_id_tracker = []
@ha.callback
def single_run_callback(event):
old_state = event.data.get("old_state")
new_state = event.data.get("new_state")
... | [
"async",
"def",
"test_async_track_state_change_event",
"(",
"hass",
")",
":",
"single_entity_id_tracker",
"=",
"[",
"]",
"multiple_entity_id_tracker",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"single_run_callback",
"(",
"event",
")",
":",
"old_state",
"="... | [
427,
0
] | [
517,
18
] | python | en | ['en', 'en', 'en'] | False |
test_async_track_state_change_event_with_empty_list | (hass) | Test async_track_state_change_event passing an empty list of entities. | Test async_track_state_change_event passing an empty list of entities. | async def test_async_track_state_change_event_with_empty_list(hass):
"""Test async_track_state_change_event passing an empty list of entities."""
unsub_single = async_track_state_change_event(
hass, [], ha.callback(lambda event: None)
)
unsub_single2 = async_track_state_change_event(
has... | [
"async",
"def",
"test_async_track_state_change_event_with_empty_list",
"(",
"hass",
")",
":",
"unsub_single",
"=",
"async_track_state_change_event",
"(",
"hass",
",",
"[",
"]",
",",
"ha",
".",
"callback",
"(",
"lambda",
"event",
":",
"None",
")",
")",
"unsub_singl... | [
520,
0
] | [
530,
18
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_state_added_domain | (hass) | Test async_track_state_added_domain. | Test async_track_state_added_domain. | async def test_async_track_state_added_domain(hass):
"""Test async_track_state_added_domain."""
single_entity_id_tracker = []
multiple_entity_id_tracker = []
@ha.callback
def single_run_callback(event):
old_state = event.data.get("old_state")
new_state = event.data.get("new_state")
... | [
"async",
"def",
"test_async_track_state_added_domain",
"(",
"hass",
")",
":",
"single_entity_id_tracker",
"=",
"[",
"]",
"multiple_entity_id_tracker",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"single_run_callback",
"(",
"event",
")",
":",
"old_state",
"="... | [
533,
0
] | [
612,
18
] | python | en | ['en', 'en', 'en'] | False |
test_async_track_state_added_domain_with_empty_list | (hass) | Test async_track_state_added_domain passing an empty list of domains. | Test async_track_state_added_domain passing an empty list of domains. | async def test_async_track_state_added_domain_with_empty_list(hass):
"""Test async_track_state_added_domain passing an empty list of domains."""
unsub_single = async_track_state_added_domain(
hass, [], ha.callback(lambda event: None)
)
unsub_single2 = async_track_state_added_domain(
hass... | [
"async",
"def",
"test_async_track_state_added_domain_with_empty_list",
"(",
"hass",
")",
":",
"unsub_single",
"=",
"async_track_state_added_domain",
"(",
"hass",
",",
"[",
"]",
",",
"ha",
".",
"callback",
"(",
"lambda",
"event",
":",
"None",
")",
")",
"unsub_singl... | [
615,
0
] | [
625,
18
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_state_removed_domain_with_empty_list | (hass) | Test async_track_state_removed_domain passing an empty list of domains. | Test async_track_state_removed_domain passing an empty list of domains. | async def test_async_track_state_removed_domain_with_empty_list(hass):
"""Test async_track_state_removed_domain passing an empty list of domains."""
unsub_single = async_track_state_removed_domain(
hass, [], ha.callback(lambda event: None)
)
unsub_single2 = async_track_state_removed_domain(
... | [
"async",
"def",
"test_async_track_state_removed_domain_with_empty_list",
"(",
"hass",
")",
":",
"unsub_single",
"=",
"async_track_state_removed_domain",
"(",
"hass",
",",
"[",
"]",
",",
"ha",
".",
"callback",
"(",
"lambda",
"event",
":",
"None",
")",
")",
"unsub_s... | [
628,
0
] | [
638,
18
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_state_removed_domain | (hass) | Test async_track_state_removed_domain. | Test async_track_state_removed_domain. | async def test_async_track_state_removed_domain(hass):
"""Test async_track_state_removed_domain."""
single_entity_id_tracker = []
multiple_entity_id_tracker = []
@ha.callback
def single_run_callback(event):
old_state = event.data.get("old_state")
new_state = event.data.get("new_stat... | [
"async",
"def",
"test_async_track_state_removed_domain",
"(",
"hass",
")",
":",
"single_entity_id_tracker",
"=",
"[",
"]",
"multiple_entity_id_tracker",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"single_run_callback",
"(",
"event",
")",
":",
"old_state",
"... | [
641,
0
] | [
720,
18
] | python | en | ['en', 'en', 'en'] | False |
test_async_track_state_removed_domain_match_all | (hass) | Test async_track_state_removed_domain with a match_all. | Test async_track_state_removed_domain with a match_all. | async def test_async_track_state_removed_domain_match_all(hass):
"""Test async_track_state_removed_domain with a match_all."""
single_entity_id_tracker = []
match_all_entity_id_tracker = []
@ha.callback
def single_run_callback(event):
old_state = event.data.get("old_state")
new_stat... | [
"async",
"def",
"test_async_track_state_removed_domain_match_all",
"(",
"hass",
")",
":",
"single_entity_id_tracker",
"=",
"[",
"]",
"match_all_entity_id_tracker",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"single_run_callback",
"(",
"event",
")",
":",
"old_... | [
723,
0
] | [
764,
48
] | python | en | ['en', 'en', 'en'] | True |
test_track_template | (hass) | Test tracking template. | Test tracking template. | async def test_track_template(hass):
"""Test tracking template."""
specific_runs = []
wildcard_runs = []
wildercard_runs = []
template_condition = Template("{{states.switch.test.state == 'on'}}", hass)
template_condition_var = Template(
"{{states.switch.test.state == 'on' and test == 5}... | [
"async",
"def",
"test_track_template",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"wildcard_runs",
"=",
"[",
"]",
"wildercard_runs",
"=",
"[",
"]",
"template_condition",
"=",
"Template",
"(",
"\"{{states.switch.test.state == 'on'}}\"",
",",
"hass",
")"... | [
767,
0
] | [
849,
44
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_error | (hass, caplog) | Test tracking template with error. | Test tracking template with error. | async def test_track_template_error(hass, caplog):
"""Test tracking template with error."""
template_error = Template("{{ (states.switch | lunch) > 0 }}", hass)
error_calls = []
@ha.callback
def error_callback(entity_id, old_state, new_state):
error_calls.append((entity_id, old_state, new_s... | [
"async",
"def",
"test_track_template_error",
"(",
"hass",
",",
"caplog",
")",
":",
"template_error",
"=",
"Template",
"(",
"\"{{ (states.switch | lunch) > 0 }}\"",
",",
"hass",
")",
"error_calls",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"error_callback",... | [
852,
0
] | [
880,
54
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_error_can_recover | (hass, caplog) | Test tracking template with error. | Test tracking template with error. | async def test_track_template_error_can_recover(hass, caplog):
"""Test tracking template with error."""
hass.states.async_set("switch.data_system", "cow", {"opmode": 0})
template_error = Template(
"{{ states.sensor.data_system.attributes['opmode'] == '0' }}", hass
)
error_calls = []
@ha... | [
"async",
"def",
"test_track_template_error_can_recover",
"(",
"hass",
",",
"caplog",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"switch.data_system\"",
",",
"\"cow\"",
",",
"{",
"\"opmode\"",
":",
"0",
"}",
")",
"template_error",
"=",
"Template",
... | [
883,
0
] | [
907,
46
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_result | (hass) | Test tracking template. | Test tracking template. | async def test_track_template_result(hass):
"""Test tracking template."""
specific_runs = []
wildcard_runs = []
wildercard_runs = []
template_condition = Template("{{states.sensor.test.state}}", hass)
template_condition_var = Template(
"{{(states.sensor.test.state|int) + test }}", hass
... | [
"async",
"def",
"test_track_template_result",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"wildcard_runs",
"=",
"[",
"]",
"wildercard_runs",
"=",
"[",
"]",
"template_condition",
"=",
"Template",
"(",
"\"{{states.sensor.test.state}}\"",
",",
"hass",
")",... | [
910,
0
] | [
993,
36
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_result_complex | (hass) | Test tracking template. | Test tracking template. | async def test_track_template_result_complex(hass):
"""Test tracking template."""
specific_runs = []
template_complex_str = """
{% if states("sensor.domain") == "light" %}
{{ states.light | map(attribute='entity_id') | list }}
{% elif states("sensor.domain") == "lock" %}
{{ states.lock | map(attribute='... | [
"async",
"def",
"test_track_template_result_complex",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"template_complex_str",
"=",
"\"\"\"\n{% if states(\"sensor.domain\") == \"light\" %}\n {{ states.light | map(attribute='entity_id') | list }}\n{% elif states(\"sensor.domain\") ==... | [
996,
0
] | [
1149,
5
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_result_with_wildcard | (hass) | Test tracking template with a wildcard. | Test tracking template with a wildcard. | async def test_track_template_result_with_wildcard(hass):
"""Test tracking template with a wildcard."""
specific_runs = []
template_complex_str = r"""
{% for state in states %}
{% if state.entity_id | regex_match('.*\.office_') %}
{{ state.entity_id }}={{ state.state }}
{% endif %}
{% endfor %}
""... | [
"async",
"def",
"test_track_template_result_with_wildcard",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"template_complex_str",
"=",
"r\"\"\"\n\n{% for state in states %}\n {% if state.entity_id | regex_match('.*\\.office_') %}\n {{ state.entity_id }}={{ state.state }}\n {%... | [
1152,
0
] | [
1190,
59
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_result_with_group | (hass) | Test tracking template with a group. | Test tracking template with a group. | async def test_track_template_result_with_group(hass):
"""Test tracking template with a group."""
hass.states.async_set("sensor.power_1", 0)
hass.states.async_set("sensor.power_2", 200.2)
hass.states.async_set("sensor.power_3", 400.4)
hass.states.async_set("sensor.power_4", 800.8)
assert await ... | [
"async",
"def",
"test_track_template_result_with_group",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.power_1\"",
",",
"0",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.power_2\"",
",",
"200.2",
")",
"hass",
".... | [
1193,
0
] | [
1263,
57
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_result_and_conditional | (hass) | Test tracking template with an and conditional. | Test tracking template with an and conditional. | async def test_track_template_result_and_conditional(hass):
"""Test tracking template with an and conditional."""
specific_runs = []
hass.states.async_set("light.a", "off")
hass.states.async_set("light.b", "off")
template_str = '{% if states.light.a.state == "on" and states.light.b.state == "on" %}o... | [
"async",
"def",
"test_track_template_result_and_conditional",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.a\"",
",",
"\"off\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.b\"",
... | [
1266,
0
] | [
1326,
35
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_result_iterator | (hass) | Test tracking template. | Test tracking template. | async def test_track_template_result_iterator(hass):
"""Test tracking template."""
iterator_runs = []
@ha.callback
def iterator_callback(event, updates):
iterator_runs.append(updates.pop().result)
async_track_template_result(
hass,
[
TrackTemplate(
... | [
"async",
"def",
"test_track_template_result_iterator",
"(",
"hass",
")",
":",
"iterator_runs",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"iterator_callback",
"(",
"event",
",",
"updates",
")",
":",
"iterator_runs",
".",
"append",
"(",
"updates",
".",
... | [
1329,
0
] | [
1402,
44
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_result_errors | (hass, caplog) | Test tracking template with errors in the template. | Test tracking template with errors in the template. | async def test_track_template_result_errors(hass, caplog):
"""Test tracking template with errors in the template."""
template_syntax_error = Template("{{states.switch", hass)
template_not_exist = Template("{{states.switch.not_exist.state }}", hass)
syntax_error_runs = []
not_exist_runs = []
@... | [
"async",
"def",
"test_track_template_result_errors",
"(",
"hass",
",",
"caplog",
")",
":",
"template_syntax_error",
"=",
"Template",
"(",
"\"{{states.switch\"",
",",
"hass",
")",
"template_not_exist",
"=",
"Template",
"(",
"\"{{states.switch.not_exist.state }}\"",
",",
... | [
1405,
0
] | [
1485,
62
] | python | en | ['en', 'en', 'en'] | True |
test_static_string | (hass) | Test a static string. | Test a static string. | async def test_static_string(hass):
"""Test a static string."""
template_refresh = Template("{{ 'static' }}", hass)
refresh_runs = []
@ha.callback
def refresh_listener(event, updates):
refresh_runs.append(updates.pop().result)
info = async_track_template_result(
hass, [TrackTe... | [
"async",
"def",
"test_static_string",
"(",
"hass",
")",
":",
"template_refresh",
"=",
"Template",
"(",
"\"{{ 'static' }}\"",
",",
"hass",
")",
"refresh_runs",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"refresh_listener",
"(",
"event",
",",
"updates",
... | [
1488,
0
] | [
1505,
37
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_rate_limit | (hass) | Test template rate limit. | Test template rate limit. | async def test_track_template_rate_limit(hass):
"""Test template rate limit."""
template_refresh = Template("{{ states | count }}", hass)
refresh_runs = []
@ha.callback
def refresh_listener(event, updates):
refresh_runs.append(updates.pop().result)
info = async_track_template_result(
... | [
"async",
"def",
"test_track_template_rate_limit",
"(",
"hass",
")",
":",
"template_refresh",
"=",
"Template",
"(",
"\"{{ states | count }}\"",
",",
"hass",
")",
"refresh_runs",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"refresh_listener",
"(",
"event",
"... | [
1508,
0
] | [
1558,
39
] | python | en | ['it', 'en', 'en'] | True |
test_track_template_rate_limit_suppress_listener | (hass) | Test template rate limit will suppress the listener during the rate limit. | Test template rate limit will suppress the listener during the rate limit. | async def test_track_template_rate_limit_suppress_listener(hass):
"""Test template rate limit will suppress the listener during the rate limit."""
template_refresh = Template("{{ states | count }}", hass)
refresh_runs = []
@ha.callback
def refresh_listener(event, updates):
refresh_runs.app... | [
"async",
"def",
"test_track_template_rate_limit_suppress_listener",
"(",
"hass",
")",
":",
"template_refresh",
"=",
"Template",
"(",
"\"{{ states | count }}\"",
",",
"hass",
")",
"refresh_runs",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"refresh_listener",
"... | [
1561,
0
] | [
1653,
39
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_rate_limit_five | (hass) | Test template rate limit of 5 seconds. | Test template rate limit of 5 seconds. | async def test_track_template_rate_limit_five(hass):
"""Test template rate limit of 5 seconds."""
template_refresh = Template("{{ states | count }}", hass)
refresh_runs = []
@ha.callback
def refresh_listener(event, updates):
refresh_runs.append(updates.pop().result)
info = async_track... | [
"async",
"def",
"test_track_template_rate_limit_five",
"(",
"hass",
")",
":",
"template_refresh",
"=",
"Template",
"(",
"\"{{ states | count }}\"",
",",
"hass",
")",
"refresh_runs",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"refresh_listener",
"(",
"event"... | [
1656,
0
] | [
1686,
33
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_has_default_rate_limit | (hass) | Test template has a rate limit by default. | Test template has a rate limit by default. | async def test_track_template_has_default_rate_limit(hass):
"""Test template has a rate limit by default."""
hass.states.async_set("sensor.zero", "any")
template_refresh = Template("{{ states | list | count }}", hass)
refresh_runs = []
@ha.callback
def refresh_listener(event, updates):
... | [
"async",
"def",
"test_track_template_has_default_rate_limit",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.zero\"",
",",
"\"any\"",
")",
"template_refresh",
"=",
"Template",
"(",
"\"{{ states | list | count }}\"",
",",
"hass",
")",
... | [
1689,
0
] | [
1720,
33
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_unavailable_sates_has_default_rate_limit | (hass) | Test template watching for unavailable states has a rate limit by default. | Test template watching for unavailable states has a rate limit by default. | async def test_track_template_unavailable_sates_has_default_rate_limit(hass):
"""Test template watching for unavailable states has a rate limit by default."""
hass.states.async_set("sensor.zero", "unknown")
template_refresh = Template(
"{{ states | selectattr('state', 'in', ['unavailable', 'unknown'... | [
"async",
"def",
"test_track_template_unavailable_sates_has_default_rate_limit",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.zero\"",
",",
"\"unknown\"",
")",
"template_refresh",
"=",
"Template",
"(",
"\"{{ states | selectattr('state', 'in'... | [
1723,
0
] | [
1761,
23
] | python | en | ['en', 'en', 'en'] | True |
test_specifically_referenced_entity_is_not_rate_limited | (hass) | Test template rate limit of 5 seconds. | Test template rate limit of 5 seconds. | async def test_specifically_referenced_entity_is_not_rate_limited(hass):
"""Test template rate limit of 5 seconds."""
hass.states.async_set("sensor.one", "none")
template_refresh = Template('{{ states | count }}_{{ states("sensor.one") }}', hass)
refresh_runs = []
@ha.callback
def refresh_lis... | [
"async",
"def",
"test_specifically_referenced_entity_is_not_rate_limited",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.one\"",
",",
"\"none\"",
")",
"template_refresh",
"=",
"Template",
"(",
"'{{ states | count }}_{{ states(\"sensor.one\")... | [
1764,
0
] | [
1800,
23
] | python | en | ['en', 'en', 'en'] | True |
test_track_two_templates_with_different_rate_limits | (hass) | Test two templates with different rate limits. | Test two templates with different rate limits. | async def test_track_two_templates_with_different_rate_limits(hass):
"""Test two templates with different rate limits."""
template_one = Template("{{ (states | count) + 0 }}", hass)
template_five = Template("{{ states | count }}", hass)
refresh_runs = {
template_one: [],
template_five: ... | [
"async",
"def",
"test_track_two_templates_with_different_rate_limits",
"(",
"hass",
")",
":",
"template_one",
"=",
"Template",
"(",
"\"{{ (states | count) + 0 }}\"",
",",
"hass",
")",
"template_five",
"=",
"Template",
"(",
"\"{{ states | count }}\"",
",",
"hass",
")",
"... | [
1803,
0
] | [
1865,
23
] | python | en | ['en', 'en', 'en'] | True |
test_string | (hass) | Test a string. | Test a string. | async def test_string(hass):
"""Test a string."""
template_refresh = Template("no_template", hass)
refresh_runs = []
@ha.callback
def refresh_listener(event, updates):
refresh_runs.append(updates.pop().result)
info = async_track_template_result(
hass, [TrackTemplate(template_r... | [
"async",
"def",
"test_string",
"(",
"hass",
")",
":",
"template_refresh",
"=",
"Template",
"(",
"\"no_template\"",
",",
"hass",
")",
"refresh_runs",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"refresh_listener",
"(",
"event",
",",
"updates",
")",
":... | [
1868,
0
] | [
1885,
42
] | python | en | ['en', 'cy', 'en'] | True |
test_track_template_result_refresh_cancel | (hass) | Test cancelling and refreshing result. | Test cancelling and refreshing result. | async def test_track_template_result_refresh_cancel(hass):
"""Test cancelling and refreshing result."""
template_refresh = Template("{{states.switch.test.state == 'on' and now() }}", hass)
refresh_runs = []
@ha.callback
def refresh_listener(event, updates):
refresh_runs.append(updates.pop(... | [
"async",
"def",
"test_track_template_result_refresh_cancel",
"(",
"hass",
")",
":",
"template_refresh",
"=",
"Template",
"(",
"\"{{states.switch.test.state == 'on' and now() }}\"",
",",
"hass",
")",
"refresh_runs",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"re... | [
1888,
0
] | [
1939,
35
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_template_result_multiple_templates | (hass) | Test tracking multiple templates. | Test tracking multiple templates. | async def test_async_track_template_result_multiple_templates(hass):
"""Test tracking multiple templates."""
template_1 = Template("{{ states.switch.test.state == 'on' }}")
template_2 = Template("{{ states.switch.test.state == 'on' }}")
template_3 = Template("{{ states.switch.test.state == 'off' }}")
... | [
"async",
"def",
"test_async_track_template_result_multiple_templates",
"(",
"hass",
")",
":",
"template_1",
"=",
"Template",
"(",
"\"{{ states.switch.test.state == 'on' }}\"",
")",
"template_2",
"=",
"Template",
"(",
"\"{{ states.switch.test.state == 'on' }}\"",
")",
"template_... | [
1942,
0
] | [
1998,
5
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_template_result_multiple_templates_mixing_domain | (hass) | Test tracking multiple templates when tracking entities and an entire domain. | Test tracking multiple templates when tracking entities and an entire domain. | async def test_async_track_template_result_multiple_templates_mixing_domain(hass):
"""Test tracking multiple templates when tracking entities and an entire domain."""
template_1 = Template("{{ states.switch.test.state == 'on' }}")
template_2 = Template("{{ states.switch.test.state == 'on' }}")
template... | [
"async",
"def",
"test_async_track_template_result_multiple_templates_mixing_domain",
"(",
"hass",
")",
":",
"template_1",
"=",
"Template",
"(",
"\"{{ states.switch.test.state == 'on' }}\"",
")",
"template_2",
"=",
"Template",
"(",
"\"{{ states.switch.test.state == 'on' }}\"",
")"... | [
2001,
0
] | [
2066,
5
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_template_result_raise_on_template_error | (hass) | Test that we raise as soon as we encounter a failed template. | Test that we raise as soon as we encounter a failed template. | async def test_async_track_template_result_raise_on_template_error(hass):
"""Test that we raise as soon as we encounter a failed template."""
with pytest.raises(TemplateError):
async_track_template_result(
hass,
[
TrackTemplate(
Template(
... | [
"async",
"def",
"test_async_track_template_result_raise_on_template_error",
"(",
"hass",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"TemplateError",
")",
":",
"async_track_template_result",
"(",
"hass",
",",
"[",
"TrackTemplate",
"(",
"Template",
"(",
"\"{{ state... | [
2069,
0
] | [
2085,
9
] | python | en | ['en', 'gd', 'en'] | True |
test_track_template_with_time | (hass) | Test tracking template with time. | Test tracking template with time. | async def test_track_template_with_time(hass):
"""Test tracking template with time."""
hass.states.async_set("switch.test", "on")
specific_runs = []
template_complex = Template("{{ states.switch.test.state and now() }}", hass)
def specific_run_callback(event, updates):
specific_runs.append... | [
"async",
"def",
"test_track_template_with_time",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"switch.test\"",
",",
"\"on\"",
")",
"specific_runs",
"=",
"[",
"]",
"template_complex",
"=",
"Template",
"(",
"\"{{ states.switch.test.state and ... | [
2088,
0
] | [
2116,
23
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_with_time_default | (hass) | Test tracking template with time. | Test tracking template with time. | async def test_track_template_with_time_default(hass):
"""Test tracking template with time."""
specific_runs = []
template_complex = Template("{{ now() }}", hass)
def specific_run_callback(event, updates):
specific_runs.append(updates.pop().result)
info = async_track_template_result(
... | [
"async",
"def",
"test_track_template_with_time_default",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"template_complex",
"=",
"Template",
"(",
"\"{{ now() }}\"",
",",
"hass",
")",
"def",
"specific_run_callback",
"(",
"event",
",",
"updates",
")",
":",
... | [
2119,
0
] | [
2152,
23
] | python | en | ['en', 'en', 'en'] | True |
test_track_template_with_time_that_leaves_scope | (hass) | Test tracking template with time. | Test tracking template with time. | async def test_track_template_with_time_that_leaves_scope(hass):
"""Test tracking template with time."""
now = dt_util.utcnow()
test_time = datetime(now.year + 1, 5, 24, 11, 59, 1, 500000, tzinfo=dt_util.UTC)
with patch("homeassistant.util.dt.utcnow", return_value=test_time):
hass.states.async_... | [
"async",
"def",
"test_track_template_with_time_that_leaves_scope",
"(",
"hass",
")",
":",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"test_time",
"=",
"datetime",
"(",
"now",
".",
"year",
"+",
"1",
",",
"5",
",",
"24",
",",
"11",
",",
"59",
",",
"... | [
2155,
0
] | [
2225,
23
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_template_result_multiple_templates_mixing_listeners | (hass) | Test tracking multiple templates with mixing listener types. | Test tracking multiple templates with mixing listener types. | async def test_async_track_template_result_multiple_templates_mixing_listeners(hass):
"""Test tracking multiple templates with mixing listener types."""
template_1 = Template("{{ states.switch.test.state == 'on' }}")
template_2 = Template("{{ now() and True }}")
refresh_runs = []
@ha.callback
... | [
"async",
"def",
"test_async_track_template_result_multiple_templates_mixing_listeners",
"(",
"hass",
")",
":",
"template_1",
"=",
"Template",
"(",
"\"{{ states.switch.test.state == 'on' }}\"",
")",
"template_2",
"=",
"Template",
"(",
"\"{{ now() and True }}\"",
")",
"refresh_ru... | [
2228,
0
] | [
2293,
5
] | python | en | ['en', 'en', 'en'] | True |
test_track_same_state_simple_no_trigger | (hass) | Test track_same_change with no trigger. | Test track_same_change with no trigger. | async def test_track_same_state_simple_no_trigger(hass):
"""Test track_same_change with no trigger."""
callback_runs = []
period = timedelta(minutes=1)
@ha.callback
def callback_run_callback():
callback_runs.append(1)
async_track_same_state(
hass,
period,
callba... | [
"async",
"def",
"test_track_same_state_simple_no_trigger",
"(",
"hass",
")",
":",
"callback_runs",
"=",
"[",
"]",
"period",
"=",
"timedelta",
"(",
"minutes",
"=",
"1",
")",
"@",
"ha",
".",
"callback",
"def",
"callback_run_callback",
"(",
")",
":",
"callback_ru... | [
2296,
0
] | [
2327,
34
] | python | en | ['en', 'en', 'en'] | True |
test_track_same_state_simple_trigger_check_funct | (hass) | Test track_same_change with trigger and check funct. | Test track_same_change with trigger and check funct. | async def test_track_same_state_simple_trigger_check_funct(hass):
"""Test track_same_change with trigger and check funct."""
callback_runs = []
check_func = []
period = timedelta(minutes=1)
@ha.callback
def callback_run_callback():
callback_runs.append(1)
@ha.callback
def async... | [
"async",
"def",
"test_track_same_state_simple_trigger_check_funct",
"(",
"hass",
")",
":",
"callback_runs",
"=",
"[",
"]",
"check_func",
"=",
"[",
"]",
"period",
"=",
"timedelta",
"(",
"minutes",
"=",
"1",
")",
"@",
"ha",
".",
"callback",
"def",
"callback_run_... | [
2330,
0
] | [
2365,
34
] | python | en | ['en', 'en', 'en'] | True |
test_track_time_interval | (hass) | Test tracking time interval. | Test tracking time interval. | async def test_track_time_interval(hass):
"""Test tracking time interval."""
specific_runs = []
utc_now = dt_util.utcnow()
unsub = async_track_time_interval(
hass, callback(lambda x: specific_runs.append(x)), timedelta(seconds=10)
)
async_fire_time_changed(hass, utc_now + timedelta(sec... | [
"async",
"def",
"test_track_time_interval",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"utc_now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"unsub",
"=",
"async_track_time_interval",
"(",
"hass",
",",
"callback",
"(",
"lambda",
"x",
":",
"specific... | [
2368,
0
] | [
2393,
34
] | python | en | ['vi', 'en', 'en'] | True |
test_track_sunrise | (hass, legacy_patchable_time) | Test track the sunrise. | Test track the sunrise. | async def test_track_sunrise(hass, legacy_patchable_time):
"""Test track the sunrise."""
latitude = 32.87336
longitude = 117.22743
# Setup sun component
hass.config.latitude = latitude
hass.config.longitude = longitude
assert await async_setup_component(
hass, sun.DOMAIN, {sun.DOMAI... | [
"async",
"def",
"test_track_sunrise",
"(",
"hass",
",",
"legacy_patchable_time",
")",
":",
"latitude",
"=",
"32.87336",
"longitude",
"=",
"117.22743",
"# Setup sun component",
"hass",
".",
"config",
".",
"latitude",
"=",
"latitude",
"hass",
".",
"config",
".",
"... | [
2396,
0
] | [
2456,
32
] | python | en | ['en', 'zu', 'en'] | True |
test_track_sunrise_update_location | (hass, legacy_patchable_time) | Test track the sunrise. | Test track the sunrise. | async def test_track_sunrise_update_location(hass, legacy_patchable_time):
"""Test track the sunrise."""
# Setup sun component
hass.config.latitude = 32.87336
hass.config.longitude = 117.22743
assert await async_setup_component(
hass, sun.DOMAIN, {sun.DOMAIN: {sun.CONF_ELEVATION: 0}}
)
... | [
"async",
"def",
"test_track_sunrise_update_location",
"(",
"hass",
",",
"legacy_patchable_time",
")",
":",
"# Setup sun component",
"hass",
".",
"config",
".",
"latitude",
"=",
"32.87336",
"hass",
".",
"config",
".",
"longitude",
"=",
"117.22743",
"assert",
"await",... | [
2459,
0
] | [
2516,
25
] | python | en | ['en', 'zu', 'en'] | True |
test_track_sunset | (hass, legacy_patchable_time) | Test track the sunset. | Test track the sunset. | async def test_track_sunset(hass, legacy_patchable_time):
"""Test track the sunset."""
latitude = 32.87336
longitude = 117.22743
# Setup sun component
hass.config.latitude = latitude
hass.config.longitude = longitude
assert await async_setup_component(
hass, sun.DOMAIN, {sun.DOMAIN:... | [
"async",
"def",
"test_track_sunset",
"(",
"hass",
",",
"legacy_patchable_time",
")",
":",
"latitude",
"=",
"32.87336",
"longitude",
"=",
"117.22743",
"# Setup sun component",
"hass",
".",
"config",
".",
"latitude",
"=",
"latitude",
"hass",
".",
"config",
".",
"l... | [
2519,
0
] | [
2579,
32
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_time_change | (hass) | Test tracking time change. | Test tracking time change. | async def test_async_track_time_change(hass):
"""Test tracking time change."""
wildcard_runs = []
specific_runs = []
now = dt_util.utcnow()
time_that_will_not_match_right_away = datetime(
now.year + 1, 5, 24, 11, 59, 55, tzinfo=dt_util.UTC
)
with patch(
"homeassistant.util... | [
"async",
"def",
"test_async_track_time_change",
"(",
"hass",
")",
":",
"wildcard_runs",
"=",
"[",
"]",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"time_that_will_not_match_right_away",
"=",
"datetime",
"(",
"now",
".",
"yea... | [
2582,
0
] | [
2632,
34
] | python | en | ['vi', 'en', 'en'] | True |
test_periodic_task_minute | (hass) | Test periodic tasks per minute. | Test periodic tasks per minute. | async def test_periodic_task_minute(hass):
"""Test periodic tasks per minute."""
specific_runs = []
now = dt_util.utcnow()
time_that_will_not_match_right_away = datetime(
now.year + 1, 5, 24, 11, 59, 55, tzinfo=dt_util.UTC
)
with patch(
"homeassistant.util.dt.utcnow", return_v... | [
"async",
"def",
"test_periodic_task_minute",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"time_that_will_not_match_right_away",
"=",
"datetime",
"(",
"now",
".",
"year",
"+",
"1",
",",
"5",
",",
"2... | [
2635,
0
] | [
2676,
34
] | python | ca | ['ca', 'la', 'it'] | False |
test_periodic_task_hour | (hass) | Test periodic tasks per hour. | Test periodic tasks per hour. | async def test_periodic_task_hour(hass):
"""Test periodic tasks per hour."""
specific_runs = []
now = dt_util.utcnow()
time_that_will_not_match_right_away = datetime(
now.year + 1, 5, 24, 21, 59, 55, tzinfo=dt_util.UTC
)
with patch(
"homeassistant.util.dt.utcnow", return_value... | [
"async",
"def",
"test_periodic_task_hour",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"time_that_will_not_match_right_away",
"=",
"datetime",
"(",
"now",
".",
"year",
"+",
"1",
",",
"5",
",",
"24"... | [
2679,
0
] | [
2736,
34
] | python | en | ['en', 'la', 'it'] | False |
test_periodic_task_wrong_input | (hass) | Test periodic tasks with wrong input. | Test periodic tasks with wrong input. | async def test_periodic_task_wrong_input(hass):
"""Test periodic tasks with wrong input."""
specific_runs = []
now = dt_util.utcnow()
with pytest.raises(ValueError):
async_track_utc_time_change(
hass, callback(lambda x: specific_runs.append(x)), hour="/two"
)
async_fir... | [
"async",
"def",
"test_periodic_task_wrong_input",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"with",
"pytest",
".",
"raises",
"(",
"ValueError",
")",
":",
"async_track_utc_time_change",
"(",
"hass",
... | [
2739,
0
] | [
2754,
34
] | python | en | ['en', 'en', 'en'] | True |
test_periodic_task_clock_rollback | (hass) | Test periodic tasks with the time rolling backwards. | Test periodic tasks with the time rolling backwards. | async def test_periodic_task_clock_rollback(hass):
"""Test periodic tasks with the time rolling backwards."""
specific_runs = []
now = dt_util.utcnow()
time_that_will_not_match_right_away = datetime(
now.year + 1, 5, 24, 21, 59, 55, tzinfo=dt_util.UTC
)
with patch(
"homeassist... | [
"async",
"def",
"test_periodic_task_clock_rollback",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"time_that_will_not_match_right_away",
"=",
"datetime",
"(",
"now",
".",
"year",
"+",
"1",
",",
"5",
"... | [
2757,
0
] | [
2818,
34
] | python | en | ['en', 'en', 'en'] | True |
test_periodic_task_duplicate_time | (hass) | Test periodic tasks not triggering on duplicate time. | Test periodic tasks not triggering on duplicate time. | async def test_periodic_task_duplicate_time(hass):
"""Test periodic tasks not triggering on duplicate time."""
specific_runs = []
now = dt_util.utcnow()
time_that_will_not_match_right_away = datetime(
now.year + 1, 5, 24, 21, 59, 55, tzinfo=dt_util.UTC
)
with patch(
"homeassis... | [
"async",
"def",
"test_periodic_task_duplicate_time",
"(",
"hass",
")",
":",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"time_that_will_not_match_right_away",
"=",
"datetime",
"(",
"now",
".",
"year",
"+",
"1",
",",
"5",
"... | [
2821,
0
] | [
2860,
11
] | python | en | ['en', 'en', 'en'] | True |
test_periodic_task_entering_dst | (hass) | Test periodic task behavior when entering dst. | Test periodic task behavior when entering dst. | async def test_periodic_task_entering_dst(hass):
"""Test periodic task behavior when entering dst."""
timezone = dt_util.get_time_zone("Europe/Vienna")
dt_util.set_default_time_zone(timezone)
specific_runs = []
now = dt_util.utcnow()
time_that_will_not_match_right_away = timezone.localize(
... | [
"async",
"def",
"test_periodic_task_entering_dst",
"(",
"hass",
")",
":",
"timezone",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"\"Europe/Vienna\"",
")",
"dt_util",
".",
"set_default_time_zone",
"(",
"timezone",
")",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
... | [
2863,
0
] | [
2909,
11
] | python | en | ['en', 'en', 'en'] | True |
test_periodic_task_leaving_dst | (hass) | Test periodic task behavior when leaving dst. | Test periodic task behavior when leaving dst. | async def test_periodic_task_leaving_dst(hass):
"""Test periodic task behavior when leaving dst."""
timezone = dt_util.get_time_zone("Europe/Vienna")
dt_util.set_default_time_zone(timezone)
specific_runs = []
now = dt_util.utcnow()
time_that_will_not_match_right_away = timezone.localize(
... | [
"async",
"def",
"test_periodic_task_leaving_dst",
"(",
"hass",
")",
":",
"timezone",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"\"Europe/Vienna\"",
")",
"dt_util",
".",
"set_default_time_zone",
"(",
"timezone",
")",
"specific_runs",
"=",
"[",
"]",
"now",
"=",
"... | [
2912,
0
] | [
2980,
11
] | python | en | ['en', 'en', 'en'] | True |
test_call_later | (hass) | Test calling an action later. | Test calling an action later. | async def test_call_later(hass):
"""Test calling an action later."""
def action():
pass
now = datetime(2017, 12, 19, 15, 40, 0, tzinfo=dt_util.UTC)
with patch(
"homeassistant.helpers.event.async_track_point_in_utc_time"
) as mock, patch("homeassistant.util.dt.utcnow", return_value... | [
"async",
"def",
"test_call_later",
"(",
"hass",
")",
":",
"def",
"action",
"(",
")",
":",
"pass",
"now",
"=",
"datetime",
"(",
"2017",
",",
"12",
",",
"19",
",",
"15",
",",
"40",
",",
"0",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"with",
... | [
2983,
0
] | [
3000,
48
] | python | en | ['en', 'en', 'en'] | True |
test_async_call_later | (hass) | Test calling an action later. | Test calling an action later. | async def test_async_call_later(hass):
"""Test calling an action later."""
def action():
pass
now = datetime(2017, 12, 19, 15, 40, 0, tzinfo=dt_util.UTC)
with patch(
"homeassistant.helpers.event.async_track_point_in_utc_time"
) as mock, patch("homeassistant.util.dt.utcnow", return... | [
"async",
"def",
"test_async_call_later",
"(",
"hass",
")",
":",
"def",
"action",
"(",
")",
":",
"pass",
"now",
"=",
"datetime",
"(",
"2017",
",",
"12",
",",
"19",
",",
"15",
",",
"40",
",",
"0",
",",
"tzinfo",
"=",
"dt_util",
".",
"UTC",
")",
"wi... | [
3003,
0
] | [
3021,
27
] | python | en | ['en', 'en', 'en'] | True |
test_track_state_change_event_chain_multple_entity | (hass) | Test that adding a new state tracker inside a tracker does not fire right away. | Test that adding a new state tracker inside a tracker does not fire right away. | async def test_track_state_change_event_chain_multple_entity(hass):
"""Test that adding a new state tracker inside a tracker does not fire right away."""
tracker_called = []
chained_tracker_called = []
chained_tracker_unsub = []
tracker_unsub = []
@ha.callback
def chained_single_run_callba... | [
"async",
"def",
"test_track_state_change_event_chain_multple_entity",
"(",
"hass",
")",
":",
"tracker_called",
"=",
"[",
"]",
"chained_tracker_called",
"=",
"[",
"]",
"chained_tracker_unsub",
"=",
"[",
"]",
"tracker_unsub",
"=",
"[",
"]",
"@",
"ha",
".",
"callback... | [
3024,
0
] | [
3073,
42
] | python | en | ['en', 'en', 'en'] | True |
test_track_state_change_event_chain_single_entity | (hass) | Test that adding a new state tracker inside a tracker does not fire right away. | Test that adding a new state tracker inside a tracker does not fire right away. | async def test_track_state_change_event_chain_single_entity(hass):
"""Test that adding a new state tracker inside a tracker does not fire right away."""
tracker_called = []
chained_tracker_called = []
chained_tracker_unsub = []
tracker_unsub = []
@ha.callback
def chained_single_run_callbac... | [
"async",
"def",
"test_track_state_change_event_chain_single_entity",
"(",
"hass",
")",
":",
"tracker_called",
"=",
"[",
"]",
"chained_tracker_called",
"=",
"[",
"]",
"chained_tracker_unsub",
"=",
"[",
"]",
"tracker_unsub",
"=",
"[",
"]",
"@",
"ha",
".",
"callback"... | [
3076,
0
] | [
3122,
42
] | python | en | ['en', 'en', 'en'] | True |
test_track_point_in_utc_time_cancel | (hass) | Test cancel of async track point in time. | Test cancel of async track point in time. | async def test_track_point_in_utc_time_cancel(hass):
"""Test cancel of async track point in time."""
times = []
@ha.callback
def run_callback(utc_time):
nonlocal times
times.append(utc_time)
def _setup_listeners():
"""Ensure we test the non-async version."""
utc_no... | [
"async",
"def",
"test_track_point_in_utc_time_cancel",
"(",
"hass",
")",
":",
"times",
"=",
"[",
"]",
"@",
"ha",
".",
"callback",
"def",
"run_callback",
"(",
"utc_time",
")",
":",
"nonlocal",
"times",
"times",
".",
"append",
"(",
"utc_time",
")",
"def",
"_... | [
3125,
0
] | [
3156,
41
] | python | en | ['en', 'en', 'en'] | True |
test_async_track_point_in_time_cancel | (hass) | Test cancel of async track point in time. | Test cancel of async track point in time. | async def test_async_track_point_in_time_cancel(hass):
"""Test cancel of async track point in time."""
times = []
hst_tz = dt_util.get_time_zone("US/Hawaii")
dt_util.set_default_time_zone(hst_tz)
@ha.callback
def run_callback(local_time):
nonlocal times
times.append(local_time)... | [
"async",
"def",
"test_async_track_point_in_time_cancel",
"(",
"hass",
")",
":",
"times",
"=",
"[",
"]",
"hst_tz",
"=",
"dt_util",
".",
"get_time_zone",
"(",
"\"US/Hawaii\"",
")",
"dt_util",
".",
"set_default_time_zone",
"(",
"hst_tz",
")",
"@",
"ha",
".",
"cal... | [
3159,
0
] | [
3186,
46
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.__init__ | (self, hass, config, prefs: CloudPreferences, cloud) | Initialize the Alexa config. | Initialize the Alexa config. | def __init__(self, hass, config, prefs: CloudPreferences, cloud):
"""Initialize the Alexa config."""
super().__init__(hass)
self._config = config
self._prefs = prefs
self._cloud = cloud
self._token = None
self._token_valid = None
self._cur_entity_prefs = p... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
",",
"prefs",
":",
"CloudPreferences",
",",
"cloud",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hass",
")",
"self",
".",
"_config",
"=",
"config",
"self",
".",
"_prefs",
"=",
"prefs... | [
34,
4
] | [
51,
9
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.enabled | (self) | Return if Alexa is enabled. | Return if Alexa is enabled. | def enabled(self):
"""Return if Alexa is enabled."""
return self._prefs.alexa_enabled | [
"def",
"enabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_prefs",
".",
"alexa_enabled"
] | [
54,
4
] | [
56,
40
] | python | en | ['en', 'af', 'en'] | True |
AlexaConfig.supports_auth | (self) | Return if config supports auth. | Return if config supports auth. | def supports_auth(self):
"""Return if config supports auth."""
return True | [
"def",
"supports_auth",
"(",
"self",
")",
":",
"return",
"True"
] | [
59,
4
] | [
61,
19
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.should_report_state | (self) | Return if states should be proactively reported. | Return if states should be proactively reported. | def should_report_state(self):
"""Return if states should be proactively reported."""
return self._prefs.alexa_report_state | [
"def",
"should_report_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_prefs",
".",
"alexa_report_state"
] | [
64,
4
] | [
66,
45
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.endpoint | (self) | Endpoint for report state. | Endpoint for report state. | def endpoint(self):
"""Endpoint for report state."""
if self._endpoint is None:
raise ValueError("No endpoint available. Fetch access token first")
return self._endpoint | [
"def",
"endpoint",
"(",
"self",
")",
":",
"if",
"self",
".",
"_endpoint",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"No endpoint available. Fetch access token first\"",
")",
"return",
"self",
".",
"_endpoint"
] | [
69,
4
] | [
74,
29
] | python | en | ['en', 'en', 'en'] | True |
AlexaConfig.locale | (self) | Return config locale. | Return config locale. | def locale(self):
"""Return config locale."""
# Not clear how to determine locale atm.
return "en-US" | [
"def",
"locale",
"(",
"self",
")",
":",
"# Not clear how to determine locale atm.",
"return",
"\"en-US\""
] | [
77,
4
] | [
80,
22
] | python | de | ['de', 'la', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.