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_component_loader_non_existing | (hass) | Test loading components. | Test loading components. | def test_component_loader_non_existing(hass):
"""Test loading components."""
components = loader.Components(hass)
with pytest.raises(ImportError):
components.non_existing | [
"def",
"test_component_loader_non_existing",
"(",
"hass",
")",
":",
"components",
"=",
"loader",
".",
"Components",
"(",
"hass",
")",
"with",
"pytest",
".",
"raises",
"(",
"ImportError",
")",
":",
"components",
".",
"non_existing"
] | [
61,
0
] | [
65,
31
] | python | en | ['de', 'en', 'en'] | True |
test_component_wrapper | (hass) | Test component wrapper. | Test component wrapper. | async def test_component_wrapper(hass):
"""Test component wrapper."""
calls = async_mock_service(hass, "persistent_notification", "create")
components = loader.Components(hass)
components.persistent_notification.async_create("message")
await hass.async_block_till_done()
assert len(calls) == 1 | [
"async",
"def",
"test_component_wrapper",
"(",
"hass",
")",
":",
"calls",
"=",
"async_mock_service",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"\"create\"",
")",
"components",
"=",
"loader",
".",
"Components",
"(",
"hass",
")",
"components",
".",
"pe... | [
68,
0
] | [
76,
26
] | python | en | ['de', 'en', 'en'] | True |
test_helpers_wrapper | (hass) | Test helpers wrapper. | Test helpers wrapper. | async def test_helpers_wrapper(hass):
"""Test helpers wrapper."""
helpers = loader.Helpers(hass)
result = []
def discovery_callback(service, discovered):
"""Handle discovery callback."""
result.append(discovered)
helpers.discovery.async_listen("service_name", discovery_callback)
... | [
"async",
"def",
"test_helpers_wrapper",
"(",
"hass",
")",
":",
"helpers",
"=",
"loader",
".",
"Helpers",
"(",
"hass",
")",
"result",
"=",
"[",
"]",
"def",
"discovery_callback",
"(",
"service",
",",
"discovered",
")",
":",
"\"\"\"Handle discovery callback.\"\"\""... | [
79,
0
] | [
94,
30
] | python | en | ['en', 'fy', 'en'] | True |
test_custom_component_name | (hass) | Test the name attribte of custom components. | Test the name attribte of custom components. | async def test_custom_component_name(hass):
"""Test the name attribte of custom components."""
integration = await loader.async_get_integration(hass, "test_standalone")
int_comp = integration.get_component()
assert int_comp.__name__ == "custom_components.test_standalone"
assert int_comp.__package__ ... | [
"async",
"def",
"test_custom_component_name",
"(",
"hass",
")",
":",
"integration",
"=",
"await",
"loader",
".",
"async_get_integration",
"(",
"hass",
",",
"\"test_standalone\"",
")",
"int_comp",
"=",
"integration",
".",
"get_component",
"(",
")",
"assert",
"int_c... | [
97,
0
] | [
125,
20
] | python | en | ['en', 'en', 'en'] | True |
test_log_warning_custom_component | (hass, caplog) | Test that we log a warning when loading a custom component. | Test that we log a warning when loading a custom component. | async def test_log_warning_custom_component(hass, caplog):
"""Test that we log a warning when loading a custom component."""
hass.components.test_standalone
assert "You are using a custom integration for test_standalone" in caplog.text
await loader.async_get_integration(hass, "test")
assert "You ar... | [
"async",
"def",
"test_log_warning_custom_component",
"(",
"hass",
",",
"caplog",
")",
":",
"hass",
".",
"components",
".",
"test_standalone",
"assert",
"\"You are using a custom integration for test_standalone\"",
"in",
"caplog",
".",
"text",
"await",
"loader",
".",
"as... | [
128,
0
] | [
134,
72
] | python | en | ['en', 'en', 'en'] | True |
test_get_integration | (hass) | Test resolving integration. | Test resolving integration. | async def test_get_integration(hass):
"""Test resolving integration."""
integration = await loader.async_get_integration(hass, "hue")
assert hue == integration.get_component()
assert hue_light == integration.get_platform("light") | [
"async",
"def",
"test_get_integration",
"(",
"hass",
")",
":",
"integration",
"=",
"await",
"loader",
".",
"async_get_integration",
"(",
"hass",
",",
"\"hue\"",
")",
"assert",
"hue",
"==",
"integration",
".",
"get_component",
"(",
")",
"assert",
"hue_light",
"... | [
137,
0
] | [
141,
57
] | python | en | ['en', 'da', 'en'] | True |
test_get_integration_legacy | (hass) | Test resolving integration. | Test resolving integration. | async def test_get_integration_legacy(hass):
"""Test resolving integration."""
integration = await loader.async_get_integration(hass, "test_embedded")
assert integration.get_component().DOMAIN == "test_embedded"
assert integration.get_platform("switch") is not None | [
"async",
"def",
"test_get_integration_legacy",
"(",
"hass",
")",
":",
"integration",
"=",
"await",
"loader",
".",
"async_get_integration",
"(",
"hass",
",",
"\"test_embedded\"",
")",
"assert",
"integration",
".",
"get_component",
"(",
")",
".",
"DOMAIN",
"==",
"... | [
144,
0
] | [
148,
57
] | python | en | ['en', 'da', 'en'] | True |
test_get_integration_custom_component | (hass) | Test resolving integration. | Test resolving integration. | async def test_get_integration_custom_component(hass):
"""Test resolving integration."""
integration = await loader.async_get_integration(hass, "test_package")
print(integration)
assert integration.get_component().DOMAIN == "test_package"
assert integration.name == "Test Package" | [
"async",
"def",
"test_get_integration_custom_component",
"(",
"hass",
")",
":",
"integration",
"=",
"await",
"loader",
".",
"async_get_integration",
"(",
"hass",
",",
"\"test_package\"",
")",
"print",
"(",
"integration",
")",
"assert",
"integration",
".",
"get_compo... | [
151,
0
] | [
156,
45
] | python | en | ['en', 'da', 'en'] | True |
test_integration_properties | (hass) | Test integration properties. | Test integration properties. | def test_integration_properties(hass):
"""Test integration properties."""
integration = loader.Integration(
hass,
"homeassistant.components.hue",
None,
{
"name": "Philips Hue",
"domain": "hue",
"dependencies": ["test-dep"],
"require... | [
"def",
"test_integration_properties",
"(",
"hass",
")",
":",
"integration",
"=",
"loader",
".",
"Integration",
"(",
"hass",
",",
"\"homeassistant.components.hue\"",
",",
"None",
",",
"{",
"\"name\"",
":",
"\"Philips Hue\"",
",",
"\"domain\"",
":",
"\"hue\"",
",",
... | [
159,
0
] | [
238,
35
] | python | en | ['en', 'lb', 'en'] | True |
test_integrations_only_once | (hass) | Test that we load integrations only once. | Test that we load integrations only once. | async def test_integrations_only_once(hass):
"""Test that we load integrations only once."""
int_1 = hass.async_create_task(loader.async_get_integration(hass, "hue"))
int_2 = hass.async_create_task(loader.async_get_integration(hass, "hue"))
assert await int_1 is await int_2 | [
"async",
"def",
"test_integrations_only_once",
"(",
"hass",
")",
":",
"int_1",
"=",
"hass",
".",
"async_create_task",
"(",
"loader",
".",
"async_get_integration",
"(",
"hass",
",",
"\"hue\"",
")",
")",
"int_2",
"=",
"hass",
".",
"async_create_task",
"(",
"load... | [
241,
0
] | [
246,
37
] | python | en | ['en', 'en', 'en'] | True |
test_get_custom_components_internal | (hass) | Test that we can a list of custom components. | Test that we can a list of custom components. | async def test_get_custom_components_internal(hass):
"""Test that we can a list of custom components."""
# pylint: disable=protected-access
integrations = await loader._async_get_custom_components(hass)
assert integrations == {"test": ANY, "test_package": ANY} | [
"async",
"def",
"test_get_custom_components_internal",
"(",
"hass",
")",
":",
"# pylint: disable=protected-access",
"integrations",
"=",
"await",
"loader",
".",
"_async_get_custom_components",
"(",
"hass",
")",
"assert",
"integrations",
"==",
"{",
"\"test\"",
":",
"ANY"... | [
249,
0
] | [
253,
61
] | python | en | ['en', 'en', 'en'] | True |
_get_test_integration | (hass, name, config_flow) | Return a generated test integration. | Return a generated test integration. | def _get_test_integration(hass, name, config_flow):
"""Return a generated test integration."""
return loader.Integration(
hass,
f"homeassistant.components.{name}",
None,
{
"name": name,
"domain": name,
"config_flow": config_flow,
"d... | [
"def",
"_get_test_integration",
"(",
"hass",
",",
"name",
",",
"config_flow",
")",
":",
"return",
"loader",
".",
"Integration",
"(",
"hass",
",",
"f\"homeassistant.components.{name}\"",
",",
"None",
",",
"{",
"\"name\"",
":",
"name",
",",
"\"domain\"",
":",
"n... | [
256,
0
] | [
273,
5
] | python | en | ['en', 'en', 'en'] | True |
_get_test_integration_with_zeroconf_matcher | (hass, name, config_flow) | Return a generated test integration with a zeroconf matcher. | Return a generated test integration with a zeroconf matcher. | def _get_test_integration_with_zeroconf_matcher(hass, name, config_flow):
"""Return a generated test integration with a zeroconf matcher."""
return loader.Integration(
hass,
f"homeassistant.components.{name}",
None,
{
"name": name,
"domain": name,
... | [
"def",
"_get_test_integration_with_zeroconf_matcher",
"(",
"hass",
",",
"name",
",",
"config_flow",
")",
":",
"return",
"loader",
".",
"Integration",
"(",
"hass",
",",
"f\"homeassistant.components.{name}\"",
",",
"None",
",",
"{",
"\"name\"",
":",
"name",
",",
"\"... | [
276,
0
] | [
292,
5
] | python | en | ['en', 'en', 'en'] | True |
test_get_custom_components | (hass) | Verify that custom components are cached. | Verify that custom components are cached. | async def test_get_custom_components(hass):
"""Verify that custom components are cached."""
test_1_integration = _get_test_integration(hass, "test_1", False)
test_2_integration = _get_test_integration(hass, "test_2", True)
name = "homeassistant.loader._async_get_custom_components"
with patch(name) ... | [
"async",
"def",
"test_get_custom_components",
"(",
"hass",
")",
":",
"test_1_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_1\"",
",",
"False",
")",
"test_2_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_2\"",
",",
"True... | [
295,
0
] | [
310,
46
] | python | en | ['en', 'en', 'en'] | True |
test_get_config_flows | (hass) | Verify that custom components with config_flow are available. | Verify that custom components with config_flow are available. | async def test_get_config_flows(hass):
"""Verify that custom components with config_flow are available."""
test_1_integration = _get_test_integration(hass, "test_1", False)
test_2_integration = _get_test_integration(hass, "test_2", True)
with patch("homeassistant.loader.async_get_custom_components") as... | [
"async",
"def",
"test_get_config_flows",
"(",
"hass",
")",
":",
"test_1_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_1\"",
",",
"False",
")",
"test_2_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_2\"",
",",
"True",
... | [
313,
0
] | [
325,
36
] | python | en | ['en', 'en', 'en'] | True |
test_get_zeroconf | (hass) | Verify that custom components with zeroconf are found. | Verify that custom components with zeroconf are found. | async def test_get_zeroconf(hass):
"""Verify that custom components with zeroconf are found."""
test_1_integration = _get_test_integration(hass, "test_1", True)
test_2_integration = _get_test_integration_with_zeroconf_matcher(
hass, "test_2", True
)
with patch("homeassistant.loader.async_ge... | [
"async",
"def",
"test_get_zeroconf",
"(",
"hass",
")",
":",
"test_1_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_1\"",
",",
"True",
")",
"test_2_integration",
"=",
"_get_test_integration_with_zeroconf_matcher",
"(",
"hass",
",",
"\"test_2\"",
... | [
328,
0
] | [
344,
9
] | python | en | ['en', 'en', 'en'] | True |
test_get_homekit | (hass) | Verify that custom components with homekit are found. | Verify that custom components with homekit are found. | async def test_get_homekit(hass):
"""Verify that custom components with homekit are found."""
test_1_integration = _get_test_integration(hass, "test_1", True)
test_2_integration = _get_test_integration(hass, "test_2", True)
with patch("homeassistant.loader.async_get_custom_components") as mock_get:
... | [
"async",
"def",
"test_get_homekit",
"(",
"hass",
")",
":",
"test_1_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_1\"",
",",
"True",
")",
"test_2_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_2\"",
",",
"True",
")",
... | [
347,
0
] | [
359,
44
] | python | en | ['en', 'en', 'en'] | True |
test_get_ssdp | (hass) | Verify that custom components with ssdp are found. | Verify that custom components with ssdp are found. | async def test_get_ssdp(hass):
"""Verify that custom components with ssdp are found."""
test_1_integration = _get_test_integration(hass, "test_1", True)
test_2_integration = _get_test_integration(hass, "test_2", True)
with patch("homeassistant.loader.async_get_custom_components") as mock_get:
m... | [
"async",
"def",
"test_get_ssdp",
"(",
"hass",
")",
":",
"test_1_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_1\"",
",",
"True",
")",
"test_2_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_2\"",
",",
"True",
")",
"w... | [
362,
0
] | [
374,
84
] | python | en | ['en', 'en', 'en'] | True |
test_get_mqtt | (hass) | Verify that custom components with MQTT are found. | Verify that custom components with MQTT are found. | async def test_get_mqtt(hass):
"""Verify that custom components with MQTT are found."""
test_1_integration = _get_test_integration(hass, "test_1", True)
test_2_integration = _get_test_integration(hass, "test_2", True)
with patch("homeassistant.loader.async_get_custom_components") as mock_get:
m... | [
"async",
"def",
"test_get_mqtt",
"(",
"hass",
")",
":",
"test_1_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_1\"",
",",
"True",
")",
"test_2_integration",
"=",
"_get_test_integration",
"(",
"hass",
",",
"\"test_2\"",
",",
"True",
")",
"w... | [
377,
0
] | [
389,
53
] | python | en | ['en', 'en', 'en'] | True |
test_get_custom_components_safe_mode | (hass) | Test that we get empty custom components in safe mode. | Test that we get empty custom components in safe mode. | async def test_get_custom_components_safe_mode(hass):
"""Test that we get empty custom components in safe mode."""
hass.config.safe_mode = True
assert await loader.async_get_custom_components(hass) == {} | [
"async",
"def",
"test_get_custom_components_safe_mode",
"(",
"hass",
")",
":",
"hass",
".",
"config",
".",
"safe_mode",
"=",
"True",
"assert",
"await",
"loader",
".",
"async_get_custom_components",
"(",
"hass",
")",
"==",
"{",
"}"
] | [
392,
0
] | [
395,
63
] | python | en | ['en', 'en', 'en'] | True |
_async_reproduce_state | (
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce a single state. | Reproduce a single state. | async def _async_reproduce_state(
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce a single state."""
cur_state = hass.states.get(state.entity_id)
if cur_state is None:
_LOGGE... | [
"async",
"def",
"_async_reproduce_state",
"(",
"hass",
":",
"HomeAssistantType",
",",
"state",
":",
"State",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reproduce_options",
":",
"Optional",
"[",
"Dict",
"[",
"str",
",... | [
25,
0
] | [
64,
5
] | python | en | ['en', 'en', 'en'] | True |
async_reproduce_states | (
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce Timer states. | Reproduce Timer states. | async def async_reproduce_states(
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce Timer states."""
await asyncio.gather(
*(
_async_reproduce_state(
... | [
"async",
"def",
"async_reproduce_states",
"(",
"hass",
":",
"HomeAssistantType",
",",
"states",
":",
"Iterable",
"[",
"State",
"]",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reproduce_options",
":",
"Optional",
"[",
... | [
67,
0
] | [
82,
5
] | python | en | ['sv', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up a Kira sensor. | Set up a Kira sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up a Kira sensor."""
if discovery_info is not None:
name = discovery_info.get(CONF_NAME)
device = discovery_info.get(CONF_DEVICE)
kira = hass.data[DOMAIN][CONF_SENSOR][name]
add_entities([KiraReceiver(de... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"not",
"None",
":",
"name",
"=",
"discovery_info",
".",
"get",
"(",
"CONF_NAME",
")",
"device",
"=",
"disc... | [
15,
0
] | [
22,
50
] | python | en | ['en', 'su', 'en'] | True |
KiraReceiver.__init__ | (self, name, kira) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, kira):
"""Initialize the sensor."""
self._name = name
self._state = None
self._device = STATE_UNKNOWN
kira.registerCallback(self._update_callback) | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"kira",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_device",
"=",
"STATE_UNKNOWN",
"kira",
".",
"registerCallback",
"(",
"self",
".",
"_update_callback"... | [
28,
4
] | [
34,
52
] | python | en | ['en', 'en', 'en'] | True |
KiraReceiver.name | (self) | Return the name of the receiver. | Return the name of the receiver. | def name(self):
"""Return the name of the receiver."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
44,
4
] | [
46,
25
] | python | en | ['en', 'en', 'en'] | True |
KiraReceiver.icon | (self) | Return icon. | Return icon. | def icon(self):
"""Return icon."""
return ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"ICON"
] | [
49,
4
] | [
51,
19
] | python | en | ['en', 'la', 'en'] | False |
KiraReceiver.state | (self) | Return the state of the receiver. | Return the state of the receiver. | def state(self):
"""Return the state of the receiver."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
54,
4
] | [
56,
26
] | python | en | ['en', 'en', 'en'] | True |
KiraReceiver.device_state_attributes | (self) | Return the state attributes of the device. | Return the state attributes of the device. | def device_state_attributes(self):
"""Return the state attributes of the device."""
return {CONF_DEVICE: self._device} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"CONF_DEVICE",
":",
"self",
".",
"_device",
"}"
] | [
59,
4
] | [
61,
42
] | python | en | ['en', 'en', 'en'] | True |
KiraReceiver.should_poll | (self) | Entity should not be polled. | Entity should not be polled. | def should_poll(self) -> bool:
"""Entity should not be polled."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
64,
4
] | [
66,
20
] | python | en | ['en', 'en', 'en'] | True |
KiraReceiver.force_update | (self) | Kira should force updates. Repeated states have meaning. | Kira should force updates. Repeated states have meaning. | def force_update(self) -> bool:
"""Kira should force updates. Repeated states have meaning."""
return True | [
"def",
"force_update",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
69,
4
] | [
71,
19
] | python | en | ['en', 'en', 'en'] | True |
test_setup_missing_config | (hass) | Test setup with configuration missing required entries. | Test setup with configuration missing required entries. | async def test_setup_missing_config(hass):
"""Test setup with configuration missing required entries."""
assert await async_setup_component(
hass, sensor.DOMAIN, {"sensor": {"platform": "rest"}}
)
await hass.async_block_till_done()
assert len(hass.states.async_all()) == 0 | [
"async",
"def",
"test_setup_missing_config",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"\"sensor\"",
":",
"{",
"\"platform\"",
":",
"\"rest\"",
"}",
"}",
")",
"await",
"hass",
".",... | [
21,
0
] | [
27,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_missing_schema | (hass) | Test setup with resource missing schema. | Test setup with resource missing schema. | async def test_setup_missing_schema(hass):
"""Test setup with resource missing schema."""
assert await async_setup_component(
hass,
sensor.DOMAIN,
{"sensor": {"platform": "rest", "resource": "localhost", "method": "GET"}},
)
await hass.async_block_till_done()
assert len(hass.... | [
"async",
"def",
"test_setup_missing_schema",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"\"sensor\"",
":",
"{",
"\"platform\"",
":",
"\"rest\"",
",",
"\"resource\"",
":",
"\"localhost\"... | [
30,
0
] | [
38,
44
] | python | en | ['en', 'de', 'en'] | True |
test_setup_failed_connect | (hass) | Test setup when connection error occurs. | Test setup when connection error occurs. | async def test_setup_failed_connect(hass):
"""Test setup when connection error occurs."""
respx.get(
"http://localhost", content=httpx.RequestError(message="any", request=Mock())
)
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
"sensor": {
... | [
"async",
"def",
"test_setup_failed_connect",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"content",
"=",
"httpx",
".",
"RequestError",
"(",
"message",
"=",
"\"any\"",
",",
"request",
"=",
"Mock",
"(",
")",
")",
")",
"asser... | [
42,
0
] | [
59,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_timeout | (hass) | Test setup when connection timeout occurs. | Test setup when connection timeout occurs. | async def test_setup_timeout(hass):
"""Test setup when connection timeout occurs."""
respx.get("http://localhost", content=asyncio.TimeoutError())
assert await async_setup_component(
hass,
sensor.DOMAIN,
{"sensor": {"platform": "rest", "resource": "localhost", "method": "GET"}},
... | [
"async",
"def",
"test_setup_timeout",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"content",
"=",
"asyncio",
".",
"TimeoutError",
"(",
")",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"D... | [
63,
0
] | [
72,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_minimum | (hass) | Test setup with minimum configuration. | Test setup with minimum configuration. | async def test_setup_minimum(hass):
"""Test setup with minimum configuration."""
respx.get("http://localhost", status_code=200)
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
"sensor": {
"platform": "rest",
"resource": "http://l... | [
"async",
"def",
"test_setup_minimum",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"\"sensor\"",
... | [
76,
0
] | [
91,
44
] | python | en | ['en', 'zu', 'en'] | True |
test_setup_minimum_resource_template | (hass) | Test setup with minimum configuration (resource_template). | Test setup with minimum configuration (resource_template). | async def test_setup_minimum_resource_template(hass):
"""Test setup with minimum configuration (resource_template)."""
respx.get("http://localhost", status_code=200)
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
"sensor": {
"platform": "rest",... | [
"async",
"def",
"test_setup_minimum_resource_template",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",... | [
95,
0
] | [
109,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_duplicate_resource_template | (hass) | Test setup with duplicate resources. | Test setup with duplicate resources. | async def test_setup_duplicate_resource_template(hass):
"""Test setup with duplicate resources."""
respx.get("http://localhost", status_code=200)
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
"sensor": {
"platform": "rest",
"re... | [
"async",
"def",
"test_setup_duplicate_resource_template",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{... | [
113,
0
] | [
128,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_get | (hass) | Test setup with valid configuration. | Test setup with valid configuration. | async def test_setup_get(hass):
"""Test setup with valid configuration."""
respx.get("http://localhost", status_code=200, content="{}")
assert await async_setup_component(
hass,
"sensor",
{
"sensor": {
"platform": "rest",
"resource": "http:... | [
"async",
"def",
"test_setup_get",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"content",
"=",
"\"{}\"",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"sensor\"",
",",
"{... | [
132,
0
] | [
157,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_get_digest_auth | (hass) | Test setup with valid configuration. | Test setup with valid configuration. | async def test_setup_get_digest_auth(hass):
"""Test setup with valid configuration."""
respx.get("http://localhost", status_code=200, content="{}")
assert await async_setup_component(
hass,
"sensor",
{
"sensor": {
"platform": "rest",
"resou... | [
"async",
"def",
"test_setup_get_digest_auth",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"content",
"=",
"\"{}\"",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"sensor\"",... | [
161,
0
] | [
186,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_post | (hass) | Test setup with valid configuration. | Test setup with valid configuration. | async def test_setup_post(hass):
"""Test setup with valid configuration."""
respx.post("http://localhost", status_code=200, content="{}")
assert await async_setup_component(
hass,
"sensor",
{
"sensor": {
"platform": "rest",
"resource": "htt... | [
"async",
"def",
"test_setup_post",
"(",
"hass",
")",
":",
"respx",
".",
"post",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"content",
"=",
"\"{}\"",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"sensor\"",
",",
... | [
190,
0
] | [
215,
44
] | python | en | ['en', 'en', 'en'] | True |
test_setup_get_xml | (hass) | Test setup with valid xml configuration. | Test setup with valid xml configuration. | async def test_setup_get_xml(hass):
"""Test setup with valid xml configuration."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": "text/xml"},
content="<dog>abc</dog>",
)
assert await async_setup_component(
hass,
"sensor",
... | [
"async",
"def",
"test_setup_get_xml",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"\"text/xml\"",
"}",
",",
"content",
"=",
"\"<dog>abc</dog>\"",
",... | [
219,
0
] | [
248,
71
] | python | en | ['en', 'en', 'en'] | True |
test_setup_query_params | (hass) | Test setup with query params. | Test setup with query params. | async def test_setup_query_params(hass):
"""Test setup with query params."""
respx.get(
"http://localhost?search=something",
status_code=200,
)
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
"sensor": {
"platform": "rest",
... | [
"async",
"def",
"test_setup_query_params",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost?search=something\"",
",",
"status_code",
"=",
"200",
",",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
... | [
252,
0
] | [
271,
44
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs | (hass) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs(hass):
"""Test attributes get extracted from a JSON result."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": CONTENT_TYPE_JSON},
content='{ "key": "some_json_value" }',
)
assert await async_setup_component(... | [
"async",
"def",
"test_update_with_json_attrs",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"CONTENT_TYPE_JSON",
"}",
",",
"content",
"=",
"'{ \"key\":... | [
275,
0
] | [
306,
55
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_no_template | (hass) | Test update when there is no value template. | Test update when there is no value template. | async def test_update_with_no_template(hass):
"""Test update when there is no value template."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": CONTENT_TYPE_JSON},
content='{ "key": "some_json_value" }',
)
assert await async_setup_component(
... | [
"async",
"def",
"test_update_with_no_template",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"CONTENT_TYPE_JSON",
"}",
",",
"content",
"=",
"'{ \"key\"... | [
310,
0
] | [
340,
56
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_no_data | (hass, caplog) | Test attributes when no JSON result fetched. | Test attributes when no JSON result fetched. | async def test_update_with_json_attrs_no_data(hass, caplog):
"""Test attributes when no JSON result fetched."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": CONTENT_TYPE_JSON},
content="",
)
assert await async_setup_component(
hass,
... | [
"async",
"def",
"test_update_with_json_attrs_no_data",
"(",
"hass",
",",
"caplog",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"CONTENT_TYPE_JSON",
"}",
",",
"cont... | [
344,
0
] | [
377,
39
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_not_dict | (hass, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_not_dict(hass, caplog):
"""Test attributes get extracted from a JSON result."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": CONTENT_TYPE_JSON},
content='["list", "of", "things"]',
)
assert await async_set... | [
"async",
"def",
"test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"caplog",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"CONTENT_TYPE_JSON",
"}",
",",
"con... | [
381,
0
] | [
414,
52
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_bad_JSON | (hass, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_bad_JSON(hass, caplog):
"""Test attributes get extracted from a JSON result."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": CONTENT_TYPE_JSON},
content="This is text rather than JSON data.",
)
assert awai... | [
"async",
"def",
"test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"caplog",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"CONTENT_TYPE_JSON",
"}",
",",
"con... | [
418,
0
] | [
451,
42
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_with_json_attrs_path | (hass) | Test attributes get extracted from a JSON result with a template for the attributes. | Test attributes get extracted from a JSON result with a template for the attributes. | async def test_update_with_json_attrs_with_json_attrs_path(hass):
"""Test attributes get extracted from a JSON result with a template for the attributes."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": CONTENT_TYPE_JSON},
content='{ "toplevel": {"mast... | [
"async",
"def",
"test_update_with_json_attrs_with_json_attrs_path",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"CONTENT_TYPE_JSON",
"}",
",",
"content",
... | [
455,
0
] | [
489,
67
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_xml_convert_json_attrs_with_json_attrs_path | (hass) | Test attributes get extracted from a JSON result that was converted from XML with a template for the attributes. | Test attributes get extracted from a JSON result that was converted from XML with a template for the attributes. | async def test_update_with_xml_convert_json_attrs_with_json_attrs_path(hass):
"""Test attributes get extracted from a JSON result that was converted from XML with a template for the attributes."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": "text/xml"},
... | [
"async",
"def",
"test_update_with_xml_convert_json_attrs_with_json_attrs_path",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"\"text/xml\"",
"}",
",",
"con... | [
493,
0
] | [
526,
67
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_xml_convert_json_attrs_with_jsonattr_template | (hass) | Test attributes get extracted from a JSON result that was converted from XML. | Test attributes get extracted from a JSON result that was converted from XML. | async def test_update_with_xml_convert_json_attrs_with_jsonattr_template(hass):
"""Test attributes get extracted from a JSON result that was converted from XML."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": "text/xml"},
content='<?xml version="1.0" ... | [
"async",
"def",
"test_update_with_xml_convert_json_attrs_with_jsonattr_template",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"\"text/xml\"",
"}",
",",
"c... | [
530,
0
] | [
566,
45
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_application_xml_convert_json_attrs_with_jsonattr_template | (
hass,
) | Test attributes get extracted from a JSON result that was converted from XML with application/xml mime type. | Test attributes get extracted from a JSON result that was converted from XML with application/xml mime type. | async def test_update_with_application_xml_convert_json_attrs_with_jsonattr_template(
hass,
):
"""Test attributes get extracted from a JSON result that was converted from XML with application/xml mime type."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": ... | [
"async",
"def",
"test_update_with_application_xml_convert_json_attrs_with_jsonattr_template",
"(",
"hass",
",",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"\"application/... | [
570,
0
] | [
605,
41
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_xml_convert_bad_xml | (hass, caplog) | Test attributes get extracted from a XML result with bad xml. | Test attributes get extracted from a XML result with bad xml. | async def test_update_with_xml_convert_bad_xml(hass, caplog):
"""Test attributes get extracted from a XML result with bad xml."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": "text/xml"},
content="",
)
assert await async_setup_component(
... | [
"async",
"def",
"test_update_with_xml_convert_bad_xml",
"(",
"hass",
",",
"caplog",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"\"text/xml\"",
"}",
",",
"content"... | [
609,
0
] | [
641,
39
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_failed_get | (hass, caplog) | Test attributes get extracted from a XML result with bad xml. | Test attributes get extracted from a XML result with bad xml. | async def test_update_with_failed_get(hass, caplog):
"""Test attributes get extracted from a XML result with bad xml."""
respx.get(
"http://localhost",
status_code=200,
headers={"content-type": "text/xml"},
content="",
)
assert await async_setup_component(
hass,
... | [
"async",
"def",
"test_update_with_failed_get",
"(",
"hass",
",",
"caplog",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
",",
"headers",
"=",
"{",
"\"content-type\"",
":",
"\"text/xml\"",
"}",
",",
"content",
"=",
... | [
645,
0
] | [
677,
39
] | python | en | ['en', 'en', 'en'] | True |
test_reload | (hass) | Verify we can reload reset sensors. | Verify we can reload reset sensors. | async def test_reload(hass):
"""Verify we can reload reset sensors."""
respx.get("http://localhost", status_code=200)
await async_setup_component(
hass,
"sensor",
{
"sensor": {
"platform": "rest",
"method": "GET",
"name": ... | [
"async",
"def",
"test_reload",
"(",
"hass",
")",
":",
"respx",
".",
"get",
"(",
"\"http://localhost\"",
",",
"status_code",
"=",
"200",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"sensor\"",
",",
"{",
"\"sensor\"",
":",
"{",
"\"platform\"",
"... | [
681,
0
] | [
721,
44
] | python | en | ['en', 'ca', 'en'] | True |
async_setup | (hass: HomeAssistantType, config: ConfigType) | Set up the AdGuard Home components. | Set up the AdGuard Home components. | async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up the AdGuard Home components."""
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"return",
"True"
] | [
46,
0
] | [
48,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Set up AdGuard Home from a config entry. | Set up AdGuard Home from a config entry. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up AdGuard Home from a config entry."""
session = async_get_clientsession(hass, entry.data[CONF_VERIFY_SSL])
adguard = AdGuardHome(
entry.data[CONF_HOST],
port=entry.data[CONF_PORT],
username=ent... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"session",
"=",
"async_get_clientsession",
"(",
"hass",
",",
"entry",
".",
"data",
"[",
"CONF_VERIFY_SSL",
"]",
")",
"adguard"... | [
51,
0
] | [
114,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistantType, entry: ConfigType) | Unload AdGuard Home config entry. | Unload AdGuard Home config entry. | async def async_unload_entry(hass: HomeAssistantType, entry: ConfigType) -> bool:
"""Unload AdGuard Home config entry."""
hass.services.async_remove(DOMAIN, SERVICE_ADD_URL)
hass.services.async_remove(DOMAIN, SERVICE_REMOVE_URL)
hass.services.async_remove(DOMAIN, SERVICE_ENABLE_URL)
hass.services.as... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigType",
")",
"->",
"bool",
":",
"hass",
".",
"services",
".",
"async_remove",
"(",
"DOMAIN",
",",
"SERVICE_ADD_URL",
")",
"hass",
".",
"services",
".",
"asy... | [
117,
0
] | [
130,
15
] | python | en | ['da', 'en', 'en'] | True |
AdGuardHomeEntity.__init__ | (
self, adguard, name: str, icon: str, enabled_default: bool = True
) | Initialize the AdGuard Home entity. | Initialize the AdGuard Home entity. | def __init__(
self, adguard, name: str, icon: str, enabled_default: bool = True
) -> None:
"""Initialize the AdGuard Home entity."""
self._available = True
self._enabled_default = enabled_default
self._icon = icon
self._name = name
self.adguard = adguard | [
"def",
"__init__",
"(",
"self",
",",
"adguard",
",",
"name",
":",
"str",
",",
"icon",
":",
"str",
",",
"enabled_default",
":",
"bool",
"=",
"True",
")",
"->",
"None",
":",
"self",
".",
"_available",
"=",
"True",
"self",
".",
"_enabled_default",
"=",
... | [
136,
4
] | [
144,
30
] | python | en | ['en', 'en', 'en'] | True |
AdGuardHomeEntity.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self) -> str:
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
147,
4
] | [
149,
25
] | python | en | ['en', 'en', 'en'] | True |
AdGuardHomeEntity.icon | (self) | Return the mdi icon of the entity. | Return the mdi icon of the entity. | def icon(self) -> str:
"""Return the mdi icon of the entity."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_icon"
] | [
152,
4
] | [
154,
25
] | python | en | ['en', 'en', 'en'] | True |
AdGuardHomeEntity.entity_registry_enabled_default | (self) | Return if the entity should be enabled when first added to the entity registry. | Return if the entity should be enabled when first added to the entity registry. | def entity_registry_enabled_default(self) -> bool:
"""Return if the entity should be enabled when first added to the entity registry."""
return self._enabled_default | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_enabled_default"
] | [
157,
4
] | [
159,
36
] | python | en | ['en', 'en', 'en'] | True |
AdGuardHomeEntity.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self) -> bool:
"""Return True if entity is available."""
return self._available | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_available"
] | [
162,
4
] | [
164,
30
] | python | en | ['en', 'en', 'en'] | True |
AdGuardHomeEntity.async_update | (self) | Update AdGuard Home entity. | Update AdGuard Home entity. | async def async_update(self) -> None:
"""Update AdGuard Home entity."""
if not self.enabled:
return
try:
await self._adguard_update()
self._available = True
except AdGuardHomeError:
if self._available:
_LOGGER.debug(
... | [
"async",
"def",
"async_update",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"enabled",
":",
"return",
"try",
":",
"await",
"self",
".",
"_adguard_update",
"(",
")",
"self",
".",
"_available",
"=",
"True",
"except",
"AdGuardHomeError",
... | [
166,
4
] | [
180,
35
] | python | en | ['es', 'en', 'en'] | True |
AdGuardHomeEntity._adguard_update | (self) | Update AdGuard Home entity. | Update AdGuard Home entity. | async def _adguard_update(self) -> None:
"""Update AdGuard Home entity."""
raise NotImplementedError() | [
"async",
"def",
"_adguard_update",
"(",
"self",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
182,
4
] | [
184,
35
] | python | en | ['es', 'en', 'en'] | True |
AdGuardHomeDeviceEntity.device_info | (self) | Return device information about this AdGuard Home instance. | Return device information about this AdGuard Home instance. | def device_info(self) -> Dict[str, Any]:
"""Return device information about this AdGuard Home instance."""
return {
"identifiers": {
(DOMAIN, self.adguard.host, self.adguard.port, self.adguard.base_path)
},
"name": "AdGuard Home",
"manufact... | [
"def",
"device_info",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"adguard",
".",
"host",
",",
"self",
".",
"adguard",
".",
"port",
",",
"self",
".",... | [
191,
4
] | [
201,
9
] | python | en | ['en', 'en', 'en'] | True |
_async_has_devices | (hass) | Return if there are devices that can be discovered. | Return if there are devices that can be discovered. | async def _async_has_devices(hass):
"""Return if there are devices that can be discovered."""
lifx_ip_addresses = await aiolifx.LifxScan(hass.loop).scan()
return len(lifx_ip_addresses) > 0 | [
"async",
"def",
"_async_has_devices",
"(",
"hass",
")",
":",
"lifx_ip_addresses",
"=",
"await",
"aiolifx",
".",
"LifxScan",
"(",
"hass",
".",
"loop",
")",
".",
"scan",
"(",
")",
"return",
"len",
"(",
"lifx_ip_addresses",
")",
">",
"0"
] | [
9,
0
] | [
12,
37
] | python | en | ['en', 'en', 'en'] | True |
async_get_service | (hass, config, discovery_info=None) | Get the KNX notification service. | Get the KNX notification service. | async def async_get_service(hass, config, discovery_info=None):
"""Get the KNX notification service."""
notification_devices = []
for device in hass.data[DOMAIN].xknx.devices:
if isinstance(device, XknxNotification):
notification_devices.append(device)
return (
KNXNotificatio... | [
"async",
"def",
"async_get_service",
"(",
"hass",
",",
"config",
",",
"discovery_info",
"=",
"None",
")",
":",
"notification_devices",
"=",
"[",
"]",
"for",
"device",
"in",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"xknx",
".",
"devices",
":",
"if",
... | [
10,
0
] | [
18,
5
] | python | en | ['en', 'en', 'en'] | True |
KNXNotificationService.__init__ | (self, devices: List[XknxNotification]) | Initialize the service. | Initialize the service. | def __init__(self, devices: List[XknxNotification]):
"""Initialize the service."""
self.devices = devices | [
"def",
"__init__",
"(",
"self",
",",
"devices",
":",
"List",
"[",
"XknxNotification",
"]",
")",
":",
"self",
".",
"devices",
"=",
"devices"
] | [
24,
4
] | [
26,
30
] | python | en | ['en', 'en', 'en'] | True |
KNXNotificationService.targets | (self) | Return a dictionary of registered targets. | Return a dictionary of registered targets. | def targets(self):
"""Return a dictionary of registered targets."""
ret = {}
for device in self.devices:
ret[device.name] = device.name
return ret | [
"def",
"targets",
"(",
"self",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"device",
"in",
"self",
".",
"devices",
":",
"ret",
"[",
"device",
".",
"name",
"]",
"=",
"device",
".",
"name",
"return",
"ret"
] | [
29,
4
] | [
34,
18
] | python | en | ['en', 'en', 'en'] | True |
KNXNotificationService.async_send_message | (self, message="", **kwargs) | Send a notification to knx bus. | Send a notification to knx bus. | async def async_send_message(self, message="", **kwargs):
"""Send a notification to knx bus."""
if "target" in kwargs:
await self._async_send_to_device(message, kwargs["target"])
else:
await self._async_send_to_all_devices(message) | [
"async",
"def",
"async_send_message",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"target\"",
"in",
"kwargs",
":",
"await",
"self",
".",
"_async_send_to_device",
"(",
"message",
",",
"kwargs",
"[",
"\"target\"",
"]"... | [
36,
4
] | [
41,
58
] | python | en | ['en', 'en', 'en'] | True |
KNXNotificationService._async_send_to_all_devices | (self, message) | Send a notification to knx bus to all connected devices. | Send a notification to knx bus to all connected devices. | async def _async_send_to_all_devices(self, message):
"""Send a notification to knx bus to all connected devices."""
for device in self.devices:
await device.set(message) | [
"async",
"def",
"_async_send_to_all_devices",
"(",
"self",
",",
"message",
")",
":",
"for",
"device",
"in",
"self",
".",
"devices",
":",
"await",
"device",
".",
"set",
"(",
"message",
")"
] | [
43,
4
] | [
46,
37
] | python | en | ['en', 'en', 'en'] | True |
KNXNotificationService._async_send_to_device | (self, message, names) | Send a notification to knx bus to device with given names. | Send a notification to knx bus to device with given names. | async def _async_send_to_device(self, message, names):
"""Send a notification to knx bus to device with given names."""
for device in self.devices:
if device.name in names:
await device.set(message) | [
"async",
"def",
"_async_send_to_device",
"(",
"self",
",",
"message",
",",
"names",
")",
":",
"for",
"device",
"in",
"self",
".",
"devices",
":",
"if",
"device",
".",
"name",
"in",
"names",
":",
"await",
"device",
".",
"set",
"(",
"message",
")"
] | [
48,
4
] | [
52,
41
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the SNMP switch. | Set up the SNMP switch. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the SNMP switch."""
name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
port = config.get(CONF_PORT)
community = config.get(CONF_COMMUNITY)
baseoid = config.get(CONF_BASEOID)
command_oid = ... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"host",
"=",
"config",
".",
"get",
"(",
"CONF_HOST",
")",... | [
116,
0
] | [
159,
5
] | python | en | ['en', 'en', 'en'] | True |
SnmpSwitch.__init__ | (
self,
name,
host,
port,
community,
baseoid,
commandoid,
version,
username,
authkey,
authproto,
privkey,
privproto,
payload_on,
payload_off,
command_payload_on,
command_payload_off,
... | Initialize the switch. | Initialize the switch. | def __init__(
self,
name,
host,
port,
community,
baseoid,
commandoid,
version,
username,
authkey,
authproto,
privkey,
privproto,
payload_on,
payload_off,
command_payload_on,
command_pa... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"host",
",",
"port",
",",
"community",
",",
"baseoid",
",",
"commandoid",
",",
"version",
",",
"username",
",",
"authkey",
",",
"authproto",
",",
"privkey",
",",
"privproto",
",",
"payload_on",
",",
"payl... | [
165,
4
] | [
225,
13
] | python | en | ['en', 'en', 'en'] | True |
SnmpSwitch.async_turn_on | (self, **kwargs) | Turn on the switch. | Turn on the switch. | async def async_turn_on(self, **kwargs):
"""Turn on the switch."""
# If vartype set, use it - http://snmplabs.com/pysnmp/docs/api-reference.html#pysnmp.smi.rfc1902.ObjectType
await self._execute_command(self._command_payload_on) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# If vartype set, use it - http://snmplabs.com/pysnmp/docs/api-reference.html#pysnmp.smi.rfc1902.ObjectType",
"await",
"self",
".",
"_execute_command",
"(",
"self",
".",
"_command_payload_on",
"... | [
227,
4
] | [
230,
61
] | python | en | ['en', 'en', 'en'] | True |
SnmpSwitch.async_turn_off | (self, **kwargs) | Turn off the switch. | Turn off the switch. | async def async_turn_off(self, **kwargs):
"""Turn off the switch."""
await self._execute_command(self._command_payload_off) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"_execute_command",
"(",
"self",
".",
"_command_payload_off",
")"
] | [
232,
4
] | [
234,
62
] | python | en | ['en', 'en', 'en'] | True |
SnmpSwitch.async_update | (self) | Update the state. | Update the state. | async def async_update(self):
"""Update the state."""
errindication, errstatus, errindex, restable = await getCmd(
*self._request_args, ObjectType(ObjectIdentity(self._baseoid))
)
if errindication:
_LOGGER.error("SNMP error: %s", errindication)
elif errst... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"errindication",
",",
"errstatus",
",",
"errindex",
",",
"restable",
"=",
"await",
"getCmd",
"(",
"*",
"self",
".",
"_request_args",
",",
"ObjectType",
"(",
"ObjectIdentity",
"(",
"self",
".",
"_baseoid"... | [
248,
4
] | [
273,
38
] | python | en | ['en', 'en', 'en'] | True |
SnmpSwitch.name | (self) | Return the switch's name. | Return the switch's name. | def name(self):
"""Return the switch's name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
276,
4
] | [
278,
25
] | python | en | ['en', 'en', 'en'] | True |
SnmpSwitch.is_on | (self) | Return true if switch is on; False if off. None if unknown. | Return true if switch is on; False if off. None if unknown. | def is_on(self):
"""Return true if switch is on; False if off. None if unknown."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
281,
4
] | [
283,
26
] | python | en | ['en', 'en', 'en'] | True |
test_light | (
hass: HomeAssistant, vera_component_factory: ComponentFactory
) | Test function. | Test function. | async def test_light(
hass: HomeAssistant, vera_component_factory: ComponentFactory
) -> None:
"""Test function."""
vera_device = MagicMock(spec=pv.VeraDimmer) # type: pv.VeraDimmer
vera_device.device_id = 1
vera_device.vera_device_id = vera_device.device_id
vera_device.name = "dev1"
vera_d... | [
"async",
"def",
"test_light",
"(",
"hass",
":",
"HomeAssistant",
",",
"vera_component_factory",
":",
"ComponentFactory",
")",
"->",
"None",
":",
"vera_device",
"=",
"MagicMock",
"(",
"spec",
"=",
"pv",
".",
"VeraDimmer",
")",
"# type: pv.VeraDimmer",
"vera_device"... | [
11,
0
] | [
84,
52
] | python | en | ['en', 'en', 'en'] | False |
test_call_service | (hass, websocket_client) | Test call service command. | Test call service command. | async def test_call_service(hass, websocket_client):
"""Test call service command."""
calls = []
@callback
def service_call(call):
calls.append(call)
hass.services.async_register("domain_test", "test_service", service_call)
await websocket_client.send_json(
{
"id":... | [
"async",
"def",
"test_call_service",
"(",
"hass",
",",
"websocket_client",
")",
":",
"calls",
"=",
"[",
"]",
"@",
"callback",
"def",
"service_call",
"(",
"call",
")",
":",
"calls",
".",
"append",
"(",
"call",
")",
"hass",
".",
"services",
".",
"async_reg... | [
19,
0
] | [
49,
42
] | python | en | ['en', 'en', 'en'] | True |
test_call_service_not_found | (hass, websocket_client) | Test call service command. | Test call service command. | async def test_call_service_not_found(hass, websocket_client):
"""Test call service command."""
await websocket_client.send_json(
{
"id": 5,
"type": "call_service",
"domain": "domain_test",
"service": "test_service",
"service_data": {"hello": "... | [
"async",
"def",
"test_call_service_not_found",
"(",
"hass",
",",
"websocket_client",
")",
":",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"call_service\"",
",",
"\"domain\"",
":",
"\"domain_test\"",
",",
... | [
52,
0
] | [
68,
54
] | python | en | ['en', 'en', 'en'] | True |
test_call_service_child_not_found | (hass, websocket_client) | Test not reporting not found errors if it's not the called service. | Test not reporting not found errors if it's not the called service. | async def test_call_service_child_not_found(hass, websocket_client):
"""Test not reporting not found errors if it's not the called service."""
async def serv_handler(call):
await hass.services.async_call("non", "existing")
hass.services.async_register("domain_test", "test_service", serv_handler)
... | [
"async",
"def",
"test_call_service_child_not_found",
"(",
"hass",
",",
"websocket_client",
")",
":",
"async",
"def",
"serv_handler",
"(",
"call",
")",
":",
"await",
"hass",
".",
"services",
".",
"async_call",
"(",
"\"non\"",
",",
"\"existing\"",
")",
"hass",
"... | [
71,
0
] | [
93,
65
] | python | en | ['en', 'en', 'en'] | True |
test_call_service_error | (hass, websocket_client) | Test call service command with error. | Test call service command with error. | async def test_call_service_error(hass, websocket_client):
"""Test call service command with error."""
@callback
def ha_error_call(_):
raise HomeAssistantError("error_message")
hass.services.async_register("domain_test", "ha_error", ha_error_call)
async def unknown_error_call(_):
... | [
"async",
"def",
"test_call_service_error",
"(",
"hass",
",",
"websocket_client",
")",
":",
"@",
"callback",
"def",
"ha_error_call",
"(",
"_",
")",
":",
"raise",
"HomeAssistantError",
"(",
"\"error_message\"",
")",
"hass",
".",
"services",
".",
"async_register",
... | [
96,
0
] | [
142,
51
] | python | en | ['en', 'en', 'en'] | True |
test_subscribe_unsubscribe_events | (hass, websocket_client) | Test subscribe/unsubscribe events command. | Test subscribe/unsubscribe events command. | async def test_subscribe_unsubscribe_events(hass, websocket_client):
"""Test subscribe/unsubscribe events command."""
init_count = sum(hass.bus.async_listeners().values())
await websocket_client.send_json(
{"id": 5, "type": "subscribe_events", "event_type": "test_event"}
)
msg = await webs... | [
"async",
"def",
"test_subscribe_unsubscribe_events",
"(",
"hass",
",",
"websocket_client",
")",
":",
"init_count",
"=",
"sum",
"(",
"hass",
".",
"bus",
".",
"async_listeners",
"(",
")",
".",
"values",
"(",
")",
")",
"await",
"websocket_client",
".",
"send_json... | [
145,
0
] | [
186,
65
] | python | en | ['en', 'en', 'en'] | True |
test_get_states | (hass, websocket_client) | Test get_states command. | Test get_states command. | async def test_get_states(hass, websocket_client):
"""Test get_states command."""
hass.states.async_set("greeting.hello", "world")
hass.states.async_set("greeting.bye", "universe")
await websocket_client.send_json({"id": 5, "type": "get_states"})
msg = await websocket_client.receive_json()
ass... | [
"async",
"def",
"test_get_states",
"(",
"hass",
",",
"websocket_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"greeting.hello\"",
",",
"\"world\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"greeting.bye\"",
",",
"\"universe\"",
... | [
189,
0
] | [
205,
34
] | python | en | ['nl', 'en', 'en'] | True |
test_get_services | (hass, websocket_client) | Test get_services command. | Test get_services command. | async def test_get_services(hass, websocket_client):
"""Test get_services command."""
await websocket_client.send_json({"id": 5, "type": "get_services"})
msg = await websocket_client.receive_json()
assert msg["id"] == 5
assert msg["type"] == const.TYPE_RESULT
assert msg["success"]
assert ms... | [
"async",
"def",
"test_get_services",
"(",
"hass",
",",
"websocket_client",
")",
":",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"get_services\"",
"}",
")",
"msg",
"=",
"await",
"websocket_client",
".",
... | [
208,
0
] | [
216,
58
] | python | en | ['nl', 'en', 'en'] | True |
test_get_config | (hass, websocket_client) | Test get_config command. | Test get_config command. | async def test_get_config(hass, websocket_client):
"""Test get_config command."""
await websocket_client.send_json({"id": 5, "type": "get_config"})
msg = await websocket_client.receive_json()
assert msg["id"] == 5
assert msg["type"] == const.TYPE_RESULT
assert msg["success"]
if "components... | [
"async",
"def",
"test_get_config",
"(",
"hass",
",",
"websocket_client",
")",
":",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"get_config\"",
"}",
")",
"msg",
"=",
"await",
"websocket_client",
".",
"r... | [
219,
0
] | [
243,
49
] | python | en | ['nl', 'en', 'en'] | True |
test_ping | (websocket_client) | Test get_panels command. | Test get_panels command. | async def test_ping(websocket_client):
"""Test get_panels command."""
await websocket_client.send_json({"id": 5, "type": "ping"})
msg = await websocket_client.receive_json()
assert msg["id"] == 5
assert msg["type"] == "pong" | [
"async",
"def",
"test_ping",
"(",
"websocket_client",
")",
":",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"ping\"",
"}",
")",
"msg",
"=",
"await",
"websocket_client",
".",
"receive_json",
"(",
")",
... | [
246,
0
] | [
252,
32
] | python | en | ['nl', 'en', 'en'] | True |
test_call_service_context_with_user | (hass, aiohttp_client, hass_access_token) | Test that the user is set in the service call context. | Test that the user is set in the service call context. | async def test_call_service_context_with_user(hass, aiohttp_client, hass_access_token):
"""Test that the user is set in the service call context."""
assert await async_setup_component(hass, "websocket_api", {})
calls = async_mock_service(hass, "domain_test", "test_service")
client = await aiohttp_clien... | [
"async",
"def",
"test_call_service_context_with_user",
"(",
"hass",
",",
"aiohttp_client",
",",
"hass_access_token",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"websocket_api\"",
",",
"{",
"}",
")",
"calls",
"=",
"async_mock_service",
... | [
255,
0
] | [
291,
60
] | python | en | ['en', 'en', 'en'] | True |
test_subscribe_requires_admin | (websocket_client, hass_admin_user) | Test subscribing events without being admin. | Test subscribing events without being admin. | async def test_subscribe_requires_admin(websocket_client, hass_admin_user):
"""Test subscribing events without being admin."""
hass_admin_user.groups = []
await websocket_client.send_json(
{"id": 5, "type": "subscribe_events", "event_type": "test_event"}
)
msg = await websocket_client.recei... | [
"async",
"def",
"test_subscribe_requires_admin",
"(",
"websocket_client",
",",
"hass_admin_user",
")",
":",
"hass_admin_user",
".",
"groups",
"=",
"[",
"]",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"sub... | [
294,
0
] | [
303,
57
] | python | en | ['en', 'en', 'en'] | True |
test_states_filters_visible | (hass, hass_admin_user, websocket_client) | Test we only get entities that we're allowed to see. | Test we only get entities that we're allowed to see. | async def test_states_filters_visible(hass, hass_admin_user, websocket_client):
"""Test we only get entities that we're allowed to see."""
hass_admin_user.mock_policy({"entities": {"entity_ids": {"test.entity": True}}})
hass.states.async_set("test.entity", "hello")
hass.states.async_set("test.not_visibl... | [
"async",
"def",
"test_states_filters_visible",
"(",
"hass",
",",
"hass_admin_user",
",",
"websocket_client",
")",
":",
"hass_admin_user",
".",
"mock_policy",
"(",
"{",
"\"entities\"",
":",
"{",
"\"entity_ids\"",
":",
"{",
"\"test.entity\"",
":",
"True",
"}",
"}",
... | [
306,
0
] | [
319,
57
] | python | en | ['en', 'en', 'en'] | True |
test_get_states_not_allows_nan | (hass, websocket_client) | Test get_states command not allows NaN floats. | Test get_states command not allows NaN floats. | async def test_get_states_not_allows_nan(hass, websocket_client):
"""Test get_states command not allows NaN floats."""
hass.states.async_set("greeting.hello", "world", {"hello": float("NaN")})
await websocket_client.send_json({"id": 5, "type": "get_states"})
msg = await websocket_client.receive_json()... | [
"async",
"def",
"test_get_states_not_allows_nan",
"(",
"hass",
",",
"websocket_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"greeting.hello\"",
",",
"\"world\"",
",",
"{",
"\"hello\"",
":",
"float",
"(",
"\"NaN\"",
")",
"}",
")",
"await",... | [
322,
0
] | [
330,
58
] | python | en | ['en', 'en', 'en'] | True |
test_subscribe_unsubscribe_events_whitelist | (
hass, websocket_client, hass_admin_user
) | Test subscribe/unsubscribe events on whitelist. | Test subscribe/unsubscribe events on whitelist. | async def test_subscribe_unsubscribe_events_whitelist(
hass, websocket_client, hass_admin_user
):
"""Test subscribe/unsubscribe events on whitelist."""
hass_admin_user.groups = []
await websocket_client.send_json(
{"id": 5, "type": "subscribe_events", "event_type": "not-in-whitelist"}
)
... | [
"async",
"def",
"test_subscribe_unsubscribe_events_whitelist",
"(",
"hass",
",",
"websocket_client",
",",
"hass_admin_user",
")",
":",
"hass_admin_user",
".",
"groups",
"=",
"[",
"]",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
","... | [
333,
0
] | [
367,
37
] | python | en | ['en', 'en', 'en'] | True |
test_subscribe_unsubscribe_events_state_changed | (
hass, websocket_client, hass_admin_user
) | Test subscribe/unsubscribe state_changed events. | Test subscribe/unsubscribe state_changed events. | async def test_subscribe_unsubscribe_events_state_changed(
hass, websocket_client, hass_admin_user
):
"""Test subscribe/unsubscribe state_changed events."""
hass_admin_user.groups = []
hass_admin_user.mock_policy({"entities": {"entity_ids": {"light.permitted": True}}})
await websocket_client.send_j... | [
"async",
"def",
"test_subscribe_unsubscribe_events_state_changed",
"(",
"hass",
",",
"websocket_client",
",",
"hass_admin_user",
")",
":",
"hass_admin_user",
".",
"groups",
"=",
"[",
"]",
"hass_admin_user",
".",
"mock_policy",
"(",
"{",
"\"entities\"",
":",
"{",
"\"... | [
370,
0
] | [
393,
65
] | python | en | ['en', 'en', 'en'] | True |
test_render_template_renders_template | (hass, websocket_client) | Test simple template is rendered and updated. | Test simple template is rendered and updated. | async def test_render_template_renders_template(hass, websocket_client):
"""Test simple template is rendered and updated."""
hass.states.async_set("light.test", "on")
await websocket_client.send_json(
{
"id": 5,
"type": "render_template",
"template": "State is: {... | [
"async",
"def",
"test_render_template_renders_template",
"(",
"hass",
",",
"websocket_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.test\"",
",",
"\"on\"",
")",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"... | [
396,
0
] | [
440,
5
] | python | en | ['en', 'en', 'en'] | True |
test_render_template_manual_entity_ids_no_longer_needed | (
hass, websocket_client
) | Test that updates to specified entity ids cause a template rerender. | Test that updates to specified entity ids cause a template rerender. | async def test_render_template_manual_entity_ids_no_longer_needed(
hass, websocket_client
):
"""Test that updates to specified entity ids cause a template rerender."""
hass.states.async_set("light.test", "on")
await websocket_client.send_json(
{
"id": 5,
"type": "render_... | [
"async",
"def",
"test_render_template_manual_entity_ids_no_longer_needed",
"(",
"hass",
",",
"websocket_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.test\"",
",",
"\"on\"",
")",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\... | [
443,
0
] | [
489,
5
] | python | en | ['en', 'en', 'en'] | True |
test_render_template_with_error | (hass, websocket_client, caplog) | Test a template with an error. | Test a template with an error. | async def test_render_template_with_error(hass, websocket_client, caplog):
"""Test a template with an error."""
await websocket_client.send_json(
{"id": 5, "type": "render_template", "template": "{{ my_unknown_var() + 1 }}"}
)
msg = await websocket_client.receive_json()
assert msg["id"] == ... | [
"async",
"def",
"test_render_template_with_error",
"(",
"hass",
",",
"websocket_client",
",",
"caplog",
")",
":",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"render_template\"",
",",
"\"template\"",
":",
... | [
492,
0
] | [
504,
45
] | python | en | ['en', 'en', 'en'] | True |
test_render_template_with_timeout_and_error | (hass, websocket_client, caplog) | Test a template with an error with a timeout. | Test a template with an error with a timeout. | async def test_render_template_with_timeout_and_error(hass, websocket_client, caplog):
"""Test a template with an error with a timeout."""
await websocket_client.send_json(
{
"id": 5,
"type": "render_template",
"template": "{{ now() | rando }}",
"timeout":... | [
"async",
"def",
"test_render_template_with_timeout_and_error",
"(",
"hass",
",",
"websocket_client",
",",
"caplog",
")",
":",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"render_template\"",
",",
"\"template\"... | [
507,
0
] | [
524,
45
] | python | en | ['en', 'en', 'en'] | True |
test_render_template_error_in_template_code | (hass, websocket_client, caplog) | Test a template that will throw in template.py. | Test a template that will throw in template.py. | async def test_render_template_error_in_template_code(hass, websocket_client, caplog):
"""Test a template that will throw in template.py."""
await websocket_client.send_json(
{"id": 5, "type": "render_template", "template": "{{ now() | random }}"}
)
msg = await websocket_client.receive_json()
... | [
"async",
"def",
"test_render_template_error_in_template_code",
"(",
"hass",
",",
"websocket_client",
",",
"caplog",
")",
":",
"await",
"websocket_client",
".",
"send_json",
"(",
"{",
"\"id\"",
":",
"5",
",",
"\"type\"",
":",
"\"render_template\"",
",",
"\"template\"... | [
527,
0
] | [
539,
45
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.