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_disabled_notification_sensor | (hass, multisensor_6, integration) | Test sensor is created from Notification CC and is disabled. | Test sensor is created from Notification CC and is disabled. | async def test_disabled_notification_sensor(hass, multisensor_6, integration):
"""Test sensor is created from Notification CC and is disabled."""
ent_reg = er.async_get(hass)
entity_entry = ent_reg.async_get(NOTIFICATION_MOTION_SENSOR)
assert entity_entry
assert entity_entry.disabled
assert ent... | [
"async",
"def",
"test_disabled_notification_sensor",
"(",
"hass",
",",
"multisensor_6",
",",
"integration",
")",
":",
"ent_reg",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"entity_entry",
"=",
"ent_reg",
".",
"async_get",
"(",
"NOTIFICATION_MOTION_SENSOR",
")"... | [
101,
0
] | [
123,
41
] | python | en | ['en', 'en', 'en'] | True |
test_disabled_indcator_sensor | (
hass, climate_radio_thermostat_ct100_plus, integration
) | Test sensor is created from Indicator CC and is disabled. | Test sensor is created from Indicator CC and is disabled. | async def test_disabled_indcator_sensor(
hass, climate_radio_thermostat_ct100_plus, integration
):
"""Test sensor is created from Indicator CC and is disabled."""
ent_reg = er.async_get(hass)
entity_entry = ent_reg.async_get(INDICATOR_SENSOR)
assert entity_entry
assert entity_entry.disabled
... | [
"async",
"def",
"test_disabled_indcator_sensor",
"(",
"hass",
",",
"climate_radio_thermostat_ct100_plus",
",",
"integration",
")",
":",
"ent_reg",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"entity_entry",
"=",
"ent_reg",
".",
"async_get",
"(",
"INDICATOR_SENSOR... | [
126,
0
] | [
135,
62
] | python | en | ['en', 'en', 'en'] | True |
test_config_parameter_sensor | (hass, lock_id_lock_as_id150, integration) | Test config parameter sensor is created. | Test config parameter sensor is created. | async def test_config_parameter_sensor(hass, lock_id_lock_as_id150, integration):
"""Test config parameter sensor is created."""
ent_reg = er.async_get(hass)
entity_entry = ent_reg.async_get(ID_LOCK_CONFIG_PARAMETER_SENSOR)
assert entity_entry
assert entity_entry.disabled | [
"async",
"def",
"test_config_parameter_sensor",
"(",
"hass",
",",
"lock_id_lock_as_id150",
",",
"integration",
")",
":",
"ent_reg",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"entity_entry",
"=",
"ent_reg",
".",
"async_get",
"(",
"ID_LOCK_CONFIG_PARAMETER_SENSOR... | [
138,
0
] | [
143,
32
] | python | en | ['en', 'en', 'en'] | True |
test_node_status_sensor | (hass, client, lock_id_lock_as_id150, integration) | Test node status sensor is created and gets updated on node state changes. | Test node status sensor is created and gets updated on node state changes. | async def test_node_status_sensor(hass, client, lock_id_lock_as_id150, integration):
"""Test node status sensor is created and gets updated on node state changes."""
NODE_STATUS_ENTITY = "sensor.z_wave_module_for_id_lock_150_and_101_node_status"
node = lock_id_lock_as_id150
ent_reg = er.async_get(hass)
... | [
"async",
"def",
"test_node_status_sensor",
"(",
"hass",
",",
"client",
",",
"lock_id_lock_as_id150",
",",
"integration",
")",
":",
"NODE_STATUS_ENTITY",
"=",
"\"sensor.z_wave_module_for_id_lock_150_and_101_node_status\"",
"node",
"=",
"lock_id_lock_as_id150",
"ent_reg",
"=",
... | [
146,
0
] | [
191,
73
] | python | en | ['en', 'en', 'en'] | True |
test_node_status_sensor_not_ready | (
hass,
client,
lock_id_lock_as_id150_not_ready,
lock_id_lock_as_id150_state,
integration,
) | Test node status sensor is created and available if node is not ready. | Test node status sensor is created and available if node is not ready. | async def test_node_status_sensor_not_ready(
hass,
client,
lock_id_lock_as_id150_not_ready,
lock_id_lock_as_id150_state,
integration,
):
"""Test node status sensor is created and available if node is not ready."""
NODE_STATUS_ENTITY = "sensor.z_wave_module_for_id_lock_150_and_101_node_status... | [
"async",
"def",
"test_node_status_sensor_not_ready",
"(",
"hass",
",",
"client",
",",
"lock_id_lock_as_id150_not_ready",
",",
"lock_id_lock_as_id150_state",
",",
"integration",
",",
")",
":",
"NODE_STATUS_ENTITY",
"=",
"\"sensor.z_wave_module_for_id_lock_150_and_101_node_status\"... | [
194,
0
] | [
225,
63
] | python | en | ['en', 'en', 'en'] | True |
test_reset_meter | (
hass,
client,
aeon_smart_switch_6,
integration,
) | Test reset_meter service. | Test reset_meter service. | async def test_reset_meter(
hass,
client,
aeon_smart_switch_6,
integration,
):
"""Test reset_meter service."""
client.async_send_command.return_value = {}
client.async_send_command_no_wait.return_value = {}
# Test successful meter reset call
await hass.services.async_call(
D... | [
"async",
"def",
"test_reset_meter",
"(",
"hass",
",",
"client",
",",
"aeon_smart_switch_6",
",",
"integration",
",",
")",
":",
"client",
".",
"async_send_command",
".",
"return_value",
"=",
"{",
"}",
"client",
".",
"async_send_command_no_wait",
".",
"return_value"... | [
228,
0
] | [
276,
50
] | python | de | ['de', 'nl', 'en'] | False |
test_meter_attributes | (
hass,
client,
aeon_smart_switch_6,
integration,
) | Test meter entity attributes. | Test meter entity attributes. | async def test_meter_attributes(
hass,
client,
aeon_smart_switch_6,
integration,
):
"""Test meter entity attributes."""
state = hass.states.get(METER_ENERGY_SENSOR)
assert state
assert state.attributes[ATTR_METER_TYPE] == MeterType.ELECTRIC.value
assert state.attributes[ATTR_METER_TY... | [
"async",
"def",
"test_meter_attributes",
"(",
"hass",
",",
"client",
",",
"aeon_smart_switch_6",
",",
"integration",
",",
")",
":",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"METER_ENERGY_SENSOR",
")",
"assert",
"state",
"assert",
"state",
".",
"... | [
279,
0
] | [
291,
77
] | python | en | ['en', 'en', 'en'] | True |
test_special_meters | (hass, aeon_smart_switch_6_state, client, integration) | Test meters that have special handling. | Test meters that have special handling. | async def test_special_meters(hass, aeon_smart_switch_6_state, client, integration):
"""Test meters that have special handling."""
node_data = copy.deepcopy(
aeon_smart_switch_6_state
) # Copy to allow modification in tests.
# Add an ElectricScale.KILOVOLT_AMPERE_HOUR value to the state so we c... | [
"async",
"def",
"test_special_meters",
"(",
"hass",
",",
"aeon_smart_switch_6_state",
",",
"client",
",",
"integration",
")",
":",
"node_data",
"=",
"copy",
".",
"deepcopy",
"(",
"aeon_smart_switch_6_state",
")",
"# Copy to allow modification in tests.",
"# Add an Electri... | [
294,
0
] | [
358,
72
] | python | en | ['en', 'en', 'en'] | True |
test_uptime_sensor_name_change | (hass) | Test uptime sensor with different name. | Test uptime sensor with different name. | async def test_uptime_sensor_name_change(hass):
"""Test uptime sensor with different name."""
config = {"sensor": {"platform": "uptime", "name": "foobar"}}
assert await async_setup_component(hass, "sensor", config)
await hass.async_block_till_done()
assert hass.states.get("sensor.foobar") | [
"async",
"def",
"test_uptime_sensor_name_change",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"\"sensor\"",
":",
"{",
"\"platform\"",
":",
"\"uptime\"",
",",
"\"name\"",
":",
"\"foobar\"",
"}",
"}",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
... | [
5,
0
] | [
10,
43
] | python | en | ['en', 'en', 'en'] | True |
test_user_form | (hass, ezviz_config_flow) | Test the user initiated form. | Test the user initiated form. | async def test_user_form(hass, ezviz_config_flow):
"""Test the user initiated form."""
await async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_FORM
... | [
"async",
"def",
"test_user_form",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"... | [
52,
0
] | [
80,
59
] | python | en | ['en', 'en', 'en'] | True |
test_user_custom_url | (hass, ezviz_config_flow) | Test custom url step. | Test custom url step. | async def test_user_custom_url(hass, ezviz_config_flow):
"""Test custom url step."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
{CONF_USERNAME: "test-us... | [
"async",
"def",
"test_user_custom_url",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
")... | [
83,
0
] | [
112,
48
] | python | en | ['en', 'hi-Latn', 'en'] | True |
test_async_step_import | (hass, ezviz_config_flow) | Test the config import flow. | Test the config import flow. | async def test_async_step_import(hass, ezviz_config_flow):
"""Test the config import flow."""
await async_setup_component(hass, "persistent_notification", {})
with _patch_async_setup_entry() as mock_setup_entry:
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"sourc... | [
"async",
"def",
"test_async_step_import",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"with",
"_patch_async_setup_entry",
"(",
")",
"as",
"mock_setup_entry",
... | [
115,
0
] | [
126,
48
] | python | en | ['en', 'en', 'en'] | True |
test_async_step_import_camera | (hass, ezviz_config_flow) | Test the config import camera flow. | Test the config import camera flow. | async def test_async_step_import_camera(hass, ezviz_config_flow):
"""Test the config import camera flow."""
await async_setup_component(hass, "persistent_notification", {})
with _patch_async_setup_entry() as mock_setup_entry:
result = await hass.config_entries.flow.async_init(
DOMAIN, c... | [
"async",
"def",
"test_async_step_import_camera",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"with",
"_patch_async_setup_entry",
"(",
")",
"as",
"mock_setup_ent... | [
129,
0
] | [
140,
48
] | python | en | ['en', 'en', 'en'] | True |
test_async_step_import_2nd_form_returns_camera | (hass, ezviz_config_flow) | Test we get the user initiated form. | Test we get the user initiated form. | async def test_async_step_import_2nd_form_returns_camera(hass, ezviz_config_flow):
"""Test we get the user initiated form."""
await async_setup_component(hass, "persistent_notification", {})
with _patch_async_setup_entry() as mock_setup_entry:
result = await hass.config_entries.flow.async_init(
... | [
"async",
"def",
"test_async_step_import_2nd_form_returns_camera",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"with",
"_patch_async_setup_entry",
"(",
")",
"as",
... | [
143,
0
] | [
165,
48
] | python | en | ['en', 'en', 'en'] | True |
test_async_step_import_abort | (hass, ezviz_config_flow) | Test the config import flow with invalid data. | Test the config import flow with invalid data. | async def test_async_step_import_abort(hass, ezviz_config_flow):
"""Test the config import flow with invalid data."""
await async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=YAML_INVALID
... | [
"async",
"def",
"test_async_step_import_abort",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flo... | [
168,
0
] | [
176,
40
] | python | en | ['en', 'en', 'en'] | True |
test_step_discovery_abort_if_cloud_account_missing | (hass) | Test discovery and confirm step, abort if cloud account was removed. | Test discovery and confirm step, abort if cloud account was removed. | async def test_step_discovery_abort_if_cloud_account_missing(hass):
"""Test discovery and confirm step, abort if cloud account was removed."""
await async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_DISCO... | [
"async",
"def",
"test_step_discovery_abort_if_cloud_account_missing",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".... | [
179,
0
] | [
200,
60
] | python | en | ['en', 'en', 'en'] | True |
test_async_step_discovery | (
hass, ezviz_config_flow, ezviz_test_rtsp_config_flow
) | Test discovery and confirm step. | Test discovery and confirm step. | async def test_async_step_discovery(
hass, ezviz_config_flow, ezviz_test_rtsp_config_flow
):
"""Test discovery and confirm step."""
with patch("homeassistant.components.ezviz.PLATFORMS", []):
await init_integration(hass)
await async_setup_component(hass, "persistent_notification", {})
resul... | [
"async",
"def",
"test_async_step_discovery",
"(",
"hass",
",",
"ezviz_config_flow",
",",
"ezviz_test_rtsp_config_flow",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.ezviz.PLATFORMS\"",
",",
"[",
"]",
")",
":",
"await",
"init_integration",
"(",
"hass",
"... | [
203,
0
] | [
235,
48
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow | (hass) | Test updating options. | Test updating options. | async def test_options_flow(hass):
"""Test updating options."""
with _patch_async_setup_entry() as mock_setup_entry:
entry = await init_integration(hass)
assert entry.options[CONF_FFMPEG_ARGUMENTS] == DEFAULT_FFMPEG_ARGUMENTS
assert entry.options[CONF_TIMEOUT] == DEFAULT_TIMEOUT
... | [
"async",
"def",
"test_options_flow",
"(",
"hass",
")",
":",
"with",
"_patch_async_setup_entry",
"(",
")",
"as",
"mock_setup_entry",
":",
"entry",
"=",
"await",
"init_integration",
"(",
"hass",
")",
"assert",
"entry",
".",
"options",
"[",
"CONF_FFMPEG_ARGUMENTS",
... | [
238,
0
] | [
261,
48
] | python | en | ['en', 'en', 'en'] | True |
test_user_form_exception | (hass, ezviz_config_flow) | Test we handle exception on user form. | Test we handle exception on user form. | async def test_user_form_exception(hass, ezviz_config_flow):
"""Test we handle exception on user form."""
ezviz_config_flow.side_effect = PyEzvizError
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
result = await hass.config_entries.flow.async... | [
"async",
"def",
"test_user_form_exception",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"ezviz_config_flow",
".",
"side_effect",
"=",
"PyEzvizError",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
... | [
264,
0
] | [
311,
40
] | python | en | ['en', 'en', 'en'] | True |
test_import_exception | (hass, ezviz_config_flow) | Test we handle unexpected exception on import. | Test we handle unexpected exception on import. | async def test_import_exception(hass, ezviz_config_flow):
"""Test we handle unexpected exception on import."""
ezviz_config_flow.side_effect = PyEzvizError
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=YAML_CONFIG
)
assert result["type"... | [
"async",
"def",
"test_import_exception",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"ezviz_config_flow",
".",
"side_effect",
"=",
"PyEzvizError",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"co... | [
314,
0
] | [
350,
40
] | python | en | ['en', 'en', 'en'] | True |
test_discover_exception_step1 | (
hass,
ezviz_config_flow,
) | Test we handle unexpected exception on discovery. | Test we handle unexpected exception on discovery. | async def test_discover_exception_step1(
hass,
ezviz_config_flow,
):
"""Test we handle unexpected exception on discovery."""
with patch("homeassistant.components.ezviz.PLATFORMS", []):
await init_integration(hass)
await async_setup_component(hass, "persistent_notification", {})
result ... | [
"async",
"def",
"test_discover_exception_step1",
"(",
"hass",
",",
"ezviz_config_flow",
",",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.ezviz.PLATFORMS\"",
",",
"[",
"]",
")",
":",
"await",
"init_integration",
"(",
"hass",
")",
"await",
"async_setup... | [
353,
0
] | [
426,
40
] | python | en | ['en', 'en', 'en'] | True |
test_discover_exception_step3 | (
hass,
ezviz_config_flow,
ezviz_test_rtsp_config_flow,
) | Test we handle unexpected exception on discovery. | Test we handle unexpected exception on discovery. | async def test_discover_exception_step3(
hass,
ezviz_config_flow,
ezviz_test_rtsp_config_flow,
):
"""Test we handle unexpected exception on discovery."""
with patch("homeassistant.components.ezviz.PLATFORMS", []):
await init_integration(hass)
await async_setup_component(hass, "persistent... | [
"async",
"def",
"test_discover_exception_step3",
"(",
"hass",
",",
"ezviz_config_flow",
",",
"ezviz_test_rtsp_config_flow",
",",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.ezviz.PLATFORMS\"",
",",
"[",
"]",
")",
":",
"await",
"init_integration",
"(",
... | [
429,
0
] | [
488,
40
] | python | en | ['en', 'en', 'en'] | True |
test_user_custom_url_exception | (hass, ezviz_config_flow) | Test we handle unexpected exception. | Test we handle unexpected exception. | async def test_user_custom_url_exception(hass, ezviz_config_flow):
"""Test we handle unexpected exception."""
ezviz_config_flow.side_effect = PyEzvizError()
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
result = await hass.config_entries.flow.... | [
"async",
"def",
"test_user_custom_url_exception",
"(",
"hass",
",",
"ezviz_config_flow",
")",
":",
"ezviz_config_flow",
".",
"side_effect",
"=",
"PyEzvizError",
"(",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
... | [
491,
0
] | [
550,
40
] | python | en | ['de', 'en', 'en'] | True |
registry | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def registry(hass):
"""Return an empty, loaded, registry."""
return mock_registry(hass) | [
"def",
"registry",
"(",
"hass",
")",
":",
"return",
"mock_registry",
"(",
"hass",
")"
] | [
22,
0
] | [
24,
30
] | python | en | ['en', 'fy', 'en'] | True |
update_events | (hass) | Capture update events. | Capture update events. | def update_events(hass):
"""Capture update events."""
events = []
@callback
def async_capture(event):
events.append(event.data)
hass.bus.async_listen(er.EVENT_ENTITY_REGISTRY_UPDATED, async_capture)
return events | [
"def",
"update_events",
"(",
"hass",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"async_capture",
"(",
"event",
")",
":",
"events",
".",
"append",
"(",
"event",
".",
"data",
")",
"hass",
".",
"bus",
".",
"async_listen",
"(",
"er",
".",... | [
28,
0
] | [
38,
17
] | python | en | ['es', 'nl', 'en'] | False |
test_get_or_create_returns_same_entry | (hass, registry, update_events) | Make sure we do not duplicate entries. | Make sure we do not duplicate entries. | async def test_get_or_create_returns_same_entry(hass, registry, update_events):
"""Make sure we do not duplicate entries."""
entry = registry.async_get_or_create("light", "hue", "1234")
entry2 = registry.async_get_or_create("light", "hue", "1234")
await hass.async_block_till_done()
assert len(regi... | [
"async",
"def",
"test_get_or_create_returns_same_entry",
"(",
"hass",
",",
"registry",
",",
"update_events",
")",
":",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"1234\"",
")",
"entry2",
"=",
"registry",
".",
"... | [
41,
0
] | [
53,
59
] | python | en | ['en', 'en', 'en'] | True |
test_get_or_create_suggested_object_id | (registry) | Test that suggested_object_id works. | Test that suggested_object_id works. | def test_get_or_create_suggested_object_id(registry):
"""Test that suggested_object_id works."""
entry = registry.async_get_or_create(
"light", "hue", "1234", suggested_object_id="beer"
)
assert entry.entity_id == "light.beer" | [
"def",
"test_get_or_create_suggested_object_id",
"(",
"registry",
")",
":",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"1234\"",
",",
"suggested_object_id",
"=",
"\"beer\"",
")",
"assert",
"entry",
".",
"entity_id"... | [
56,
0
] | [
62,
42
] | python | en | ['en', 'en', 'en'] | True |
test_get_or_create_updates_data | (registry) | Test that we update data in get_or_create. | Test that we update data in get_or_create. | def test_get_or_create_updates_data(registry):
"""Test that we update data in get_or_create."""
orig_config_entry = MockConfigEntry(domain="light")
orig_entry = registry.async_get_or_create(
"light",
"hue",
"5678",
config_entry=orig_config_entry,
device_id="mock-dev-... | [
"def",
"test_get_or_create_updates_data",
"(",
"registry",
")",
":",
"orig_config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
")",
"orig_entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"5678\"",
",",... | [
65,
0
] | [
120,
52
] | python | en | ['en', 'en', 'en'] | True |
test_get_or_create_suggested_object_id_conflict_register | (registry) | Test that we don't generate an entity id that is already registered. | Test that we don't generate an entity id that is already registered. | def test_get_or_create_suggested_object_id_conflict_register(registry):
"""Test that we don't generate an entity id that is already registered."""
entry = registry.async_get_or_create(
"light", "hue", "1234", suggested_object_id="beer"
)
entry2 = registry.async_get_or_create(
"light", "h... | [
"def",
"test_get_or_create_suggested_object_id_conflict_register",
"(",
"registry",
")",
":",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"1234\"",
",",
"suggested_object_id",
"=",
"\"beer\"",
")",
"entry2",
"=",
"reg... | [
123,
0
] | [
133,
45
] | python | en | ['en', 'en', 'en'] | True |
test_get_or_create_suggested_object_id_conflict_existing | (hass, registry) | Test that we don't generate an entity id that currently exists. | Test that we don't generate an entity id that currently exists. | def test_get_or_create_suggested_object_id_conflict_existing(hass, registry):
"""Test that we don't generate an entity id that currently exists."""
hass.states.async_set("light.hue_1234", "on")
entry = registry.async_get_or_create("light", "hue", "1234")
assert entry.entity_id == "light.hue_1234_2" | [
"def",
"test_get_or_create_suggested_object_id_conflict_existing",
"(",
"hass",
",",
"registry",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.hue_1234\"",
",",
"\"on\"",
")",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
... | [
136,
0
] | [
140,
48
] | python | en | ['en', 'en', 'en'] | True |
test_create_triggers_save | (hass, registry) | Test that registering entry triggers a save. | Test that registering entry triggers a save. | def test_create_triggers_save(hass, registry):
"""Test that registering entry triggers a save."""
with patch.object(registry, "async_schedule_save") as mock_schedule_save:
registry.async_get_or_create("light", "hue", "1234")
assert len(mock_schedule_save.mock_calls) == 1 | [
"def",
"test_create_triggers_save",
"(",
"hass",
",",
"registry",
")",
":",
"with",
"patch",
".",
"object",
"(",
"registry",
",",
"\"async_schedule_save\"",
")",
"as",
"mock_schedule_save",
":",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue... | [
143,
0
] | [
148,
50
] | python | en | ['en', 'en', 'en'] | True |
test_loading_saving_data | (hass, registry) | Test that we load/save data correctly. | Test that we load/save data correctly. | async def test_loading_saving_data(hass, registry):
"""Test that we load/save data correctly."""
mock_config = MockConfigEntry(domain="light")
orig_entry1 = registry.async_get_or_create("light", "hue", "1234")
orig_entry2 = registry.async_get_or_create(
"light",
"hue",
"5678",
... | [
"async",
"def",
"test_loading_saving_data",
"(",
"hass",
",",
"registry",
")",
":",
"mock_config",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
")",
"orig_entry1",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\... | [
151,
0
] | [
198,
59
] | python | en | ['en', 'en', 'en'] | True |
test_generate_entity_considers_registered_entities | (registry) | Test that we don't create entity id that are already registered. | Test that we don't create entity id that are already registered. | def test_generate_entity_considers_registered_entities(registry):
"""Test that we don't create entity id that are already registered."""
entry = registry.async_get_or_create("light", "hue", "1234")
assert entry.entity_id == "light.hue_1234"
assert registry.async_generate_entity_id("light", "hue_1234") =... | [
"def",
"test_generate_entity_considers_registered_entities",
"(",
"registry",
")",
":",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"1234\"",
")",
"assert",
"entry",
".",
"entity_id",
"==",
"\"light.hue_1234\"",
"asse... | [
201,
0
] | [
205,
87
] | python | en | ['en', 'en', 'en'] | True |
test_generate_entity_considers_existing_entities | (hass, registry) | Test that we don't create entity id that currently exists. | Test that we don't create entity id that currently exists. | def test_generate_entity_considers_existing_entities(hass, registry):
"""Test that we don't create entity id that currently exists."""
hass.states.async_set("light.kitchen", "on")
assert registry.async_generate_entity_id("light", "kitchen") == "light.kitchen_2" | [
"def",
"test_generate_entity_considers_existing_entities",
"(",
"hass",
",",
"registry",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.kitchen\"",
",",
"\"on\"",
")",
"assert",
"registry",
".",
"async_generate_entity_id",
"(",
"\"light\"",
",",
"\... | [
208,
0
] | [
211,
85
] | python | en | ['en', 'en', 'en'] | True |
test_is_registered | (registry) | Test that is_registered works. | Test that is_registered works. | def test_is_registered(registry):
"""Test that is_registered works."""
entry = registry.async_get_or_create("light", "hue", "1234")
assert registry.async_is_registered(entry.entity_id)
assert not registry.async_is_registered("light.non_existing") | [
"def",
"test_is_registered",
"(",
"registry",
")",
":",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"1234\"",
")",
"assert",
"registry",
".",
"async_is_registered",
"(",
"entry",
".",
"entity_id",
")",
"assert",... | [
214,
0
] | [
218,
65
] | python | en | ['en', 'en', 'en'] | True |
test_loading_extra_values | (hass, hass_storage) | Test we load extra data from the registry. | Test we load extra data from the registry. | async def test_loading_extra_values(hass, hass_storage):
"""Test we load extra data from the registry."""
hass_storage[er.STORAGE_KEY] = {
"version": er.STORAGE_VERSION,
"data": {
"entities": [
{
"entity_id": "test.named",
"plat... | [
"async",
"def",
"test_loading_extra_values",
"(",
"hass",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"er",
".",
"STORAGE_KEY",
"]",
"=",
"{",
"\"version\"",
":",
"er",
".",
"STORAGE_VERSION",
",",
"\"data\"",
":",
"{",
"\"entities\"",
":",
"[",
"{",... | [
222,
0
] | [
285,
62
] | python | en | ['en', 'en', 'en'] | True |
test_async_get_entity_id | (registry) | Test that entity_id is returned. | Test that entity_id is returned. | def test_async_get_entity_id(registry):
"""Test that entity_id is returned."""
entry = registry.async_get_or_create("light", "hue", "1234")
assert entry.entity_id == "light.hue_1234"
assert registry.async_get_entity_id("light", "hue", "1234") == "light.hue_1234"
assert registry.async_get_entity_id("... | [
"def",
"test_async_get_entity_id",
"(",
"registry",
")",
":",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"1234\"",
")",
"assert",
"entry",
".",
"entity_id",
"==",
"\"light.hue_1234\"",
"assert",
"registry",
".",
... | [
288,
0
] | [
293,
70
] | python | en | ['en', 'en', 'en'] | True |
test_updating_config_entry_id | (hass, registry, update_events) | Test that we update config entry id in registry. | Test that we update config entry id in registry. | async def test_updating_config_entry_id(hass, registry, update_events):
"""Test that we update config entry id in registry."""
mock_config_1 = MockConfigEntry(domain="light", entry_id="mock-id-1")
entry = registry.async_get_or_create(
"light", "hue", "5678", config_entry=mock_config_1
)
moc... | [
"async",
"def",
"test_updating_config_entry_id",
"(",
"hass",
",",
"registry",
",",
"update_events",
")",
":",
"mock_config_1",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
",",
"entry_id",
"=",
"\"mock-id-1\"",
")",
"entry",
"=",
"registry",
".",
"a... | [
296,
0
] | [
317,
74
] | python | en | ['en', 'en', 'en'] | True |
test_removing_config_entry_id | (hass, registry, update_events) | Test that we update config entry id in registry. | Test that we update config entry id in registry. | async def test_removing_config_entry_id(hass, registry, update_events):
"""Test that we update config entry id in registry."""
mock_config = MockConfigEntry(domain="light", entry_id="mock-id-1")
entry = registry.async_get_or_create(
"light", "hue", "5678", config_entry=mock_config
)
assert ... | [
"async",
"def",
"test_removing_config_entry_id",
"(",
"hass",
",",
"registry",
",",
"update_events",
")",
":",
"mock_config",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
",",
"entry_id",
"=",
"\"mock-id-1\"",
")",
"entry",
"=",
"registry",
".",
"asy... | [
320,
0
] | [
338,
59
] | python | en | ['en', 'en', 'en'] | True |
test_removing_area_id | (registry) | Make sure we can clear area id. | Make sure we can clear area id. | async def test_removing_area_id(registry):
"""Make sure we can clear area id."""
entry = registry.async_get_or_create("light", "hue", "5678")
entry_w_area = registry.async_update_entity(entry.entity_id, area_id="12345A")
registry.async_clear_area_id("12345A")
entry_wo_area = registry.async_get(ent... | [
"async",
"def",
"test_removing_area_id",
"(",
"registry",
")",
":",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"5678\"",
")",
"entry_w_area",
"=",
"registry",
".",
"async_update_entity",
"(",
"entry",
".",
"ent... | [
341,
0
] | [
351,
40
] | python | en | ['en', 'en', 'en'] | True |
test_migration | (hass) | Test migration from old data to new. | Test migration from old data to new. | async def test_migration(hass):
"""Test migration from old data to new."""
mock_config = MockConfigEntry(domain="test-platform", entry_id="test-config-id")
old_conf = {
"light.kitchen": {
"config_entry_id": "test-config-id",
"unique_id": "test-unique",
"platform"... | [
"async",
"def",
"test_migration",
"(",
"hass",
")",
":",
"mock_config",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"test-platform\"",
",",
"entry_id",
"=",
"\"test-config-id\"",
")",
"old_conf",
"=",
"{",
"\"light.kitchen\"",
":",
"{",
"\"config_entry_id\"",
":... | [
355,
0
] | [
383,
52
] | python | en | ['en', 'en', 'en'] | True |
test_loading_invalid_entity_id | (hass, hass_storage) | Test we autofix invalid entity IDs. | Test we autofix invalid entity IDs. | async def test_loading_invalid_entity_id(hass, hass_storage):
"""Test we autofix invalid entity IDs."""
hass_storage[er.STORAGE_KEY] = {
"version": er.STORAGE_VERSION,
"data": {
"entities": [
{
"entity_id": "test.invalid__middle",
... | [
"async",
"def",
"test_loading_invalid_entity_id",
"(",
"hass",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"er",
".",
"STORAGE_KEY",
"]",
"=",
"{",
"\"version\"",
":",
"er",
".",
"STORAGE_VERSION",
",",
"\"data\"",
":",
"{",
"\"entities\"",
":",
"[",
... | [
386,
0
] | [
430,
58
] | python | en | ['en', 'fr', 'en'] | True |
test_update_entity_unique_id | (registry) | Test entity's unique_id is updated. | Test entity's unique_id is updated. | async def test_update_entity_unique_id(registry):
"""Test entity's unique_id is updated."""
mock_config = MockConfigEntry(domain="light", entry_id="mock-id-1")
entry = registry.async_get_or_create(
"light", "hue", "5678", config_entry=mock_config
)
assert registry.async_get_entity_id("light... | [
"async",
"def",
"test_update_entity_unique_id",
"(",
"registry",
")",
":",
"mock_config",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
",",
"entry_id",
"=",
"\"mock-id-1\"",
")",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
"... | [
433,
0
] | [
452,
82
] | python | en | ['en', 'en', 'en'] | True |
test_update_entity_unique_id_conflict | (registry) | Test migration raises when unique_id already in use. | Test migration raises when unique_id already in use. | async def test_update_entity_unique_id_conflict(registry):
"""Test migration raises when unique_id already in use."""
mock_config = MockConfigEntry(domain="light", entry_id="mock-id-1")
entry = registry.async_get_or_create(
"light", "hue", "5678", config_entry=mock_config
)
entry2 = registry... | [
"async",
"def",
"test_update_entity_unique_id_conflict",
"(",
"registry",
")",
":",
"mock_config",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
",",
"entry_id",
"=",
"\"mock-id-1\"",
")",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"ligh... | [
455,
0
] | [
470,
83
] | python | en | ['en', 'en', 'en'] | True |
test_update_entity | (registry) | Test updating entity. | Test updating entity. | async def test_update_entity(registry):
"""Test updating entity."""
mock_config = MockConfigEntry(domain="light", entry_id="mock-id-1")
entry = registry.async_get_or_create(
"light", "hue", "5678", config_entry=mock_config
)
for attr_name, new_value in (
("name", "new name"),
... | [
"async",
"def",
"test_update_entity",
"(",
"registry",
")",
":",
"mock_config",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
",",
"entry_id",
"=",
"\"mock-id-1\"",
")",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"h... | [
473,
0
] | [
496,
29
] | python | en | ['en', 'en', 'en'] | True |
test_disabled_by | (registry) | Test that we can disable an entry when we create it. | Test that we can disable an entry when we create it. | async def test_disabled_by(registry):
"""Test that we can disable an entry when we create it."""
entry = registry.async_get_or_create(
"light", "hue", "5678", disabled_by=er.DISABLED_HASS
)
assert entry.disabled_by == er.DISABLED_HASS
entry = registry.async_get_or_create(
"light", "... | [
"async",
"def",
"test_disabled_by",
"(",
"registry",
")",
":",
"entry",
"=",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
",",
"\"5678\"",
",",
"disabled_by",
"=",
"er",
".",
"DISABLED_HASS",
")",
"assert",
"entry",
".",
"disabled_... | [
499,
0
] | [
512,
37
] | python | en | ['en', 'en', 'en'] | True |
test_disabled_by_config_entry_pref | (registry) | Test config entry preference setting disabled_by. | Test config entry preference setting disabled_by. | async def test_disabled_by_config_entry_pref(registry):
"""Test config entry preference setting disabled_by."""
mock_config = MockConfigEntry(
domain="light",
entry_id="mock-id-1",
pref_disable_new_entities=True,
)
entry = registry.async_get_or_create(
"light", "hue", "AA... | [
"async",
"def",
"test_disabled_by_config_entry_pref",
"(",
"registry",
")",
":",
"mock_config",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
",",
"entry_id",
"=",
"\"mock-id-1\"",
",",
"pref_disable_new_entities",
"=",
"True",
",",
")",
"entry",
"=",
"... | [
515,
0
] | [
534,
49
] | python | en | ['tl', 'en', 'en'] | True |
test_restore_states | (hass) | Test restoring states. | Test restoring states. | async def test_restore_states(hass):
"""Test restoring states."""
hass.state = CoreState.not_running
registry = er.async_get(hass)
registry.async_get_or_create(
"light",
"hue",
"1234",
suggested_object_id="simple",
)
# Should not be created
registry.async_ge... | [
"async",
"def",
"test_restore_states",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"not_running",
"registry",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"registry",
".",
"async_get_or_create",
"(",
"\"light\"",
",",
"\"hue\"",
","... | [
537,
0
] | [
600,
56
] | python | en | ['en', 'jv', 'en'] | True |
test_async_get_device_class_lookup | (hass) | Test registry device class lookup. | Test registry device class lookup. | async def test_async_get_device_class_lookup(hass):
"""Test registry device class lookup."""
hass.state = CoreState.not_running
ent_reg = er.async_get(hass)
ent_reg.async_get_or_create(
"binary_sensor",
"light",
"battery_charging",
device_id="light_device_entry_id",
... | [
"async",
"def",
"test_async_get_device_class_lookup",
"(",
"hass",
")",
":",
"hass",
".",
"state",
"=",
"CoreState",
".",
"not_running",
"ent_reg",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"ent_reg",
".",
"async_get_or_create",
"(",
"\"binary_sensor\"",
",... | [
603,
0
] | [
679,
5
] | python | en | ['en', 'fy', 'en'] | True |
test_remove_device_removes_entities | (hass, registry) | Test that we remove entities tied to a device. | Test that we remove entities tied to a device. | async def test_remove_device_removes_entities(hass, registry):
"""Test that we remove entities tied to a device."""
device_registry = mock_device_registry(hass)
config_entry = MockConfigEntry(domain="light")
device_entry = device_registry.async_get_or_create(
config_entry_id=config_entry.entry_... | [
"async",
"def",
"test_remove_device_removes_entities",
"(",
"hass",
",",
"registry",
")",
":",
"device_registry",
"=",
"mock_device_registry",
"(",
"hass",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
")",
"device_entry",
"=",
"devic... | [
682,
0
] | [
705,
60
] | python | en | ['en', 'en', 'en'] | True |
test_update_device_race | (hass, registry) | Test race when a device is created, updated and removed. | Test race when a device is created, updated and removed. | async def test_update_device_race(hass, registry):
"""Test race when a device is created, updated and removed."""
device_registry = mock_device_registry(hass)
config_entry = MockConfigEntry(domain="light")
# Create device
device_entry = device_registry.async_get_or_create(
config_entry_id=c... | [
"async",
"def",
"test_update_device_race",
"(",
"hass",
",",
"registry",
")",
":",
"device_registry",
"=",
"mock_device_registry",
"(",
"hass",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
")",
"# Create device",
"device_entry",
"=",... | [
708,
0
] | [
738,
60
] | python | en | ['en', 'en', 'en'] | True |
test_disable_device_disables_entities | (hass, registry) | Test that we disable entities tied to a device. | Test that we disable entities tied to a device. | async def test_disable_device_disables_entities(hass, registry):
"""Test that we disable entities tied to a device."""
device_registry = mock_device_registry(hass)
config_entry = MockConfigEntry(domain="light")
config_entry.add_to_hass(hass)
device_entry = device_registry.async_get_or_create(
... | [
"async",
"def",
"test_disable_device_disables_entities",
"(",
"hass",
",",
"registry",
")",
":",
"device_registry",
"=",
"mock_device_registry",
"(",
"hass",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
")",
"config_entry",
".",
"add... | [
741,
0
] | [
803,
57
] | python | en | ['en', 'en', 'en'] | True |
test_disable_config_entry_disables_entities | (hass, registry) | Test that we disable entities tied to a config entry. | Test that we disable entities tied to a config entry. | async def test_disable_config_entry_disables_entities(hass, registry):
"""Test that we disable entities tied to a config entry."""
device_registry = mock_device_registry(hass)
config_entry = MockConfigEntry(domain="light")
config_entry.add_to_hass(hass)
device_entry = device_registry.async_get_or_c... | [
"async",
"def",
"test_disable_config_entry_disables_entities",
"(",
"hass",
",",
"registry",
")",
":",
"device_registry",
"=",
"mock_device_registry",
"(",
"hass",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
")",
"config_entry",
".",
... | [
806,
0
] | [
870,
33
] | python | en | ['en', 'en', 'en'] | True |
test_disabled_entities_excluded_from_entity_list | (hass, registry) | Test that disabled entities are excluded from async_entries_for_device. | Test that disabled entities are excluded from async_entries_for_device. | async def test_disabled_entities_excluded_from_entity_list(hass, registry):
"""Test that disabled entities are excluded from async_entries_for_device."""
device_registry = mock_device_registry(hass)
config_entry = MockConfigEntry(domain="light")
device_entry = device_registry.async_get_or_create(
... | [
"async",
"def",
"test_disabled_entities_excluded_from_entity_list",
"(",
"hass",
",",
"registry",
")",
":",
"device_registry",
"=",
"mock_device_registry",
"(",
"hass",
")",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"light\"",
")",
"device_entry",
... | [
873,
0
] | [
906,
38
] | python | en | ['en', 'en', 'en'] | True |
test_entity_max_length_exceeded | (hass, registry) | Test that an exception is raised when the max character length is exceeded. | Test that an exception is raised when the max character length is exceeded. | async def test_entity_max_length_exceeded(hass, registry):
"""Test that an exception is raised when the max character length is exceeded."""
long_entity_id_name = (
"1234567890123456789012345678901234567890123456789012345678901234567890"
"12345678901234567890123456789012345678901234567890123456... | [
"async",
"def",
"test_entity_max_length_exceeded",
"(",
"hass",
",",
"registry",
")",
":",
"long_entity_id_name",
"=",
"(",
"\"1234567890123456789012345678901234567890123456789012345678901234567890\"",
"\"1234567890123456789012345678901234567890123456789012345678901234567890\"",
"\"12345... | [
909,
0
] | [
950,
68
] | python | en | ['en', 'en', 'en'] | True |
test_climate_zones | (hass) | Test creation climate zones. | Test creation climate zones. | async def test_climate_zones(hass):
"""Test creation climate zones."""
await async_init_integration(hass)
state = hass.states.get("climate.nick_office")
assert state.state == HVAC_MODE_HEAT_COOL
expected_attributes = {
"attribution": "Data provided by mynexia.com",
"current_humidit... | [
"async",
"def",
"test_climate_zones",
"(",
"hass",
")",
":",
"await",
"async_init_integration",
"(",
"hass",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"climate.nick_office\"",
")",
"assert",
"state",
".",
"state",
"==",
"HVAC_MODE_HEAT_COOL",
... | [
7,
0
] | [
80,
5
] | python | en | ['pl', 'en', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up EcoNet thermostat based on a config entry. | Set up EcoNet thermostat based on a config entry. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up EcoNet thermostat based on a config entry."""
equipment = hass.data[DOMAIN][EQUIPMENT][entry.entry_id]
async_add_entities(
[
EcoNetThermostat(thermostat)
for thermostat in equipment[EquipmentType.THERMOST... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"equipment",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"EQUIPMENT",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"async_add_entities",
"(",
"[",
"EcoN... | [
57,
0
] | [
65,
5
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.__init__ | (self, thermostat) | Initialize. | Initialize. | def __init__(self, thermostat):
"""Initialize."""
super().__init__(thermostat)
self._running = thermostat.running
self._poll = True
self.econet_state_to_ha = {}
self.ha_state_to_econet = {}
self.op_list = []
for mode in self._econet.modes:
if m... | [
"def",
"__init__",
"(",
"self",
",",
"thermostat",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"thermostat",
")",
"self",
".",
"_running",
"=",
"thermostat",
".",
"running",
"self",
".",
"_poll",
"=",
"True",
"self",
".",
"econet_state_to_ha",
"="... | [
71,
4
] | [
85,
44
] | python | en | ['en', 'en', 'it'] | False |
EcoNetThermostat.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
if self._econet.supports_humidifier:
return SUPPORT_FLAGS_THERMOSTAT | SUPPORT_TARGET_HUMIDITY
return SUPPORT_FLAGS_THERMOSTAT | [
"def",
"supported_features",
"(",
"self",
")",
":",
"if",
"self",
".",
"_econet",
".",
"supports_humidifier",
":",
"return",
"SUPPORT_FLAGS_THERMOSTAT",
"|",
"SUPPORT_TARGET_HUMIDITY",
"return",
"SUPPORT_FLAGS_THERMOSTAT"
] | [
88,
4
] | [
92,
39
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self._econet.set_point | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"_econet",
".",
"set_point"
] | [
95,
4
] | [
97,
37
] | python | en | ['en', 'la', 'en'] | True |
EcoNetThermostat.current_humidity | (self) | Return the current humidity. | Return the current humidity. | def current_humidity(self):
"""Return the current humidity."""
return self._econet.humidity | [
"def",
"current_humidity",
"(",
"self",
")",
":",
"return",
"self",
".",
"_econet",
".",
"humidity"
] | [
100,
4
] | [
102,
36
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.target_humidity | (self) | Return the humidity we try to reach. | Return the humidity we try to reach. | def target_humidity(self):
"""Return the humidity we try to reach."""
if self._econet.supports_humidifier:
return self._econet.dehumidifier_set_point
return None | [
"def",
"target_humidity",
"(",
"self",
")",
":",
"if",
"self",
".",
"_econet",
".",
"supports_humidifier",
":",
"return",
"self",
".",
"_econet",
".",
"dehumidifier_set_point",
"return",
"None"
] | [
105,
4
] | [
109,
19
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self):
"""Return the temperature we try to reach."""
if self.hvac_mode == HVAC_MODE_COOL:
return self._econet.cool_set_point
if self.hvac_mode == HVAC_MODE_HEAT:
return self._econet.heat_set_point
return None | [
"def",
"target_temperature",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_COOL",
":",
"return",
"self",
".",
"_econet",
".",
"cool_set_point",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT",
":",
"return",
"self",
".",
"_ec... | [
112,
4
] | [
118,
19
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.target_temperature_low | (self) | Return the lower bound temperature we try to reach. | Return the lower bound temperature we try to reach. | def target_temperature_low(self):
"""Return the lower bound temperature we try to reach."""
if self.hvac_mode == HVAC_MODE_HEAT_COOL:
return self._econet.heat_set_point
return None | [
"def",
"target_temperature_low",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT_COOL",
":",
"return",
"self",
".",
"_econet",
".",
"heat_set_point",
"return",
"None"
] | [
121,
4
] | [
125,
19
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.target_temperature_high | (self) | Return the higher bound temperature we try to reach. | Return the higher bound temperature we try to reach. | def target_temperature_high(self):
"""Return the higher bound temperature we try to reach."""
if self.hvac_mode == HVAC_MODE_HEAT_COOL:
return self._econet.cool_set_point
return None | [
"def",
"target_temperature_high",
"(",
"self",
")",
":",
"if",
"self",
".",
"hvac_mode",
"==",
"HVAC_MODE_HEAT_COOL",
":",
"return",
"self",
".",
"_econet",
".",
"cool_set_point",
"return",
"None"
] | [
128,
4
] | [
132,
19
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | def set_temperature(self, **kwargs):
"""Set new target temperature."""
target_temp = kwargs.get(ATTR_TEMPERATURE)
target_temp_low = kwargs.get(ATTR_TARGET_TEMP_LOW)
target_temp_high = kwargs.get(ATTR_TARGET_TEMP_HIGH)
if target_temp:
self._econet.set_set_point(target_... | [
"def",
"set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"target_temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"target_temp_low",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET_TEMP_LOW",
")",
"target_temp_high",
"=",
"kwargs",... | [
134,
4
] | [
142,
79
] | python | en | ['en', 'ca', 'en'] | True |
EcoNetThermostat.is_aux_heat | (self) | Return true if aux heater. | Return true if aux heater. | def is_aux_heat(self):
"""Return true if aux heater."""
return self._econet.mode == ThermostatOperationMode.EMERGENCY_HEAT | [
"def",
"is_aux_heat",
"(",
"self",
")",
":",
"return",
"self",
".",
"_econet",
".",
"mode",
"==",
"ThermostatOperationMode",
".",
"EMERGENCY_HEAT"
] | [
145,
4
] | [
147,
74
] | python | fr | ['fr', 'co', 'fr'] | True |
EcoNetThermostat.hvac_modes | (self) | Return hvac operation ie. heat, cool mode.
Needs to be one of HVAC_MODE_*.
| Return hvac operation ie. heat, cool mode. | def hvac_modes(self):
"""Return hvac operation ie. heat, cool mode.
Needs to be one of HVAC_MODE_*.
"""
return self.op_list | [
"def",
"hvac_modes",
"(",
"self",
")",
":",
"return",
"self",
".",
"op_list"
] | [
150,
4
] | [
155,
27
] | python | bg | ['en', 'bg', 'bg'] | True |
EcoNetThermostat.hvac_mode | (self) | Return hvac operation ie. heat, cool, mode.
Needs to be one of HVAC_MODE_*.
| Return hvac operation ie. heat, cool, mode. | def hvac_mode(self) -> str:
"""Return hvac operation ie. heat, cool, mode.
Needs to be one of HVAC_MODE_*.
"""
econet_mode = self._econet.mode
_current_op = HVAC_MODE_OFF
if econet_mode is not None:
_current_op = ECONET_STATE_TO_HA[econet_mode]
retur... | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"econet_mode",
"=",
"self",
".",
"_econet",
".",
"mode",
"_current_op",
"=",
"HVAC_MODE_OFF",
"if",
"econet_mode",
"is",
"not",
"None",
":",
"_current_op",
"=",
"ECONET_STATE_TO_HA",
"[",
"econet_mode",
... | [
158,
4
] | [
168,
26
] | python | bg | ['en', 'bg', 'bg'] | True |
EcoNetThermostat.set_hvac_mode | (self, hvac_mode) | Set new target hvac mode. | Set new target hvac mode. | def set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
hvac_mode_to_set = HA_STATE_TO_ECONET.get(hvac_mode)
if hvac_mode_to_set is None:
raise ValueError(f"{hvac_mode} is not a valid mode.")
self._econet.set_mode(hvac_mode_to_set) | [
"def",
"set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
")",
":",
"hvac_mode_to_set",
"=",
"HA_STATE_TO_ECONET",
".",
"get",
"(",
"hvac_mode",
")",
"if",
"hvac_mode_to_set",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"f\"{hvac_mode} is not a valid mode.\"",
")",
... | [
170,
4
] | [
175,
47
] | python | da | ['da', 'su', 'en'] | False |
EcoNetThermostat.set_humidity | (self, humidity: int) | Set new target humidity. | Set new target humidity. | def set_humidity(self, humidity: int):
"""Set new target humidity."""
self._econet.set_dehumidifier_set_point(humidity) | [
"def",
"set_humidity",
"(",
"self",
",",
"humidity",
":",
"int",
")",
":",
"self",
".",
"_econet",
".",
"set_dehumidifier_set_point",
"(",
"humidity",
")"
] | [
177,
4
] | [
179,
57
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.fan_mode | (self) | Return the current fan mode. | Return the current fan mode. | def fan_mode(self):
"""Return the current fan mode."""
econet_fan_mode = self._econet.fan_mode
# Remove this after we figure out how to handle med lo and med hi
if econet_fan_mode in [ThermostatFanMode.MEDHI, ThermostatFanMode.MEDLO]:
econet_fan_mode = ThermostatFanMode.MEDI... | [
"def",
"fan_mode",
"(",
"self",
")",
":",
"econet_fan_mode",
"=",
"self",
".",
"_econet",
".",
"fan_mode",
"# Remove this after we figure out how to handle med lo and med hi",
"if",
"econet_fan_mode",
"in",
"[",
"ThermostatFanMode",
".",
"MEDHI",
",",
"ThermostatFanMode",... | [
182,
4
] | [
193,
32
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.fan_modes | (self) | Return the fan modes. | Return the fan modes. | def fan_modes(self):
"""Return the fan modes."""
econet_fan_modes = self._econet.fan_modes
fan_list = []
for mode in econet_fan_modes:
# Remove the MEDLO MEDHI once we figure out how to handle it
if mode not in [
ThermostatFanMode.UNKNOWN,
... | [
"def",
"fan_modes",
"(",
"self",
")",
":",
"econet_fan_modes",
"=",
"self",
".",
"_econet",
".",
"fan_modes",
"fan_list",
"=",
"[",
"]",
"for",
"mode",
"in",
"econet_fan_modes",
":",
"# Remove the MEDLO MEDHI once we figure out how to handle it",
"if",
"mode",
"not"... | [
196,
4
] | [
208,
23
] | python | en | ['en', 'fy', 'en'] | True |
EcoNetThermostat.set_fan_mode | (self, fan_mode) | Set the fan mode. | Set the fan mode. | def set_fan_mode(self, fan_mode):
"""Set the fan mode."""
self._econet.set_fan_mode(HA_FAN_STATE_TO_ECONET[fan_mode]) | [
"def",
"set_fan_mode",
"(",
"self",
",",
"fan_mode",
")",
":",
"self",
".",
"_econet",
".",
"set_fan_mode",
"(",
"HA_FAN_STATE_TO_ECONET",
"[",
"fan_mode",
"]",
")"
] | [
210,
4
] | [
212,
67
] | python | en | ['en', 'fy', 'en'] | True |
EcoNetThermostat.turn_aux_heat_on | (self) | Turn auxiliary heater on. | Turn auxiliary heater on. | def turn_aux_heat_on(self):
"""Turn auxiliary heater on."""
self._econet.set_mode(ThermostatOperationMode.EMERGENCY_HEAT) | [
"def",
"turn_aux_heat_on",
"(",
"self",
")",
":",
"self",
".",
"_econet",
".",
"set_mode",
"(",
"ThermostatOperationMode",
".",
"EMERGENCY_HEAT",
")"
] | [
214,
4
] | [
216,
69
] | python | en | ['fr', 'fi', 'en'] | False |
EcoNetThermostat.turn_aux_heat_off | (self) | Turn auxiliary heater off. | Turn auxiliary heater off. | def turn_aux_heat_off(self):
"""Turn auxiliary heater off."""
self._econet.set_mode(ThermostatOperationMode.HEATING) | [
"def",
"turn_aux_heat_off",
"(",
"self",
")",
":",
"self",
".",
"_econet",
".",
"set_mode",
"(",
"ThermostatOperationMode",
".",
"HEATING",
")"
] | [
218,
4
] | [
220,
62
] | python | en | ['en', 'en', 'en'] | True |
EcoNetThermostat.min_temp | (self) | Return the minimum temperature. | Return the minimum temperature. | def min_temp(self):
"""Return the minimum temperature."""
return self._econet.set_point_limits[0] | [
"def",
"min_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_econet",
".",
"set_point_limits",
"[",
"0",
"]"
] | [
223,
4
] | [
225,
47
] | python | en | ['en', 'la', 'en'] | True |
EcoNetThermostat.max_temp | (self) | Return the maximum temperature. | Return the maximum temperature. | def max_temp(self):
"""Return the maximum temperature."""
return self._econet.set_point_limits[1] | [
"def",
"max_temp",
"(",
"self",
")",
":",
"return",
"self",
".",
"_econet",
".",
"set_point_limits",
"[",
"1",
"]"
] | [
228,
4
] | [
230,
47
] | python | en | ['en', 'la', 'en'] | True |
EcoNetThermostat.min_humidity | (self) | Return the minimum humidity. | Return the minimum humidity. | def min_humidity(self) -> int:
"""Return the minimum humidity."""
return self._econet.dehumidifier_set_point_limits[0] | [
"def",
"min_humidity",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_econet",
".",
"dehumidifier_set_point_limits",
"[",
"0",
"]"
] | [
233,
4
] | [
235,
60
] | python | en | ['en', 'et', 'en'] | True |
EcoNetThermostat.max_humidity | (self) | Return the maximum humidity. | Return the maximum humidity. | def max_humidity(self) -> int:
"""Return the maximum humidity."""
return self._econet.dehumidifier_set_point_limits[1] | [
"def",
"max_humidity",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_econet",
".",
"dehumidifier_set_point_limits",
"[",
"1",
"]"
] | [
238,
4
] | [
240,
60
] | python | en | ['en', 'la', 'en'] | True |
test_one_cover | (hass, rfxtrx) | Test with 1 cover. | Test with 1 cover. | async def test_one_cover(hass, rfxtrx):
"""Test with 1 cover."""
entry_data = create_rfx_test_cfg(
devices={"0b1400cd0213c7f20d010f51": {"signal_repetitions": 1}}
)
mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data)
mock_entry.add_to_hass(hass)
await hass.... | [
"async",
"def",
"test_one_cover",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"0b1400cd0213c7f20d010f51\"",
":",
"{",
"\"signal_repetitions\"",
":",
"1",
"}",
"}",
")",
"mock_entry",
"=",
"MockConfi... | [
12,
0
] | [
52,
5
] | python | en | ['en', 'en', 'en'] | True |
test_state_restore | (hass, rfxtrx, state) | State restoration. | State restoration. | async def test_state_restore(hass, rfxtrx, state):
"""State restoration."""
entity_id = "cover.lightwaverf_siemens_0213c7_242"
mock_restore_cache(hass, [State(entity_id, state)])
entry_data = create_rfx_test_cfg(
devices={"0b1400cd0213c7f20d010f51": {"signal_repetitions": 1}}
)
mock_e... | [
"async",
"def",
"test_state_restore",
"(",
"hass",
",",
"rfxtrx",
",",
"state",
")",
":",
"entity_id",
"=",
"\"cover.lightwaverf_siemens_0213c7_242\"",
"mock_restore_cache",
"(",
"hass",
",",
"[",
"State",
"(",
"entity_id",
",",
"state",
")",
"]",
")",
"entry_da... | [
56,
0
] | [
73,
52
] | python | en | ['en', 'hr', 'en'] | False |
test_several_covers | (hass, rfxtrx) | Test with 3 covers. | Test with 3 covers. | async def test_several_covers(hass, rfxtrx):
"""Test with 3 covers."""
entry_data = create_rfx_test_cfg(
devices={
"0b1400cd0213c7f20d010f51": {"signal_repetitions": 1},
"0A1400ADF394AB010D0060": {"signal_repetitions": 1},
"09190000009ba8010100": {"signal_repetitions"... | [
"async",
"def",
"test_several_covers",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"0b1400cd0213c7f20d010f51\"",
":",
"{",
"\"signal_repetitions\"",
":",
"1",
"}",
",",
"\"0A1400ADF394AB010D0060\"",
":"... | [
76,
0
] | [
105,
73
] | python | en | ['en', 'en', 'en'] | True |
test_discover_covers | (hass, rfxtrx_automatic) | Test with discovery of covers. | Test with discovery of covers. | async def test_discover_covers(hass, rfxtrx_automatic):
"""Test with discovery of covers."""
rfxtrx = rfxtrx_automatic
await rfxtrx.signal("0a140002f38cae010f0070")
state = hass.states.get("cover.lightwaverf_siemens_f38cae_1")
assert state
assert state.state == "open"
await rfxtrx.signal("... | [
"async",
"def",
"test_discover_covers",
"(",
"hass",
",",
"rfxtrx_automatic",
")",
":",
"rfxtrx",
"=",
"rfxtrx_automatic",
"await",
"rfxtrx",
".",
"signal",
"(",
"\"0a140002f38cae010f0070\"",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"\"cover.li... | [
108,
0
] | [
120,
32
] | python | en | ['en', 'en', 'en'] | True |
test_duplicate_cover | (hass, rfxtrx) | Test with 2 duplicate covers. | Test with 2 duplicate covers. | async def test_duplicate_cover(hass, rfxtrx):
"""Test with 2 duplicate covers."""
entry_data = create_rfx_test_cfg(
devices={
"0b1400cd0213c7f20d010f51": {"signal_repetitions": 1},
"0b1400cd0213c7f20d010f50": {"signal_repetitions": 1},
}
)
mock_entry = MockConfigE... | [
"async",
"def",
"test_duplicate_cover",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"0b1400cd0213c7f20d010f51\"",
":",
"{",
"\"signal_repetitions\"",
":",
"1",
"}",
",",
"\"0b1400cd0213c7f20d010f50\"",
... | [
123,
0
] | [
141,
85
] | python | en | ['en', 'en', 'en'] | True |
test_rfy_cover | (hass, rfxtrx) | Test Rfy venetian blind covers. | Test Rfy venetian blind covers. | async def test_rfy_cover(hass, rfxtrx):
"""Test Rfy venetian blind covers."""
entry_data = create_rfx_test_cfg(
devices={
"071a000001020301": {
"signal_repetitions": 1,
"venetian_blind_mode": "Unknown",
},
"071a000001020302": {"signal_r... | [
"async",
"def",
"test_rfy_cover",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"071a000001020301\"",
":",
"{",
"\"signal_repetitions\"",
":",
"1",
",",
"\"venetian_blind_mode\"",
":",
"\"Unknown\"",
",... | [
144,
0
] | [
318,
5
] | python | en | ['en', 'no', 'en'] | True |
get_events | (fname, x_axis='step') | Returns event dictionary for given run, has form
{tag1: {step1: val1}, tag2: ..}
If x_axis is set to "time", step is replaced by timestamp
| Returns event dictionary for given run, has form
{tag1: {step1: val1}, tag2: ..} | def get_events(fname, x_axis='step'):
"""Returns event dictionary for given run, has form
{tag1: {step1: val1}, tag2: ..}
If x_axis is set to "time", step is replaced by timestamp
"""
result = {}
events = summary_iterator.summary_iterator(fname)
try:
for event in events:
if x_axis == 'step'... | [
"def",
"get_events",
"(",
"fname",
",",
"x_axis",
"=",
"'step'",
")",
":",
"result",
"=",
"{",
"}",
"events",
"=",
"summary_iterator",
".",
"summary_iterator",
"(",
"fname",
")",
"try",
":",
"for",
"event",
"in",
"events",
":",
"if",
"x_axis",
"==",
"'... | [
22,
0
] | [
55,
15
] | python | en | ['en', 'en', 'en'] | True |
datetime_from_seconds | (seconds, timezone="US/Pacific") |
timezone: pytz timezone name to use for conversion, ie, UTC or US/Pacific
|
timezone: pytz timezone name to use for conversion, ie, UTC or US/Pacific
| def datetime_from_seconds(seconds, timezone="US/Pacific"):
"""
timezone: pytz timezone name to use for conversion, ie, UTC or US/Pacific
"""
return dt.datetime.fromtimestamp(seconds, pytz.timezone(timezone)) | [
"def",
"datetime_from_seconds",
"(",
"seconds",
",",
"timezone",
"=",
"\"US/Pacific\"",
")",
":",
"return",
"dt",
".",
"datetime",
".",
"fromtimestamp",
"(",
"seconds",
",",
"pytz",
".",
"timezone",
"(",
"timezone",
")",
")"
] | [
57,
0
] | [
61,
68
] | python | en | ['en', 'error', 'th'] | False |
async_setup_platform | (hass, config, add_entities, discovery_info=None) | Set up binary sensors. | Set up binary sensors. | async def async_setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up binary sensors."""
if discovery_info is None:
return
sensors = []
for host_config in discovery_info["config"][DOMAIN]:
host_name = host_config["host"]
host_name_coordinators = hass.data[D... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"sensors",
"=",
"[",
"]",
"for",
"host_config",
"in",
"discovery_info",
... | [
8,
0
] | [
53,
25
] | python | en | ['en', 'bg', 'en'] | True |
create_binary_sensor | (coordinator, host_name, node_name, vm_id, name) | Create a binary sensor based on the given data. | Create a binary sensor based on the given data. | def create_binary_sensor(coordinator, host_name, node_name, vm_id, name):
"""Create a binary sensor based on the given data."""
return ProxmoxBinarySensor(
coordinator=coordinator,
unique_id=f"proxmox_{node_name}_{vm_id}_running",
name=f"{node_name}_{name}_running",
icon="",
... | [
"def",
"create_binary_sensor",
"(",
"coordinator",
",",
"host_name",
",",
"node_name",
",",
"vm_id",
",",
"name",
")",
":",
"return",
"ProxmoxBinarySensor",
"(",
"coordinator",
"=",
"coordinator",
",",
"unique_id",
"=",
"f\"proxmox_{node_name}_{vm_id}_running\"",
",",... | [
56,
0
] | [
66,
5
] | python | en | ['en', 'haw', 'en'] | True |
ProxmoxBinarySensor.__init__ | (
self,
coordinator: DataUpdateCoordinator,
unique_id,
name,
icon,
host_name,
node_name,
vm_id,
) | Create the binary sensor for vms or containers. | Create the binary sensor for vms or containers. | def __init__(
self,
coordinator: DataUpdateCoordinator,
unique_id,
name,
icon,
host_name,
node_name,
vm_id,
):
"""Create the binary sensor for vms or containers."""
super().__init__(
coordinator, unique_id, name, icon, host_... | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
":",
"DataUpdateCoordinator",
",",
"unique_id",
",",
"name",
",",
"icon",
",",
"host_name",
",",
"node_name",
",",
"vm_id",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
",",
"u... | [
72,
4
] | [
85,
9
] | python | en | ['en', 'en', 'en'] | True |
ProxmoxBinarySensor.is_on | (self) | Return the state of the binary sensor. | Return the state of the binary sensor. | def is_on(self):
"""Return the state of the binary sensor."""
data = self.coordinator.data
if data is None:
return None
return data["status"] == "running" | [
"def",
"is_on",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"coordinator",
".",
"data",
"if",
"data",
"is",
"None",
":",
"return",
"None",
"return",
"data",
"[",
"\"status\"",
"]",
"==",
"\"running\""
] | [
88,
4
] | [
95,
42
] | python | en | ['en', 'ig', 'en'] | True |
ProxmoxBinarySensor.available | (self) | Return sensor availability. | Return sensor availability. | def available(self):
"""Return sensor availability."""
return super().available and self.coordinator.data is not None | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"super",
"(",
")",
".",
"available",
"and",
"self",
".",
"coordinator",
".",
"data",
"is",
"not",
"None"
] | [
98,
4
] | [
101,
70
] | python | en | ['fr', 'ga', 'en'] | False |
async_setup_entry | (
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up Spotify based on a config entry. | Set up Spotify based on a config entry. | async def async_setup_entry(
hass: HomeAssistant,
entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up Spotify based on a config entry."""
spotify = SpotifyMediaPlayer(
hass.data[DOMAIN][entry.entry_id][DATA_SPOTIFY_SESSION],
hass.data[DOMAIN][entry.entry... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"None",
":",
"spotify",
"=",
"SpotifyMediaPlayer",
"(",
"hass",
".",
"data",
"[",
"... | [
185,
0
] | [
198,
39
] | python | en | ['en', 'en', 'en'] | True |
spotify_exception_handler | (func) | Decorate Spotify calls to handle Spotify exception.
A decorator that wraps the passed in function, catches Spotify errors,
aiohttp exceptions and handles the availability of the media player.
| Decorate Spotify calls to handle Spotify exception. | def spotify_exception_handler(func):
"""Decorate Spotify calls to handle Spotify exception.
A decorator that wraps the passed in function, catches Spotify errors,
aiohttp exceptions and handles the availability of the media player.
"""
def wrapper(self, *args, **kwargs):
try:
r... | [
"def",
"spotify_exception_handler",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"result",
"=",
"func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self",
... | [
201,
0
] | [
220,
18
] | python | en | ['en', 'en', 'en'] | True |
build_item_response | (spotify, user, payload) | Create response payload for the provided media query. | Create response payload for the provided media query. | def build_item_response(spotify, user, payload): # noqa: C901
"""Create response payload for the provided media query."""
media_content_type = payload["media_content_type"]
media_content_id = payload["media_content_id"]
title = None
image = None
if media_content_type == "current_user_playlists"... | [
"def",
"build_item_response",
"(",
"spotify",
",",
"user",
",",
"payload",
")",
":",
"# noqa: C901",
"media_content_type",
"=",
"payload",
"[",
"\"media_content_type\"",
"]",
"media_content_id",
"=",
"payload",
"[",
"\"media_content_id\"",
"]",
"title",
"=",
"None",... | [
510,
0
] | [
648,
32
] | python | en | ['en', 'en', 'en'] | True |
item_payload | (item) |
Create response payload for a single media item.
Used by async_browse_media.
|
Create response payload for a single media item. | def item_payload(item):
"""
Create response payload for a single media item.
Used by async_browse_media.
"""
try:
media_type = item["type"]
media_id = item["uri"]
except KeyError as err:
_LOGGER.debug("Missing type or URI for media item: %s", item)
raise MissingM... | [
"def",
"item_payload",
"(",
"item",
")",
":",
"try",
":",
"media_type",
"=",
"item",
"[",
"\"type\"",
"]",
"media_id",
"=",
"item",
"[",
"\"uri\"",
"]",
"except",
"KeyError",
"as",
"err",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Missing type or URI for media it... | [
651,
0
] | [
690,
33
] | python | en | ['en', 'error', 'th'] | False |
library_payload | () |
Create response payload to describe contents of a specific library.
Used by async_browse_media.
|
Create response payload to describe contents of a specific library. | def library_payload():
"""
Create response payload to describe contents of a specific library.
Used by async_browse_media.
"""
library_info = {
"title": "Media Library",
"media_class": MEDIA_CLASS_DIRECTORY,
"media_content_id": "library",
"media_content_type": "libra... | [
"def",
"library_payload",
"(",
")",
":",
"library_info",
"=",
"{",
"\"title\"",
":",
"\"Media Library\"",
",",
"\"media_class\"",
":",
"MEDIA_CLASS_DIRECTORY",
",",
"\"media_content_id\"",
":",
"\"library\"",
",",
"\"media_content_type\"",
":",
"\"library\"",
",",
"\"... | [
693,
0
] | [
717,
19
] | python | en | ['en', 'error', 'th'] | False |
fetch_image_url | (item, key="images") | Fetch image url. | Fetch image url. | def fetch_image_url(item, key="images"):
"""Fetch image url."""
try:
return item.get(key, [])[0].get("url")
except IndexError:
return None | [
"def",
"fetch_image_url",
"(",
"item",
",",
"key",
"=",
"\"images\"",
")",
":",
"try",
":",
"return",
"item",
".",
"get",
"(",
"key",
",",
"[",
"]",
")",
"[",
"0",
"]",
".",
"get",
"(",
"\"url\"",
")",
"except",
"IndexError",
":",
"return",
"None"
... | [
720,
0
] | [
725,
19
] | python | en | ['en', 'cy', 'en'] | True |
SpotifyMediaPlayer.__init__ | (
self,
session: OAuth2Session,
spotify: Spotify,
me: dict,
user_id: str,
name: str,
) | Initialize. | Initialize. | def __init__(
self,
session: OAuth2Session,
spotify: Spotify,
me: dict,
user_id: str,
name: str,
) -> None:
"""Initialize."""
self._id = user_id
self._me = me
self._name = f"Spotify {name}"
self._session = session
self._... | [
"def",
"__init__",
"(",
"self",
",",
"session",
":",
"OAuth2Session",
",",
"spotify",
":",
"Spotify",
",",
"me",
":",
"dict",
",",
"user_id",
":",
"str",
",",
"name",
":",
"str",
",",
")",
"->",
"None",
":",
"self",
".",
"_id",
"=",
"user_id",
"sel... | [
230,
4
] | [
253,
38
] | python | en | ['en', 'en', 'it'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.