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_async_render_to_info_with_wildcard_matching_entity_id | (hass) | Test tracking template with a wildcard. | Test tracking template with a wildcard. | async def test_async_render_to_info_with_wildcard_matching_entity_id(hass):
"""Test tracking template with a wildcard."""
template_complex_str = r"""
{% for state in states.cover %}
{% if state.entity_id | regex_match('.*\.office_') %}
{{ state.entity_id }}={{ state.state }}
{% endif %}
{% endfor %}
"... | [
"async",
"def",
"test_async_render_to_info_with_wildcard_matching_entity_id",
"(",
"hass",
")",
":",
"template_complex_str",
"=",
"r\"\"\"\n\n{% for state in states.cover %}\n {% if state.entity_id | regex_match('.*\\.office_') %}\n {{ state.entity_id }}={{ state.state }}\n {% endif %}\n{% en... | [
1588,
0
] | [
1607,
63
] | python | en | ['en', 'en', 'en'] | True |
test_async_render_to_info_with_wildcard_matching_state | (hass) | Test tracking template with a wildcard. | Test tracking template with a wildcard. | async def test_async_render_to_info_with_wildcard_matching_state(hass):
"""Test tracking template with a wildcard."""
template_complex_str = """
{% for state in states %}
{% if state.state | regex_match('ope.*') %}
{{ state.entity_id }}={{ state.state }}
{% endif %}
{% endfor %}
"""
hass.states.as... | [
"async",
"def",
"test_async_render_to_info_with_wildcard_matching_state",
"(",
"hass",
")",
":",
"template_complex_str",
"=",
"\"\"\"\n\n{% for state in states %}\n {% if state.state | regex_match('ope.*') %}\n {{ state.entity_id }}={{ state.state }}\n {% endif %}\n{% endfor %}\n\n\"\"\"",
... | [
1610,
0
] | [
1658,
63
] | python | en | ['en', 'en', 'en'] | True |
test_nested_async_render_to_info_case | (hass) | Test a deeply nested state with async_render_to_info. | Test a deeply nested state with async_render_to_info. | def test_nested_async_render_to_info_case(hass):
"""Test a deeply nested state with async_render_to_info."""
hass.states.async_set("input_select.picker", "vacuum.a")
hass.states.async_set("vacuum.a", "off")
info = render_to_info(
hass, "{{ states[states['input_select.picker'].state].state }}",... | [
"def",
"test_nested_async_render_to_info_case",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"input_select.picker\"",
",",
"\"vacuum.a\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"vacuum.a\"",
",",
"\"off\"",
")",
"info",
"... | [
1661,
0
] | [
1671,
34
] | python | en | ['en', 'en', 'en'] | True |
test_result_as_boolean | (hass) | Test converting a template result to a boolean. | Test converting a template result to a boolean. | def test_result_as_boolean(hass):
"""Test converting a template result to a boolean."""
assert template.result_as_boolean(True) is True
assert template.result_as_boolean(" 1 ") is True
assert template.result_as_boolean(" true ") is True
assert template.result_as_boolean(" TrUE ") is True
assert... | [
"def",
"test_result_as_boolean",
"(",
"hass",
")",
":",
"assert",
"template",
".",
"result_as_boolean",
"(",
"True",
")",
"is",
"True",
"assert",
"template",
".",
"result_as_boolean",
"(",
"\" 1 \"",
")",
"is",
"True",
"assert",
"template",
".",
"result_as_boole... | [
1674,
0
] | [
1701,
52
] | python | en | ['en', 'en', 'en'] | True |
test_closest_function_to_entity_id | (hass) | Test closest function to entity id. | Test closest function to entity id. | def test_closest_function_to_entity_id(hass):
"""Test closest function to entity id."""
hass.states.async_set(
"test_domain.closest_home",
"happy",
{
"latitude": hass.config.latitude + 0.1,
"longitude": hass.config.longitude + 0.1,
},
)
hass.state... | [
"def",
"test_closest_function_to_entity_id",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test_domain.closest_home\"",
",",
"\"happy\"",
",",
"{",
"\"latitude\"",
":",
"hass",
".",
"config",
".",
"latitude",
"+",
"0.1",
",",
"\"longitu... | [
1704,
0
] | [
1758,
5
] | python | en | ['en', 'en', 'en'] | True |
test_closest_function_to_state | (hass) | Test closest function to state. | Test closest function to state. | def test_closest_function_to_state(hass):
"""Test closest function to state."""
hass.states.async_set(
"test_domain.closest_home",
"happy",
{
"latitude": hass.config.latitude + 0.1,
"longitude": hass.config.longitude + 0.1,
},
)
hass.states.async_... | [
"def",
"test_closest_function_to_state",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test_domain.closest_home\"",
",",
"\"happy\"",
",",
"{",
"\"latitude\"",
":",
"hass",
".",
"config",
".",
"latitude",
"+",
"0.1",
",",
"\"longitude\"... | [
1761,
0
] | [
1795,
5
] | python | en | ['en', 'en', 'en'] | True |
test_closest_function_invalid_state | (hass) | Test closest function invalid state. | Test closest function invalid state. | def test_closest_function_invalid_state(hass):
"""Test closest function invalid state."""
hass.states.async_set(
"test_domain.closest_home",
"happy",
{
"latitude": hass.config.latitude + 0.1,
"longitude": hass.config.longitude + 0.1,
},
)
for stat... | [
"def",
"test_closest_function_invalid_state",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test_domain.closest_home\"",
",",
"\"happy\"",
",",
"{",
"\"latitude\"",
":",
"hass",
".",
"config",
".",
"latitude",
"+",
"0.1",
",",
"\"longit... | [
1798,
0
] | [
1813,
9
] | python | en | ['en', 'en', 'en'] | True |
test_closest_function_state_with_invalid_location | (hass) | Test closest function state with invalid location. | Test closest function state with invalid location. | def test_closest_function_state_with_invalid_location(hass):
"""Test closest function state with invalid location."""
hass.states.async_set(
"test_domain.closest_home",
"happy",
{"latitude": "invalid latitude", "longitude": hass.config.longitude + 0.1},
)
assert (
templa... | [
"def",
"test_closest_function_state_with_invalid_location",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test_domain.closest_home\"",
",",
"\"happy\"",
",",
"{",
"\"latitude\"",
":",
"\"invalid latitude\"",
",",
"\"longitude\"",
":",
"hass",
... | [
1816,
0
] | [
1829,
5
] | python | en | ['en', 'en', 'en'] | True |
test_closest_function_invalid_coordinates | (hass) | Test closest function invalid coordinates. | Test closest function invalid coordinates. | def test_closest_function_invalid_coordinates(hass):
"""Test closest function invalid coordinates."""
hass.states.async_set(
"test_domain.closest_home",
"happy",
{
"latitude": hass.config.latitude + 0.1,
"longitude": hass.config.longitude + 0.1,
},
)
... | [
"def",
"test_closest_function_invalid_coordinates",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"test_domain.closest_home\"",
",",
"\"happy\"",
",",
"{",
"\"latitude\"",
":",
"hass",
".",
"config",
".",
"latitude",
"+",
"0.1",
",",
"\"... | [
1832,
0
] | [
1854,
5
] | python | en | ['en', 'en', 'en'] | True |
test_closest_function_no_location_states | (hass) | Test closest function without location states. | Test closest function without location states. | def test_closest_function_no_location_states(hass):
"""Test closest function without location states."""
assert (
template.Template("{{ closest(states).entity_id }}", hass).async_render() == ""
) | [
"def",
"test_closest_function_no_location_states",
"(",
"hass",
")",
":",
"assert",
"(",
"template",
".",
"Template",
"(",
"\"{{ closest(states).entity_id }}\"",
",",
"hass",
")",
".",
"async_render",
"(",
")",
"==",
"\"\"",
")"
] | [
1857,
0
] | [
1861,
5
] | python | en | ['en', 'en', 'en'] | True |
test_generate_filter_iterators | (hass) | Test extract entities function with none entities stuff. | Test extract entities function with none entities stuff. | def test_generate_filter_iterators(hass):
"""Test extract entities function with none entities stuff."""
info = render_to_info(
hass,
"""
{% for state in states %}
{{ state.entity_id }}
{% endfor %}
""",
)
assert_result_info(info, "", all_states=True)
... | [
"def",
"test_generate_filter_iterators",
"(",
"hass",
")",
":",
"info",
"=",
"render_to_info",
"(",
"hass",
",",
"\"\"\"\n {% for state in states %}\n {{ state.entity_id }}\n {% endfor %}\n \"\"\"",
",",
")",
"assert_result_info",
"(",
"info",
",",
"... | [
1864,
0
] | [
1918,
73
] | python | en | ['en', 'en', 'en'] | True |
test_generate_select | (hass) | Test extract entities function with none entities stuff. | Test extract entities function with none entities stuff. | def test_generate_select(hass):
"""Test extract entities function with none entities stuff."""
template_str = """
{{ states.sensor|selectattr("state","equalto","off")
|join(",", attribute="entity_id") }}
"""
tmp = template.Template(template_str, hass)
info = tmp.async_render_to_info()
asser... | [
"def",
"test_generate_select",
"(",
"hass",
")",
":",
"template_str",
"=",
"\"\"\"\n{{ states.sensor|selectattr(\"state\",\"equalto\",\"off\")\n|join(\",\", attribute=\"entity_id\") }}\n \"\"\"",
"tmp",
"=",
"template",
".",
"Template",
"(",
"template_str",
",",
"hass",
")... | [
1921,
0
] | [
1943,
47
] | python | en | ['en', 'en', 'en'] | True |
test_async_render_to_info_in_conditional | (hass) | Test extract entities function with none entities stuff. | Test extract entities function with none entities stuff. | async def test_async_render_to_info_in_conditional(hass):
"""Test extract entities function with none entities stuff."""
template_str = """
{{ states("sensor.xyz") == "dog" }}
"""
tmp = template.Template(template_str, hass)
info = tmp.async_render_to_info()
assert_result_info(info, False, [... | [
"async",
"def",
"test_async_render_to_info_in_conditional",
"(",
"hass",
")",
":",
"template_str",
"=",
"\"\"\"\n{{ states(\"sensor.xyz\") == \"dog\" }}\n \"\"\"",
"tmp",
"=",
"template",
".",
"Template",
"(",
"template_str",
",",
"hass",
")",
"info",
"=",
"tmp",
... | [
1946,
0
] | [
1979,
70
] | python | en | ['en', 'en', 'en'] | True |
test_jinja_namespace | (hass) | Test Jinja's namespace command can be used. | Test Jinja's namespace command can be used. | def test_jinja_namespace(hass):
"""Test Jinja's namespace command can be used."""
test_template = template.Template(
(
"{% set ns = namespace(a_key='') %}"
"{% set ns.a_key = states.sensor.dummy.state %}"
"{{ ns.a_key }}"
),
hass,
)
hass.state... | [
"def",
"test_jinja_namespace",
"(",
"hass",
")",
":",
"test_template",
"=",
"template",
".",
"Template",
"(",
"(",
"\"{% set ns = namespace(a_key='') %}\"",
"\"{% set ns.a_key = states.sensor.dummy.state %}\"",
"\"{{ ns.a_key }}\"",
")",
",",
"hass",
",",
")",
"hass",
"."... | [
1982,
0
] | [
1997,
58
] | python | en | ['en', 'en', 'en'] | True |
test_state_with_unit | (hass) | Test the state_with_unit property helper. | Test the state_with_unit property helper. | def test_state_with_unit(hass):
"""Test the state_with_unit property helper."""
hass.states.async_set("sensor.test", "23", {ATTR_UNIT_OF_MEASUREMENT: "beers"})
hass.states.async_set("sensor.test2", "wow")
tpl = template.Template("{{ states.sensor.test.state_with_unit }}", hass)
assert tpl.async_re... | [
"def",
"test_state_with_unit",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.test\"",
",",
"\"23\"",
",",
"{",
"ATTR_UNIT_OF_MEASUREMENT",
":",
"\"beers\"",
"}",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.test... | [
2000,
0
] | [
2021,
35
] | python | en | ['en', 'en', 'en'] | True |
test_length_of_states | (hass) | Test fetching the length of states. | Test fetching the length of states. | def test_length_of_states(hass):
"""Test fetching the length of states."""
hass.states.async_set("sensor.test", "23")
hass.states.async_set("sensor.test2", "wow")
hass.states.async_set("climate.test2", "cooling")
tpl = template.Template("{{ states | length }}", hass)
assert tpl.async_render() =... | [
"def",
"test_length_of_states",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.test\"",
",",
"\"23\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.test2\"",
",",
"\"wow\"",
")",
"hass",
".",
"states",
".",
"... | [
2024,
0
] | [
2034,
34
] | python | en | ['en', 'en', 'en'] | True |
test_render_complex_handling_non_template_values | (hass) | Test that we can render non-template fields. | Test that we can render non-template fields. | def test_render_complex_handling_non_template_values(hass):
"""Test that we can render non-template fields."""
assert template.render_complex(
{True: 1, False: template.Template("{{ hello }}", hass)}, {"hello": 2}
) == {True: 1, False: 2} | [
"def",
"test_render_complex_handling_non_template_values",
"(",
"hass",
")",
":",
"assert",
"template",
".",
"render_complex",
"(",
"{",
"True",
":",
"1",
",",
"False",
":",
"template",
".",
"Template",
"(",
"\"{{ hello }}\"",
",",
"hass",
")",
"}",
",",
"{",
... | [
2037,
0
] | [
2041,
28
] | python | en | ['en', 'en', 'en'] | True |
test_urlencode | (hass) | Test the urlencode method. | Test the urlencode method. | def test_urlencode(hass):
"""Test the urlencode method."""
tpl = template.Template(
("{% set dict = {'foo': 'x&y', 'bar': 42} %}" "{{ dict | urlencode }}"),
hass,
)
assert tpl.async_render() == "foo=x%26y&bar=42"
tpl = template.Template(
("{% set string = 'the quick brown fox... | [
"def",
"test_urlencode",
"(",
"hass",
")",
":",
"tpl",
"=",
"template",
".",
"Template",
"(",
"(",
"\"{% set dict = {'foo': 'x&y', 'bar': 42} %}\"",
"\"{{ dict | urlencode }}\"",
")",
",",
"hass",
",",
")",
"assert",
"tpl",
".",
"async_render",
"(",
")",
"==",
"... | [
2044,
0
] | [
2055,
73
] | python | en | ['en', 'et', 'en'] | True |
test_cache_garbage_collection | () | Test caching a template. | Test caching a template. | async def test_cache_garbage_collection():
"""Test caching a template."""
template_string = (
"{% set dict = {'foo': 'x&y', 'bar': 42} %} {{ dict | urlencode }}"
)
tpl = template.Template(
(template_string),
)
tpl.ensure_valid()
assert template._NO_HASS_ENV.template_cache.get... | [
"async",
"def",
"test_cache_garbage_collection",
"(",
")",
":",
"template_string",
"=",
"(",
"\"{% set dict = {'foo': 'x&y', 'bar': 42} %} {{ dict | urlencode }}\"",
")",
"tpl",
"=",
"template",
".",
"Template",
"(",
"(",
"template_string",
")",
",",
")",
"tpl",
".",
... | [
2058,
0
] | [
2086,
5
] | python | en | ['en', 'en', 'en'] | True |
test_is_template_string | () | Test is template string. | Test is template string. | def test_is_template_string():
"""Test is template string."""
assert template.is_template_string("{{ x }}") is True
assert template.is_template_string("{% if x == 2 %}1{% else %}0{%end if %}") is True
assert template.is_template_string("{# a comment #} Hey") is True
assert template.is_template_strin... | [
"def",
"test_is_template_string",
"(",
")",
":",
"assert",
"template",
".",
"is_template_string",
"(",
"\"{{ x }}\"",
")",
"is",
"True",
"assert",
"template",
".",
"is_template_string",
"(",
"\"{% if x == 2 %}1{% else %}0{%end if %}\"",
")",
"is",
"True",
"assert",
"t... | [
2089,
0
] | [
2095,
60
] | python | en | ['en', 'en', 'en'] | True |
test_protected_blocked | (hass) | Test accessing __getattr__ produces a template error. | Test accessing __getattr__ produces a template error. | async def test_protected_blocked(hass):
"""Test accessing __getattr__ produces a template error."""
tmp = template.Template('{{ states.__getattr__("any") }}', hass)
with pytest.raises(TemplateError):
tmp.async_render()
tmp = template.Template('{{ states.sensor.__getattr__("any") }}', hass)
... | [
"async",
"def",
"test_protected_blocked",
"(",
"hass",
")",
":",
"tmp",
"=",
"template",
".",
"Template",
"(",
"'{{ states.__getattr__(\"any\") }}'",
",",
"hass",
")",
"with",
"pytest",
".",
"raises",
"(",
"TemplateError",
")",
":",
"tmp",
".",
"async_render",
... | [
2098,
0
] | [
2110,
26
] | python | en | ['en', 'en', 'en'] | True |
test_demo_template | (hass) | Test the demo template works as expected. | Test the demo template works as expected. | async def test_demo_template(hass):
"""Test the demo template works as expected."""
hass.states.async_set("sun.sun", "above", {"elevation": 50, "next_rising": "later"})
for i in range(2):
hass.states.async_set(f"sensor.sensor{i}", "on")
demo_template_str = """
{## Imitate available variables: #... | [
"async",
"def",
"test_demo_template",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sun.sun\"",
",",
"\"above\"",
",",
"{",
"\"elevation\"",
":",
"50",
",",
"\"next_rising\"",
":",
"\"later\"",
"}",
")",
"for",
"i",
"in",
"range",... | [
2113,
0
] | [
2149,
26
] | python | en | ['en', 'en', 'en'] | True |
test_slice_states | (hass) | Test iterating states with a slice. | Test iterating states with a slice. | async def test_slice_states(hass):
"""Test iterating states with a slice."""
hass.states.async_set("sensor.test", "23")
tpl = template.Template(
"{% for states in states | slice(1) -%}{% set state = states | first %}{{ state.entity_id }}{%- endfor %}",
hass,
)
assert tpl.async_rende... | [
"async",
"def",
"test_slice_states",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.test\"",
",",
"\"23\"",
")",
"tpl",
"=",
"template",
".",
"Template",
"(",
"\"{% for states in states | slice(1) -%}{% set state = states | first %}{{ sta... | [
2152,
0
] | [
2160,
46
] | python | en | ['en', 'en', 'en'] | True |
test_lifecycle | (hass) | Test that we limit template render info for lifecycle events. | Test that we limit template render info for lifecycle events. | async def test_lifecycle(hass):
"""Test that we limit template render info for lifecycle events."""
hass.states.async_set("sun.sun", "above", {"elevation": 50, "next_rising": "later"})
for i in range(2):
hass.states.async_set(f"sensor.sensor{i}", "on")
hass.states.async_set("sensor.removed", "of... | [
"async",
"def",
"test_lifecycle",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sun.sun\"",
",",
"\"above\"",
",",
"{",
"\"elevation\"",
":",
"50",
",",
"\"next_rising\"",
":",
"\"later\"",
"}",
")",
"for",
"i",
"in",
"range",
"... | [
2163,
0
] | [
2196,
58
] | python | en | ['en', 'en', 'en'] | True |
test_template_timeout | (hass) | Test to see if a template will timeout. | Test to see if a template will timeout. | async def test_template_timeout(hass):
"""Test to see if a template will timeout."""
for i in range(2):
hass.states.async_set(f"sensor.sensor{i}", "on")
tmp = template.Template("{{ states | count }}", hass)
assert await tmp.async_render_will_timeout(3) is False
tmp2 = template.Template("{{... | [
"async",
"def",
"test_template_timeout",
"(",
"hass",
")",
":",
"for",
"i",
"in",
"range",
"(",
"2",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"f\"sensor.sensor{i}\"",
",",
"\"on\"",
")",
"tmp",
"=",
"template",
".",
"Template",
"(",
"\"{{ ... | [
2199,
0
] | [
2224,
65
] | python | en | ['en', 'en', 'en'] | True |
test_lights | (hass) | Test we can sort lights. | Test we can sort lights. | async def test_lights(hass):
"""Test we can sort lights."""
tmpl = """
{% set lights_on = states.light|selectattr('state','eq','on')|map(attribute='name')|list %}
{% if lights_on|length == 0 %}
No lights on. Sleep well..
{% elif lights_on|length == 1 %}
The... | [
"async",
"def",
"test_lights",
"(",
"hass",
")",
":",
"tmpl",
"=",
"\"\"\"\n {% set lights_on = states.light|selectattr('state','eq','on')|map(attribute='name')|list %}\n {% if lights_on|length == 0 %}\n No lights on. Sleep well..\n {% elif lights_on|length ==... | [
2227,
0
] | [
2254,
44
] | python | en | ['en', 'da', 'en'] | True |
test_template_errors | (hass) | Test template rendering wraps exceptions with TemplateError. | Test template rendering wraps exceptions with TemplateError. | async def test_template_errors(hass):
"""Test template rendering wraps exceptions with TemplateError."""
with pytest.raises(TemplateError):
template.Template("{{ now() | rando }}", hass).async_render()
with pytest.raises(TemplateError):
template.Template("{{ utcnow() | rando }}", hass).asy... | [
"async",
"def",
"test_template_errors",
"(",
"hass",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"TemplateError",
")",
":",
"template",
".",
"Template",
"(",
"\"{{ now() | rando }}\"",
",",
"hass",
")",
".",
"async_render",
"(",
")",
"with",
"pytest",
".... | [
2257,
0
] | [
2270,
73
] | python | en | ['en', 'en', 'en'] | True |
test_state_attributes | (hass) | Test state attributes. | Test state attributes. | async def test_state_attributes(hass):
"""Test state attributes."""
hass.states.async_set("sensor.test", "23")
tpl = template.Template(
"{{ states.sensor.test.last_changed }}",
hass,
)
assert tpl.async_render() == str(hass.states.get("sensor.test").last_changed)
tpl = template.... | [
"async",
"def",
"test_state_attributes",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.test\"",
",",
"\"23\"",
")",
"tpl",
"=",
"template",
".",
"Template",
"(",
"\"{{ states.sensor.test.last_changed }}\"",
",",
"hass",
",",
")",... | [
2273,
0
] | [
2318,
26
] | python | en | ['en', 'en', 'en'] | True |
test_unavailable_states | (hass) | Test watching unavailable states. | Test watching unavailable states. | async def test_unavailable_states(hass):
"""Test watching unavailable states."""
for i in range(10):
hass.states.async_set(f"light.sensor{i}", "on")
hass.states.async_set("light.unavailable", "unavailable")
hass.states.async_set("light.unknown", "unknown")
hass.states.async_set("light.none... | [
"async",
"def",
"test_unavailable_states",
"(",
"hass",
")",
":",
"for",
"i",
"in",
"range",
"(",
"10",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"f\"light.sensor{i}\"",
",",
"\"on\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"l... | [
2321,
0
] | [
2341,
79
] | python | en | ['en', 'en', 'en'] | True |
test_legacy_templates | (hass) | Test if old template behavior works when legacy templates are enabled. | Test if old template behavior works when legacy templates are enabled. | async def test_legacy_templates(hass):
"""Test if old template behavior works when legacy templates are enabled."""
hass.states.async_set("sensor.temperature", "12")
assert (
template.Template("{{ states.sensor.temperature.state }}", hass).async_render()
== 12
)
await async_process... | [
"async",
"def",
"test_legacy_templates",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.temperature\"",
",",
"\"12\"",
")",
"assert",
"(",
"template",
".",
"Template",
"(",
"\"{{ states.sensor.temperature.state }}\"",
",",
"hass",
"... | [
2344,
0
] | [
2357,
5
] | python | en | ['en', 'en', 'en'] | True |
test_no_result_parsing | (hass) | Test if templates results are not parsed. | Test if templates results are not parsed. | async def test_no_result_parsing(hass):
"""Test if templates results are not parsed."""
hass.states.async_set("sensor.temperature", "12")
assert (
template.Template("{{ states.sensor.temperature.state }}", hass).async_render(
parse_result=False
)
== "12"
)
asser... | [
"async",
"def",
"test_no_result_parsing",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.temperature\"",
",",
"\"12\"",
")",
"assert",
"(",
"template",
".",
"Template",
"(",
"\"{{ states.sensor.temperature.state }}\"",
",",
"hass",
... | [
2360,
0
] | [
2379,
5
] | python | en | ['en', 'en', 'en'] | True |
test_is_static_still_ast_evals | (hass) | Test is_static still convers to native type. | Test is_static still convers to native type. | async def test_is_static_still_ast_evals(hass):
"""Test is_static still convers to native type."""
tpl = template.Template("[1, 2]", hass)
assert tpl.is_static
assert tpl.async_render() == [1, 2] | [
"async",
"def",
"test_is_static_still_ast_evals",
"(",
"hass",
")",
":",
"tpl",
"=",
"template",
".",
"Template",
"(",
"\"[1, 2]\"",
",",
"hass",
")",
"assert",
"tpl",
".",
"is_static",
"assert",
"tpl",
".",
"async_render",
"(",
")",
"==",
"[",
"1",
",",
... | [
2382,
0
] | [
2386,
39
] | python | en | ['en', 'en', 'en'] | True |
test_result_wrappers | (hass) | Test result wrappers. | Test result wrappers. | async def test_result_wrappers(hass):
"""Test result wrappers."""
for text, native, orig_type, schema in (
("[1, 2]", [1, 2], list, vol.Schema([int])),
("{1, 2}", {1, 2}, set, vol.Schema({int})),
("(1, 2)", (1, 2), tuple, vol.ExactSequence([int, int])),
('{"hello": True}', {"hell... | [
"async",
"def",
"test_result_wrappers",
"(",
"hass",
")",
":",
"for",
"text",
",",
"native",
",",
"orig_type",
",",
"schema",
"in",
"(",
"(",
"\"[1, 2]\"",
",",
"[",
"1",
",",
"2",
"]",
",",
"list",
",",
"vol",
".",
"Schema",
"(",
"[",
"int",
"]",
... | [
2389,
0
] | [
2409,
9
] | python | en | ['en', 'en', 'en'] | True |
test_parse_result | (hass) | Test parse result. | Test parse result. | async def test_parse_result(hass):
"""Test parse result."""
for tpl, result in (
('{{ "{{}}" }}', "{{}}"),
("not-something", "not-something"),
("2a", "2a"),
("123E5", "123E5"),
("1j", "1j"),
("1e+100", "1e+100"),
("0xface", "0xface"),
("123", 123),... | [
"async",
"def",
"test_parse_result",
"(",
"hass",
")",
":",
"for",
"tpl",
",",
"result",
"in",
"(",
"(",
"'{{ \"{{}}\" }}'",
",",
"\"{{}}\"",
")",
",",
"(",
"\"not-something\"",
",",
"\"not-something\"",
")",
",",
"(",
"\"2a\"",
",",
"\"2a\"",
")",
",",
... | [
2412,
0
] | [
2430,
68
] | python | de | ['fr', 'de', 'en'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Zigbee Home Automation device tracker from config entry. | Set up the Zigbee Home Automation device tracker from config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Zigbee Home Automation device tracker from config entry."""
entities_to_create = hass.data[DATA_ZHA][DOMAIN]
unsub = async_dispatcher_connect(
hass,
SIGNAL_ADD_ENTITIES,
functools.partial(
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"entities_to_create",
"=",
"hass",
".",
"data",
"[",
"DATA_ZHA",
"]",
"[",
"DOMAIN",
"]",
"unsub",
"=",
"async_dispatcher_connect",
"(",
"hass",
",",
"S... | [
24,
0
] | [
35,
59
] | python | en | ['en', 'en', 'en'] | True |
pad_sequence | (sequence, lengths) |
:param sequence: [\sum b, .....] sequence
:param lengths: [b1, b2, b3...] that sum to \sum b
:return: [len(lengths), maxlen(b), .....] tensor
|
:param sequence: [\sum b, .....] sequence
:param lengths: [b1, b2, b3...] that sum to \sum b
:return: [len(lengths), maxlen(b), .....] tensor
| def pad_sequence(sequence, lengths):
"""
:param sequence: [\sum b, .....] sequence
:param lengths: [b1, b2, b3...] that sum to \sum b
:return: [len(lengths), maxlen(b), .....] tensor
"""
output = sequence.new_zeros(len(lengths), max(lengths), *sequence.shape[1:])
start = 0
for i, diff i... | [
"def",
"pad_sequence",
"(",
"sequence",
",",
"lengths",
")",
":",
"output",
"=",
"sequence",
".",
"new_zeros",
"(",
"len",
"(",
"lengths",
")",
",",
"max",
"(",
"lengths",
")",
",",
"*",
"sequence",
".",
"shape",
"[",
"1",
":",
"]",
")",
"start",
"... | [
3,
0
] | [
16,
17
] | python | en | ['en', 'error', 'th'] | False |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the cover platform for ADS. | Set up the cover platform for ADS. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the cover platform for ADS."""
ads_hub = hass.data[DATA_ADS]
ads_var_is_closed = config.get(CONF_ADS_VAR)
ads_var_position = config.get(CONF_ADS_VAR_POSITION)
ads_var_pos_set = config.get(CONF_ADS_VAR_SET_POS)
ads_va... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"ads_hub",
"=",
"hass",
".",
"data",
"[",
"DATA_ADS",
"]",
"ads_var_is_closed",
"=",
"config",
".",
"get",
"(",
"CONF_ADS_VAR",
")",
"ad... | [
46,
0
] | [
73,
5
] | python | en | ['en', 'da', 'en'] | True |
AdsCover.__init__ | (
self,
ads_hub,
ads_var_is_closed,
ads_var_position,
ads_var_pos_set,
ads_var_open,
ads_var_close,
ads_var_stop,
name,
device_class,
) | Initialize AdsCover entity. | Initialize AdsCover entity. | def __init__(
self,
ads_hub,
ads_var_is_closed,
ads_var_position,
ads_var_pos_set,
ads_var_open,
ads_var_close,
ads_var_stop,
name,
device_class,
):
"""Initialize AdsCover entity."""
super().__init__(ads_hub, name, ads_v... | [
"def",
"__init__",
"(",
"self",
",",
"ads_hub",
",",
"ads_var_is_closed",
",",
"ads_var_position",
",",
"ads_var_pos_set",
",",
"ads_var_open",
",",
"ads_var_close",
",",
"ads_var_stop",
",",
"name",
",",
"device_class",
",",
")",
":",
"super",
"(",
")",
".",
... | [
79,
4
] | [
107,
41
] | python | da | ['da', 'en', 'it'] | False |
AdsCover.async_added_to_hass | (self) | Register device notification. | Register device notification. | async def async_added_to_hass(self):
"""Register device notification."""
if self._ads_var is not None:
await self.async_initialize_device(
self._ads_var, self._ads_hub.PLCTYPE_BOOL
)
if self._ads_var_position is not None:
await self.async_init... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ads_var",
"is",
"not",
"None",
":",
"await",
"self",
".",
"async_initialize_device",
"(",
"self",
".",
"_ads_var",
",",
"self",
".",
"_ads_hub",
".",
"PLCTYPE_BOOL",
")",
"i... | [
109,
4
] | [
119,
13
] | python | en | ['da', 'en', 'en'] | True |
AdsCover.device_class | (self) | Return the class of this cover. | Return the class of this cover. | def device_class(self):
"""Return the class of this cover."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
122,
4
] | [
124,
33
] | python | en | ['en', 'en', 'en'] | True |
AdsCover.is_closed | (self) | Return if the cover is closed. | Return if the cover is closed. | def is_closed(self):
"""Return if the cover is closed."""
if self._ads_var is not None:
return self._state_dict[STATE_KEY_STATE]
if self._ads_var_position is not None:
return self._state_dict[STATE_KEY_POSITION] == 0
return None | [
"def",
"is_closed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ads_var",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_state_dict",
"[",
"STATE_KEY_STATE",
"]",
"if",
"self",
".",
"_ads_var_position",
"is",
"not",
"None",
":",
"return",
"self",
"."... | [
127,
4
] | [
133,
19
] | python | en | ['en', 'en', 'en'] | True |
AdsCover.current_cover_position | (self) | Return current position of cover. | Return current position of cover. | def current_cover_position(self):
"""Return current position of cover."""
return self._state_dict[STATE_KEY_POSITION] | [
"def",
"current_cover_position",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state_dict",
"[",
"STATE_KEY_POSITION",
"]"
] | [
136,
4
] | [
138,
51
] | python | en | ['en', 'en', 'en'] | True |
AdsCover.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self):
"""Flag supported features."""
supported_features = SUPPORT_OPEN | SUPPORT_CLOSE
if self._ads_var_stop is not None:
supported_features |= SUPPORT_STOP
if self._ads_var_pos_set is not None:
supported_features |= SUPPORT_SET_POSITION
... | [
"def",
"supported_features",
"(",
"self",
")",
":",
"supported_features",
"=",
"SUPPORT_OPEN",
"|",
"SUPPORT_CLOSE",
"if",
"self",
".",
"_ads_var_stop",
"is",
"not",
"None",
":",
"supported_features",
"|=",
"SUPPORT_STOP",
"if",
"self",
".",
"_ads_var_pos_set",
"i... | [
141,
4
] | [
151,
33
] | python | en | ['da', 'en', 'en'] | True |
AdsCover.stop_cover | (self, **kwargs) | Fire the stop action. | Fire the stop action. | def stop_cover(self, **kwargs):
"""Fire the stop action."""
if self._ads_var_stop:
self._ads_hub.write_by_name(
self._ads_var_stop, True, self._ads_hub.PLCTYPE_BOOL
) | [
"def",
"stop_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_ads_var_stop",
":",
"self",
".",
"_ads_hub",
".",
"write_by_name",
"(",
"self",
".",
"_ads_var_stop",
",",
"True",
",",
"self",
".",
"_ads_hub",
".",
"PLCTYPE_BOOL"... | [
153,
4
] | [
158,
13
] | python | en | ['en', 'en', 'en'] | True |
AdsCover.set_cover_position | (self, **kwargs) | Set cover position. | Set cover position. | def set_cover_position(self, **kwargs):
"""Set cover position."""
position = kwargs[ATTR_POSITION]
if self._ads_var_pos_set is not None:
self._ads_hub.write_by_name(
self._ads_var_pos_set, position, self._ads_hub.PLCTYPE_BYTE
) | [
"def",
"set_cover_position",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"position",
"=",
"kwargs",
"[",
"ATTR_POSITION",
"]",
"if",
"self",
".",
"_ads_var_pos_set",
"is",
"not",
"None",
":",
"self",
".",
"_ads_hub",
".",
"write_by_name",
"(",
"self",
... | [
160,
4
] | [
166,
13
] | python | en | ['en', 'en', 'en'] | True |
AdsCover.open_cover | (self, **kwargs) | Move the cover up. | Move the cover up. | def open_cover(self, **kwargs):
"""Move the cover up."""
if self._ads_var_open is not None:
self._ads_hub.write_by_name(
self._ads_var_open, True, self._ads_hub.PLCTYPE_BOOL
)
elif self._ads_var_pos_set is not None:
self.set_cover_position(posi... | [
"def",
"open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_ads_var_open",
"is",
"not",
"None",
":",
"self",
".",
"_ads_hub",
".",
"write_by_name",
"(",
"self",
".",
"_ads_var_open",
",",
"True",
",",
"self",
".",
"_ads_hu... | [
168,
4
] | [
175,
49
] | python | en | ['en', 'en', 'en'] | True |
AdsCover.close_cover | (self, **kwargs) | Move the cover down. | Move the cover down. | def close_cover(self, **kwargs):
"""Move the cover down."""
if self._ads_var_close is not None:
self._ads_hub.write_by_name(
self._ads_var_close, True, self._ads_hub.PLCTYPE_BOOL
)
elif self._ads_var_pos_set is not None:
self.set_cover_position... | [
"def",
"close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_ads_var_close",
"is",
"not",
"None",
":",
"self",
".",
"_ads_hub",
".",
"write_by_name",
"(",
"self",
".",
"_ads_var_close",
",",
"True",
",",
"self",
".",
"_ads... | [
177,
4
] | [
184,
47
] | python | en | ['en', 'en', 'en'] | True |
AdsCover.available | (self) | Return False if state has not been updated yet. | Return False if state has not been updated yet. | def available(self):
"""Return False if state has not been updated yet."""
if self._ads_var is not None or self._ads_var_position is not None:
return (
self._state_dict[STATE_KEY_STATE] is not None
or self._state_dict[STATE_KEY_POSITION] is not None
... | [
"def",
"available",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ads_var",
"is",
"not",
"None",
"or",
"self",
".",
"_ads_var_position",
"is",
"not",
"None",
":",
"return",
"(",
"self",
".",
"_state_dict",
"[",
"STATE_KEY_STATE",
"]",
"is",
"not",
"None",
... | [
187,
4
] | [
194,
19
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up a Volvo switch. | Set up a Volvo switch. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up a Volvo switch."""
if discovery_info is None:
return
async_add_entities([VolvoSwitch(hass.data[DATA_KEY], *discovery_info)]) | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"async_add_entities",
"(",
"[",
"VolvoSwitch",
"(",
"hass",
".",
"... | [
6,
0
] | [
10,
75
] | python | en | ['en', 'en', 'en'] | True |
VolvoSwitch.is_on | (self) | Return true if switch is on. | Return true if switch is on. | def is_on(self):
"""Return true if switch is on."""
return self.instrument.state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"instrument",
".",
"state"
] | [
17,
4
] | [
19,
36
] | python | en | ['en', 'fy', 'en'] | True |
VolvoSwitch.async_turn_on | (self, **kwargs) | Turn the switch on. | Turn the switch on. | async def async_turn_on(self, **kwargs):
"""Turn the switch on."""
await self.instrument.turn_on()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"instrument",
".",
"turn_on",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
21,
4
] | [
24,
35
] | python | en | ['en', 'en', 'en'] | True |
VolvoSwitch.async_turn_off | (self, **kwargs) | Turn the switch off. | Turn the switch off. | async def async_turn_off(self, **kwargs):
"""Turn the switch off."""
await self.instrument.turn_off()
self.async_write_ha_state() | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"instrument",
".",
"turn_off",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
26,
4
] | [
29,
35
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Wink platform. | Set up the Wink platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Wink platform."""
for fan in pywink.get_fans():
if fan.object_id() + fan.name() not in hass.data[DOMAIN]["unique_ids"]:
add_entities([WinkFanDevice(fan, hass)]) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"for",
"fan",
"in",
"pywink",
".",
"get_fans",
"(",
")",
":",
"if",
"fan",
".",
"object_id",
"(",
")",
"+",
"fan",
".",
"name",
"(... | [
19,
0
] | [
24,
52
] | python | en | ['en', 'da', 'en'] | True |
WinkFanDevice.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self.hass.data[DOMAIN]["entities"]["fan"].append(self) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"entities\"",
"]",
"[",
"\"fan\"",
"]",
".",
"append",
"(",
"self",
")"
] | [
30,
4
] | [
32,
62
] | python | en | ['en', 'en', 'en'] | True |
WinkFanDevice.set_direction | (self, direction: str) | Set the direction of the fan. | Set the direction of the fan. | def set_direction(self, direction: str) -> None:
"""Set the direction of the fan."""
self.wink.set_fan_direction(direction) | [
"def",
"set_direction",
"(",
"self",
",",
"direction",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"wink",
".",
"set_fan_direction",
"(",
"direction",
")"
] | [
34,
4
] | [
36,
46
] | python | en | ['en', 'en', 'en'] | True |
WinkFanDevice.set_speed | (self, speed: str) | Set the speed of the fan. | Set the speed of the fan. | def set_speed(self, speed: str) -> None:
"""Set the speed of the fan."""
self.wink.set_state(True, speed) | [
"def",
"set_speed",
"(",
"self",
",",
"speed",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"wink",
".",
"set_state",
"(",
"True",
",",
"speed",
")"
] | [
38,
4
] | [
40,
40
] | python | en | ['en', 'en', 'en'] | True |
WinkFanDevice.turn_on | (self, speed: str = None, **kwargs) | Turn on the fan. | Turn on the fan. | def turn_on(self, speed: str = None, **kwargs) -> None:
"""Turn on the fan."""
self.wink.set_state(True, speed) | [
"def",
"turn_on",
"(",
"self",
",",
"speed",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"self",
".",
"wink",
".",
"set_state",
"(",
"True",
",",
"speed",
")"
] | [
42,
4
] | [
44,
40
] | python | en | ['en', 'fy', 'en'] | True |
WinkFanDevice.turn_off | (self, **kwargs) | Turn off the fan. | Turn off the fan. | def turn_off(self, **kwargs) -> None:
"""Turn off the fan."""
self.wink.set_state(False) | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"self",
".",
"wink",
".",
"set_state",
"(",
"False",
")"
] | [
46,
4
] | [
48,
34
] | python | en | ['en', 'fy', 'en'] | True |
WinkFanDevice.is_on | (self) | Return true if the entity is on. | Return true if the entity is on. | def is_on(self):
"""Return true if the entity is on."""
return self.wink.state() | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"state",
"(",
")"
] | [
51,
4
] | [
53,
32
] | python | en | ['en', 'en', 'en'] | True |
WinkFanDevice.speed | (self) | Return the current speed. | Return the current speed. | def speed(self) -> str:
"""Return the current speed."""
current_wink_speed = self.wink.current_fan_speed()
if SPEED_AUTO == current_wink_speed:
return SPEED_AUTO
if SPEED_LOWEST == current_wink_speed:
return SPEED_LOWEST
if SPEED_LOW == current_wink_speed:... | [
"def",
"speed",
"(",
"self",
")",
"->",
"str",
":",
"current_wink_speed",
"=",
"self",
".",
"wink",
".",
"current_fan_speed",
"(",
")",
"if",
"SPEED_AUTO",
"==",
"current_wink_speed",
":",
"return",
"SPEED_AUTO",
"if",
"SPEED_LOWEST",
"==",
"current_wink_speed",... | [
56,
4
] | [
69,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkFanDevice.current_direction | (self) | Return direction of the fan [forward, reverse]. | Return direction of the fan [forward, reverse]. | def current_direction(self):
"""Return direction of the fan [forward, reverse]."""
return self.wink.current_fan_direction() | [
"def",
"current_direction",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"current_fan_direction",
"(",
")"
] | [
72,
4
] | [
74,
48
] | python | en | ['en', 'fy', 'en'] | True |
WinkFanDevice.speed_list | (self) | Get the list of available speeds. | Get the list of available speeds. | def speed_list(self) -> list:
"""Get the list of available speeds."""
wink_supported_speeds = self.wink.fan_speeds()
supported_speeds = []
if SPEED_AUTO in wink_supported_speeds:
supported_speeds.append(SPEED_AUTO)
if SPEED_LOWEST in wink_supported_speeds:
... | [
"def",
"speed_list",
"(",
"self",
")",
"->",
"list",
":",
"wink_supported_speeds",
"=",
"self",
".",
"wink",
".",
"fan_speeds",
"(",
")",
"supported_speeds",
"=",
"[",
"]",
"if",
"SPEED_AUTO",
"in",
"wink_supported_speeds",
":",
"supported_speeds",
".",
"appen... | [
77,
4
] | [
91,
31
] | python | en | ['en', 'en', 'en'] | True |
WinkFanDevice.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self) -> int:
"""Flag supported features."""
return SUPPORTED_FEATURES | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORTED_FEATURES"
] | [
94,
4
] | [
96,
33
] | python | en | ['da', 'en', 'en'] | True |
mock_openzwave | () | Mock out Open Z-Wave. | Mock out Open Z-Wave. | def mock_openzwave():
"""Mock out Open Z-Wave."""
base_mock = MagicMock()
libopenzwave = base_mock.libopenzwave
libopenzwave.__file__ = "test"
base_mock.network.ZWaveNetwork = MockNetwork
base_mock.option.ZWaveOption = MockOption
with patch.dict(
"sys.modules",
{
... | [
"def",
"mock_openzwave",
"(",
")",
":",
"base_mock",
"=",
"MagicMock",
"(",
")",
"libopenzwave",
"=",
"base_mock",
".",
"libopenzwave",
"libopenzwave",
".",
"__file__",
"=",
"\"test\"",
"base_mock",
".",
"network",
".",
"ZWaveNetwork",
"=",
"MockNetwork",
"base_... | [
11,
0
] | [
28,
23
] | python | en | ['en', 'en', 'en'] | True |
mock_discovery | () | Mock discovery. | Mock discovery. | def mock_discovery():
"""Mock discovery."""
discovery = MagicMock()
discovery.async_load_platform = AsyncMock(return_value=None)
yield discovery | [
"def",
"mock_discovery",
"(",
")",
":",
"discovery",
"=",
"MagicMock",
"(",
")",
"discovery",
".",
"async_load_platform",
"=",
"AsyncMock",
"(",
"return_value",
"=",
"None",
")",
"yield",
"discovery"
] | [
32,
0
] | [
36,
19
] | python | en | ['en', 'en', 'en'] | False |
mock_import_module | () | Mock import module. | Mock import module. | def mock_import_module():
"""Mock import module."""
platform = MagicMock()
mock_device = MagicMock()
mock_device.name = "test_device"
platform.get_device.return_value = mock_device
import_module = MagicMock()
import_module.return_value = platform
yield import_module | [
"def",
"mock_import_module",
"(",
")",
":",
"platform",
"=",
"MagicMock",
"(",
")",
"mock_device",
"=",
"MagicMock",
"(",
")",
"mock_device",
".",
"name",
"=",
"\"test_device\"",
"platform",
".",
"get_device",
".",
"return_value",
"=",
"mock_device",
"import_mod... | [
40,
0
] | [
49,
23
] | python | en | ['en', 'fy', 'en'] | True |
mock_values | () | Mock values. | Mock values. | def mock_values():
"""Mock values."""
node = MockNode()
mock_schema = {
const.DISC_COMPONENT: "mock_component",
const.DISC_VALUES: {
const.DISC_PRIMARY: {const.DISC_COMMAND_CLASS: ["mock_primary_class"]},
"secondary": {const.DISC_COMMAND_CLASS: ["mock_secondary_class"... | [
"def",
"mock_values",
"(",
")",
":",
"node",
"=",
"MockNode",
"(",
")",
"mock_schema",
"=",
"{",
"const",
".",
"DISC_COMPONENT",
":",
"\"mock_component\"",
",",
"const",
".",
"DISC_VALUES",
":",
"{",
"const",
".",
"DISC_PRIMARY",
":",
"{",
"const",
".",
... | [
53,
0
] | [
78,
42
] | python | en | ['en', 'mg', 'en'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Homekit lighting. | Set up Homekit lighting. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Homekit lighting."""
hkid = config_entry.data["AccessoryPairingID"]
conn = hass.data[KNOWN_DEVICES][hkid]
@callback
def async_add_service(service):
entity_class = ENTITY_TYPES.get(service.short_type)
if n... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"hkid",
"=",
"config_entry",
".",
"data",
"[",
"\"AccessoryPairingID\"",
"]",
"conn",
"=",
"hass",
".",
"data",
"[",
"KNOWN_DEVICES",
"]",
"[",
"hkid",
... | [
136,
0
] | [
150,
40
] | python | en | ['en', 'ky', 'en'] | True |
HomeKitMotionSensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.MOTION_DETECTED] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"MOTION_DETECTED",
"]"
] | [
21,
4
] | [
23,
53
] | python | en | ['en', 'en', 'en'] | True |
HomeKitMotionSensor.device_class | (self) | Define this binary_sensor as a motion sensor. | Define this binary_sensor as a motion sensor. | def device_class(self):
"""Define this binary_sensor as a motion sensor."""
return DEVICE_CLASS_MOTION | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_MOTION"
] | [
26,
4
] | [
28,
34
] | python | en | ['en', 'pt', 'en'] | True |
HomeKitMotionSensor.is_on | (self) | Has motion been detected. | Has motion been detected. | def is_on(self):
"""Has motion been detected."""
return self.service.value(CharacteristicsTypes.MOTION_DETECTED) | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"MOTION_DETECTED",
")"
] | [
31,
4
] | [
33,
71
] | python | en | ['nl', 'en', 'en'] | True |
HomeKitContactSensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.CONTACT_STATE] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"CONTACT_STATE",
"]"
] | [
39,
4
] | [
41,
51
] | python | en | ['en', 'en', 'en'] | True |
HomeKitContactSensor.device_class | (self) | Define this binary_sensor as a opening sensor. | Define this binary_sensor as a opening sensor. | def device_class(self):
"""Define this binary_sensor as a opening sensor."""
return DEVICE_CLASS_OPENING | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_OPENING"
] | [
44,
4
] | [
46,
35
] | python | en | ['en', 'pt', 'en'] | True |
HomeKitContactSensor.is_on | (self) | Return true if the binary sensor is on/open. | Return true if the binary sensor is on/open. | def is_on(self):
"""Return true if the binary sensor is on/open."""
return self.service.value(CharacteristicsTypes.CONTACT_STATE) == 1 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"CONTACT_STATE",
")",
"==",
"1"
] | [
49,
4
] | [
51,
74
] | python | en | ['en', 'fy', 'en'] | True |
HomeKitSmokeSensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self) -> str:
"""Return the class of this sensor."""
return DEVICE_CLASS_SMOKE | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_SMOKE"
] | [
58,
4
] | [
60,
33
] | python | en | ['en', 'en', 'en'] | True |
HomeKitSmokeSensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.SMOKE_DETECTED] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"SMOKE_DETECTED",
"]"
] | [
62,
4
] | [
64,
52
] | python | en | ['en', 'en', 'en'] | True |
HomeKitSmokeSensor.is_on | (self) | Return true if smoke is currently detected. | Return true if smoke is currently detected. | def is_on(self):
"""Return true if smoke is currently detected."""
return self.service.value(CharacteristicsTypes.SMOKE_DETECTED) == 1 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"SMOKE_DETECTED",
")",
"==",
"1"
] | [
67,
4
] | [
69,
75
] | python | en | ['en', 'en', 'en'] | True |
HomeKitCarbonMonoxideSensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self) -> str:
"""Return the class of this sensor."""
return DEVICE_CLASS_GAS | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_GAS"
] | [
76,
4
] | [
78,
31
] | python | en | ['en', 'en', 'en'] | True |
HomeKitCarbonMonoxideSensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.CARBON_MONOXIDE_DETECTED] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"CARBON_MONOXIDE_DETECTED",
"]"
] | [
80,
4
] | [
82,
62
] | python | en | ['en', 'en', 'en'] | True |
HomeKitCarbonMonoxideSensor.is_on | (self) | Return true if CO is currently detected. | Return true if CO is currently detected. | def is_on(self):
"""Return true if CO is currently detected."""
return self.service.value(CharacteristicsTypes.CARBON_MONOXIDE_DETECTED) == 1 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"CARBON_MONOXIDE_DETECTED",
")",
"==",
"1"
] | [
85,
4
] | [
87,
85
] | python | en | ['en', 'en', 'en'] | True |
HomeKitOccupancySensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self) -> str:
"""Return the class of this sensor."""
return DEVICE_CLASS_OCCUPANCY | [
"def",
"device_class",
"(",
"self",
")",
"->",
"str",
":",
"return",
"DEVICE_CLASS_OCCUPANCY"
] | [
94,
4
] | [
96,
37
] | python | en | ['en', 'en', 'en'] | True |
HomeKitOccupancySensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.OCCUPANCY_DETECTED] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"OCCUPANCY_DETECTED",
"]"
] | [
98,
4
] | [
100,
56
] | python | en | ['en', 'en', 'en'] | True |
HomeKitOccupancySensor.is_on | (self) | Return true if occupancy is currently detected. | Return true if occupancy is currently detected. | def is_on(self):
"""Return true if occupancy is currently detected."""
return self.service.value(CharacteristicsTypes.OCCUPANCY_DETECTED) == 1 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"OCCUPANCY_DETECTED",
")",
"==",
"1"
] | [
103,
4
] | [
105,
79
] | python | en | ['en', 'en', 'en'] | True |
HomeKitLeakSensor.get_characteristic_types | (self) | Define the homekit characteristics the entity is tracking. | Define the homekit characteristics the entity is tracking. | def get_characteristic_types(self):
"""Define the homekit characteristics the entity is tracking."""
return [CharacteristicsTypes.LEAK_DETECTED] | [
"def",
"get_characteristic_types",
"(",
"self",
")",
":",
"return",
"[",
"CharacteristicsTypes",
".",
"LEAK_DETECTED",
"]"
] | [
111,
4
] | [
113,
51
] | python | en | ['en', 'en', 'en'] | True |
HomeKitLeakSensor.device_class | (self) | Define this binary_sensor as a leak sensor. | Define this binary_sensor as a leak sensor. | def device_class(self):
"""Define this binary_sensor as a leak sensor."""
return DEVICE_CLASS_MOISTURE | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_MOISTURE"
] | [
116,
4
] | [
118,
36
] | python | en | ['en', 'pt', 'en'] | True |
HomeKitLeakSensor.is_on | (self) | Return true if a leak is detected from the binary sensor. | Return true if a leak is detected from the binary sensor. | def is_on(self):
"""Return true if a leak is detected from the binary sensor."""
return self.service.value(CharacteristicsTypes.LEAK_DETECTED) == 1 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"service",
".",
"value",
"(",
"CharacteristicsTypes",
".",
"LEAK_DETECTED",
")",
"==",
"1"
] | [
121,
4
] | [
123,
74
] | python | en | ['en', 'en', 'en'] | True |
async_register_signal_handling | (hass: HomeAssistant) | Register system signal handler for core. | Register system signal handler for core. | def async_register_signal_handling(hass: HomeAssistant) -> None:
"""Register system signal handler for core."""
if sys.platform != "win32":
@callback
def async_signal_handle(exit_code: int) -> None:
"""Wrap signal handling.
* queue call to shutdown task
* re... | [
"def",
"async_register_signal_handling",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"if",
"sys",
".",
"platform",
"!=",
"\"win32\"",
":",
"@",
"callback",
"def",
"async_signal_handle",
"(",
"exit_code",
":",
"int",
")",
"->",
"None",
":",
"\"... | [
15,
0
] | [
70,
55
] | python | da | ['da', 'da', 'en'] | True |
test_validate | (hass) | Test validating pin. | Test validating pin. | async def test_validate(hass):
"""Test validating pin."""
auth_module = await auth_mfa_module_from_config(
hass,
{
"type": "insecure_example",
"data": [{"user_id": "test-user", "pin": "123456"}],
},
)
result = await auth_module.async_validate("test-user",... | [
"async",
"def",
"test_validate",
"(",
"hass",
")",
":",
"auth_module",
"=",
"await",
"auth_mfa_module_from_config",
"(",
"hass",
",",
"{",
"\"type\"",
":",
"\"insecure_example\"",
",",
"\"data\"",
":",
"[",
"{",
"\"user_id\"",
":",
"\"test-user\"",
",",
"\"pin\"... | [
8,
0
] | [
25,
26
] | python | fil | ['nl', 'fil', 'it'] | False |
test_setup_user | (hass) | Test setup user. | Test setup user. | async def test_setup_user(hass):
"""Test setup user."""
auth_module = await auth_mfa_module_from_config(
hass, {"type": "insecure_example", "data": []}
)
await auth_module.async_setup_user("test-user", {"pin": "123456"})
assert len(auth_module._data) == 1
result = await auth_module.asy... | [
"async",
"def",
"test_setup_user",
"(",
"hass",
")",
":",
"auth_module",
"=",
"await",
"auth_mfa_module_from_config",
"(",
"hass",
",",
"{",
"\"type\"",
":",
"\"insecure_example\"",
",",
"\"data\"",
":",
"[",
"]",
"}",
")",
"await",
"auth_module",
".",
"async_... | [
28,
0
] | [
38,
25
] | python | en | ['en', 'da', 'en'] | True |
test_depose_user | (hass) | Test despose user. | Test despose user. | async def test_depose_user(hass):
"""Test despose user."""
auth_module = await auth_mfa_module_from_config(
hass,
{
"type": "insecure_example",
"data": [{"user_id": "test-user", "pin": "123456"}],
},
)
assert len(auth_module._data) == 1
await auth_mod... | [
"async",
"def",
"test_depose_user",
"(",
"hass",
")",
":",
"auth_module",
"=",
"await",
"auth_mfa_module_from_config",
"(",
"hass",
",",
"{",
"\"type\"",
":",
"\"insecure_example\"",
",",
"\"data\"",
":",
"[",
"{",
"\"user_id\"",
":",
"\"test-user\"",
",",
"\"pi... | [
41,
0
] | [
53,
38
] | python | ca | ['ca', 'la', 'fr'] | False |
test_is_user_setup | (hass) | Test is user setup. | Test is user setup. | async def test_is_user_setup(hass):
"""Test is user setup."""
auth_module = await auth_mfa_module_from_config(
hass,
{
"type": "insecure_example",
"data": [{"user_id": "test-user", "pin": "123456"}],
},
)
assert await auth_module.async_is_user_setup("test-... | [
"async",
"def",
"test_is_user_setup",
"(",
"hass",
")",
":",
"auth_module",
"=",
"await",
"auth_mfa_module_from_config",
"(",
"hass",
",",
"{",
"\"type\"",
":",
"\"insecure_example\"",
",",
"\"data\"",
":",
"[",
"{",
"\"user_id\"",
":",
"\"test-user\"",
",",
"\"... | [
56,
0
] | [
66,
73
] | python | en | ['en', 'da', 'en'] | True |
test_login | (hass) | Test login flow with auth module. | Test login flow with auth module. | async def test_login(hass):
"""Test login flow with auth module."""
hass.auth = await auth.auth_manager_from_config(
hass,
[
{
"type": "insecure_example",
"users": [{"username": "test-user", "password": "test-pass"}],
}
],
[... | [
"async",
"def",
"test_login",
"(",
"hass",
")",
":",
"hass",
".",
"auth",
"=",
"await",
"auth",
".",
"auth_manager_from_config",
"(",
"hass",
",",
"[",
"{",
"\"type\"",
":",
"\"insecure_example\"",
",",
"\"users\"",
":",
"[",
"{",
"\"username\"",
":",
"\"t... | [
69,
0
] | [
133,
43
] | python | en | ['en', 'en', 'en'] | True |
test_setup_flow | (hass) | Test validating pin. | Test validating pin. | async def test_setup_flow(hass):
"""Test validating pin."""
auth_module = await auth_mfa_module_from_config(
hass,
{
"type": "insecure_example",
"data": [{"user_id": "test-user", "pin": "123456"}],
},
)
flow = await auth_module.async_setup_flow("new-user"... | [
"async",
"def",
"test_setup_flow",
"(",
"hass",
")",
":",
"auth_module",
"=",
"await",
"auth_mfa_module_from_config",
"(",
"hass",
",",
"{",
"\"type\"",
":",
"\"insecure_example\"",
",",
"\"data\"",
":",
"[",
"{",
"\"user_id\"",
":",
"\"test-user\"",
",",
"\"pin... | [
136,
0
] | [
154,
51
] | python | fil | ['nl', 'fil', 'it'] | False |
device_switch | (hass, zigpy_device_mock, zha_device_joined) | Test zha switch platform. | Test zha switch platform. | async def device_switch(hass, zigpy_device_mock, zha_device_joined):
"""Test zha switch platform."""
zigpy_device = zigpy_device_mock(
{
1: {
"in_clusters": [general.OnOff.cluster_id, general.Basic.cluster_id],
"out_clusters": [],
"device_type... | [
"async",
"def",
"device_switch",
"(",
"hass",
",",
"zigpy_device_mock",
",",
"zha_device_joined",
")",
":",
"zigpy_device",
"=",
"zigpy_device_mock",
"(",
"{",
"1",
":",
"{",
"\"in_clusters\"",
":",
"[",
"general",
".",
"OnOff",
".",
"cluster_id",
",",
"genera... | [
50,
0
] | [
65,
21
] | python | pl | ['cs', 'pl', 'pl'] | True |
device_groupable | (hass, zigpy_device_mock, zha_device_joined) | Test zha light platform. | Test zha light platform. | async def device_groupable(hass, zigpy_device_mock, zha_device_joined):
"""Test zha light platform."""
zigpy_device = zigpy_device_mock(
{
1: {
"in_clusters": [
general.OnOff.cluster_id,
general.Basic.cluster_id,
ge... | [
"async",
"def",
"device_groupable",
"(",
"hass",
",",
"zigpy_device_mock",
",",
"zha_device_joined",
")",
":",
"zigpy_device",
"=",
"zigpy_device_mock",
"(",
"{",
"1",
":",
"{",
"\"in_clusters\"",
":",
"[",
"general",
".",
"OnOff",
".",
"cluster_id",
",",
"gen... | [
69,
0
] | [
88,
21
] | python | cs | ['cs', 'lb', 'pl'] | False |
zha_client | (hass, hass_ws_client, device_switch, device_groupable) | Test zha switch platform. | Test zha switch platform. | async def zha_client(hass, hass_ws_client, device_switch, device_groupable):
"""Test zha switch platform."""
# load the ZHA API
async_load_api(hass)
return await hass_ws_client(hass) | [
"async",
"def",
"zha_client",
"(",
"hass",
",",
"hass_ws_client",
",",
"device_switch",
",",
"device_groupable",
")",
":",
"# load the ZHA API",
"async_load_api",
"(",
"hass",
")",
"return",
"await",
"hass_ws_client",
"(",
"hass",
")"
] | [
92,
0
] | [
97,
37
] | python | pl | ['cs', 'pl', 'pl'] | True |
test_device_clusters | (hass, zha_client) | Test getting device cluster info. | Test getting device cluster info. | async def test_device_clusters(hass, zha_client):
"""Test getting device cluster info."""
await zha_client.send_json(
{ID: 5, TYPE: "zha/devices/clusters", ATTR_IEEE: IEEE_SWITCH_DEVICE}
)
msg = await zha_client.receive_json()
assert len(msg["result"]) == 2
cluster_infos = sorted(msg[... | [
"async",
"def",
"test_device_clusters",
"(",
"hass",
",",
"zha_client",
")",
":",
"await",
"zha_client",
".",
"send_json",
"(",
"{",
"ID",
":",
"5",
",",
"TYPE",
":",
"\"zha/devices/clusters\"",
",",
"ATTR_IEEE",
":",
"IEEE_SWITCH_DEVICE",
"}",
")",
"msg",
"... | [
100,
0
] | [
120,
45
] | python | en | ['de', 'en', 'en'] | True |
test_device_cluster_attributes | (zha_client) | Test getting device cluster attributes. | Test getting device cluster attributes. | async def test_device_cluster_attributes(zha_client):
"""Test getting device cluster attributes."""
await zha_client.send_json(
{
ID: 5,
TYPE: "zha/devices/clusters/attributes",
ATTR_ENDPOINT_ID: 1,
ATTR_IEEE: IEEE_SWITCH_DEVICE,
ATTR_CLUSTER_I... | [
"async",
"def",
"test_device_cluster_attributes",
"(",
"zha_client",
")",
":",
"await",
"zha_client",
".",
"send_json",
"(",
"{",
"ID",
":",
"5",
",",
"TYPE",
":",
"\"zha/devices/clusters/attributes\"",
",",
"ATTR_ENDPOINT_ID",
":",
"1",
",",
"ATTR_IEEE",
":",
"... | [
123,
0
] | [
143,
47
] | python | en | ['de', 'en', 'en'] | True |
test_device_cluster_commands | (zha_client) | Test getting device cluster commands. | Test getting device cluster commands. | async def test_device_cluster_commands(zha_client):
"""Test getting device cluster commands."""
await zha_client.send_json(
{
ID: 5,
TYPE: "zha/devices/clusters/commands",
ATTR_ENDPOINT_ID: 1,
ATTR_IEEE: IEEE_SWITCH_DEVICE,
ATTR_CLUSTER_ID: 6,
... | [
"async",
"def",
"test_device_cluster_commands",
"(",
"zha_client",
")",
":",
"await",
"zha_client",
".",
"send_json",
"(",
"{",
"ID",
":",
"5",
",",
"TYPE",
":",
"\"zha/devices/clusters/commands\"",
",",
"ATTR_ENDPOINT_ID",
":",
"1",
",",
"ATTR_IEEE",
":",
"IEEE... | [
146,
0
] | [
167,
40
] | python | en | ['de', 'en', 'en'] | True |
test_list_devices | (zha_client) | Test getting zha devices. | Test getting zha devices. | async def test_list_devices(zha_client):
"""Test getting zha devices."""
await zha_client.send_json({ID: 5, TYPE: "zha/devices"})
msg = await zha_client.receive_json()
devices = msg["result"]
assert len(devices) == 2
msg_id = 100
for device in devices:
msg_id += 1
assert d... | [
"async",
"def",
"test_list_devices",
"(",
"zha_client",
")",
":",
"await",
"zha_client",
".",
"send_json",
"(",
"{",
"ID",
":",
"5",
",",
"TYPE",
":",
"\"zha/devices\"",
"}",
")",
"msg",
"=",
"await",
"zha_client",
".",
"receive_json",
"(",
")",
"devices",... | [
170,
0
] | [
200,
32
] | python | en | ['br', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.