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_homekit_stop | (hass) | Test HomeKit stop method. | Test HomeKit stop method. | async def test_homekit_stop(hass):
"""Test HomeKit stop method."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE)
homekit.driver = Mock()
homekit.driver.async_stop = AsyncMock()
homekit.bridge = Mock()
homekit.bridge.accessories = {}
... | [
"async",
"def",
"test_homekit_stop",
"(",
"hass",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
"(",
"hass",
",",
"entry",
",",
"HOMEKIT_MODE_BRIDGE",
")",
"homekit",
".",
"driver",
"=",
"Mock",
... | [
638,
0
] | [
663,
51
] | python | en | ['en', 'nl', 'en'] | True |
test_homekit_reset_accessories | (hass, mock_zeroconf) | Test resetting HomeKit accessories. | Test resetting HomeKit accessories. | async def test_homekit_reset_accessories(hass, mock_zeroconf):
"""Test resetting HomeKit accessories."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
)
entity_id = "light.demo"
has... | [
"async",
"def",
"test_homekit_reset_accessories",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
","... | [
666,
0
] | [
706,
37
] | python | de | ['de', 'sn', 'en'] | False |
test_homekit_unpair | (hass, device_reg, mock_zeroconf) | Test unpairing HomeKit accessories. | Test unpairing HomeKit accessories. | async def test_homekit_unpair(hass, device_reg, mock_zeroconf):
"""Test unpairing HomeKit accessories."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
)
entity_id = "light.demo"
ha... | [
"async",
"def",
"test_homekit_unpair",
"(",
"hass",
",",
"device_reg",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DO... | [
709,
0
] | [
745,
39
] | python | en | ['fr', 'nl', 'en'] | False |
test_homekit_unpair_missing_device_id | (hass, device_reg, mock_zeroconf) | Test unpairing HomeKit accessories with invalid device id. | Test unpairing HomeKit accessories with invalid device id. | async def test_homekit_unpair_missing_device_id(hass, device_reg, mock_zeroconf):
"""Test unpairing HomeKit accessories with invalid device id."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
... | [
"async",
"def",
"test_homekit_unpair_missing_device_id",
"(",
"hass",
",",
"device_reg",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"dom... | [
748,
0
] | [
780,
39
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_unpair_not_homekit_device | (hass, device_reg, mock_zeroconf) | Test unpairing HomeKit accessories with a non-homekit device id. | Test unpairing HomeKit accessories with a non-homekit device id. | async def test_homekit_unpair_not_homekit_device(hass, device_reg, mock_zeroconf):
"""Test unpairing HomeKit accessories with a non-homekit device id."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: ... | [
"async",
"def",
"test_homekit_unpair_not_homekit_device",
"(",
"hass",
",",
"device_reg",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"do... | [
783,
0
] | [
826,
39
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_reset_accessories_not_supported | (hass, mock_zeroconf) | Test resetting HomeKit accessories with an unsupported entity. | Test resetting HomeKit accessories with an unsupported entity. | async def test_homekit_reset_accessories_not_supported(hass, mock_zeroconf):
"""Test resetting HomeKit accessories with an unsupported entity."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
... | [
"async",
"def",
"test_homekit_reset_accessories_not_supported",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"... | [
829,
0
] | [
867,
39
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_reset_accessories_state_missing | (hass, mock_zeroconf) | Test resetting HomeKit accessories when the state goes missing. | Test resetting HomeKit accessories when the state goes missing. | async def test_homekit_reset_accessories_state_missing(hass, mock_zeroconf):
"""Test resetting HomeKit accessories when the state goes missing."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
... | [
"async",
"def",
"test_homekit_reset_accessories_state_missing",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"... | [
870,
0
] | [
906,
39
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_reset_accessories_not_bridged | (hass, mock_zeroconf) | Test resetting HomeKit accessories when the state is not bridged. | Test resetting HomeKit accessories when the state is not bridged. | async def test_homekit_reset_accessories_not_bridged(hass, mock_zeroconf):
"""Test resetting HomeKit accessories when the state is not bridged."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
... | [
"async",
"def",
"test_homekit_reset_accessories_not_bridged",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DO... | [
909,
0
] | [
945,
39
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_reset_single_accessory | (hass, mock_zeroconf) | Test resetting HomeKit single accessory. | Test resetting HomeKit single accessory. | async def test_homekit_reset_single_accessory(hass, mock_zeroconf):
"""Test resetting HomeKit single accessory."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
)
entity_id = "light.dem... | [
"async",
"def",
"test_homekit_reset_single_accessory",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
... | [
948,
0
] | [
981,
37
] | python | en | ['en', 'ny', 'en'] | True |
test_homekit_reset_single_accessory_unsupported | (hass, mock_zeroconf) | Test resetting HomeKit single accessory with an unsupported entity. | Test resetting HomeKit single accessory with an unsupported entity. | async def test_homekit_reset_single_accessory_unsupported(hass, mock_zeroconf):
"""Test resetting HomeKit single accessory with an unsupported entity."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: ... | [
"async",
"def",
"test_homekit_reset_single_accessory_unsupported",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
... | [
984,
0
] | [
1015,
39
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_reset_single_accessory_state_missing | (hass, mock_zeroconf) | Test resetting HomeKit single accessory when the state goes missing. | Test resetting HomeKit single accessory when the state goes missing. | async def test_homekit_reset_single_accessory_state_missing(hass, mock_zeroconf):
"""Test resetting HomeKit single accessory when the state goes missing."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_POR... | [
"async",
"def",
"test_homekit_reset_single_accessory_state_missing",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"="... | [
1018,
0
] | [
1048,
39
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_reset_single_accessory_no_match | (hass, mock_zeroconf) | Test resetting HomeKit single accessory when the entity id does not match. | Test resetting HomeKit single accessory when the entity id does not match. | async def test_homekit_reset_single_accessory_no_match(hass, mock_zeroconf):
"""Test resetting HomeKit single accessory when the entity id does not match."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PO... | [
"async",
"def",
"test_homekit_reset_single_accessory_no_match",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"... | [
1051,
0
] | [
1081,
39
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_too_many_accessories | (hass, hk_driver, caplog, mock_zeroconf) | Test adding too many accessories to HomeKit. | Test adding too many accessories to HomeKit. | async def test_homekit_too_many_accessories(hass, hk_driver, caplog, mock_zeroconf):
"""Test adding too many accessories to HomeKit."""
entry = await async_init_integration(hass)
entity_filter = generate_filter(["cover", "light"], ["demo.test"], [], [])
homekit = _mock_homekit(hass, entry, HOMEKIT_MOD... | [
"async",
"def",
"test_homekit_too_many_accessories",
"(",
"hass",
",",
"hk_driver",
",",
"caplog",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"entity_filter",
"=",
"generate_filter",
"(",
"[",
"\"cover\"",
",... | [
1084,
0
] | [
1110,
44
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_finds_linked_batteries | (
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
) | Test HomeKit start method. | Test HomeKit start method. | async def test_homekit_finds_linked_batteries(
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
):
"""Test HomeKit start method."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE)
homekit.driver = hk_driver
homekit.bridge = MagicMock()... | [
"async",
"def",
"test_homekit_finds_linked_batteries",
"(",
"hass",
",",
"hk_driver",
",",
"device_reg",
",",
"entity_reg",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
"(",
"ha... | [
1113,
0
] | [
1181,
5
] | python | en | ['en', 'et', 'en'] | True |
test_homekit_async_get_integration_fails | (
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
) | Test that we continue if async_get_integration fails. | Test that we continue if async_get_integration fails. | async def test_homekit_async_get_integration_fails(
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
):
"""Test that we continue if async_get_integration fails."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE)
homekit.driver = hk_driver
... | [
"async",
"def",
"test_homekit_async_get_integration_fails",
"(",
"hass",
",",
"hk_driver",
",",
"device_reg",
",",
"entity_reg",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
"(",
... | [
1184,
0
] | [
1251,
5
] | python | en | ['en', 'en', 'en'] | True |
test_yaml_updates_update_config_entry_for_name | (hass, mock_zeroconf) | Test async_setup with imported config. | Test async_setup with imported config. | async def test_yaml_updates_update_config_entry_for_name(hass, mock_zeroconf):
"""Test async_setup with imported config."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN,
source=SOURCE_IMPORT,
data={CONF_NAME: BRIDGE_NAME, CON... | [
"async",
"def",
"test_yaml_updates_update_config_entry_for_name",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
... | [
1254,
0
] | [
1295,
46
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_uses_system_zeroconf | (hass, hk_driver, mock_zeroconf) | Test HomeKit uses system zeroconf. | Test HomeKit uses system zeroconf. | async def test_homekit_uses_system_zeroconf(hass, hk_driver, mock_zeroconf):
"""Test HomeKit uses system zeroconf."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: BRIDGE_NAME, CONF_PORT: DEFAULT_PORT},
options={},
)
assert await async_setup_component(hass, "zeroconf",... | [
"async",
"def",
"test_homekit_uses_system_zeroconf",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_NAME",
":",
"BRIDGE_NAME",
",",
"CONF_PORT",
":",
"D... | [
1298,
0
] | [
1319,
42
] | python | de | ['de', 'pl', 'en'] | False |
_write_data | (path: str, data: dict) | Write the data. | Write the data. | def _write_data(path: str, data: dict) -> None:
"""Write the data."""
if not os.path.isdir(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
json_util.save_json(path, data) | [
"def",
"_write_data",
"(",
"path",
":",
"str",
",",
"data",
":",
"dict",
")",
"->",
"None",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
")",
":",
"os",
".",
"makedirs",
"(",
"os",... | [
1322,
0
] | [
1326,
35
] | python | en | ['en', 'sn', 'en'] | True |
test_homekit_ignored_missing_devices | (
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
) | Test HomeKit handles a device in the entity registry but missing from the device registry. | Test HomeKit handles a device in the entity registry but missing from the device registry. | async def test_homekit_ignored_missing_devices(
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
):
"""Test HomeKit handles a device in the entity registry but missing from the device registry."""
await async_setup_component(hass, "persistent_notification", {})
entry = await async_init_integration... | [
"async",
"def",
"test_homekit_ignored_missing_devices",
"(",
"hass",
",",
"hk_driver",
",",
"device_reg",
",",
"entity_reg",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry... | [
1329,
0
] | [
1396,
5
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_finds_linked_motion_sensors | (
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
) | Test HomeKit start method. | Test HomeKit start method. | async def test_homekit_finds_linked_motion_sensors(
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
):
"""Test HomeKit start method."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE)
homekit.driver = hk_driver
homekit.bridge = HomeBr... | [
"async",
"def",
"test_homekit_finds_linked_motion_sensors",
"(",
"hass",
",",
"hk_driver",
",",
"device_reg",
",",
"entity_reg",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
"(",
... | [
1399,
0
] | [
1458,
5
] | python | en | ['en', 'et', 'en'] | True |
test_homekit_finds_linked_humidity_sensors | (
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
) | Test HomeKit start method. | Test HomeKit start method. | async def test_homekit_finds_linked_humidity_sensors(
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
):
"""Test HomeKit start method."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_BRIDGE)
homekit.driver = hk_driver
homekit.bridge = Home... | [
"async",
"def",
"test_homekit_finds_linked_humidity_sensors",
"(",
"hass",
",",
"hk_driver",
",",
"device_reg",
",",
"entity_reg",
",",
"mock_zeroconf",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
"("... | [
1461,
0
] | [
1523,
5
] | python | en | ['en', 'et', 'en'] | True |
test_reload | (hass, mock_zeroconf) | Test we can reload from yaml. | Test we can reload from yaml. | async def test_reload(hass, mock_zeroconf):
"""Test we can reload from yaml."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN,
source=SOURCE_IMPORT,
data={CONF_NAME: "reloadable", CONF_PORT: 12345},
options={},
)
... | [
"async",
"def",
"test_reload",
"(",
"hass",
",",
"mock_zeroconf",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"source",
"="... | [
1526,
0
] | [
1598,
5
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_start_in_accessory_mode | (
hass, hk_driver, mock_zeroconf, device_reg
) | Test HomeKit start method in accessory mode. | Test HomeKit start method in accessory mode. | async def test_homekit_start_in_accessory_mode(
hass, hk_driver, mock_zeroconf, device_reg
):
"""Test HomeKit start method in accessory mode."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_ACCESSORY)
homekit.bridge = Mock()
homekit.bridge.access... | [
"async",
"def",
"test_homekit_start_in_accessory_mode",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
",",
"device_reg",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
"(",
"hass",
",",
"entry",... | [
1605,
0
] | [
1633,
43
] | python | en | ['en', 'fy', 'en'] | True |
test_homekit_start_in_accessory_mode_unsupported_entity | (
hass, hk_driver, mock_zeroconf, device_reg, caplog
) | Test HomeKit start method in accessory mode with an unsupported entity. | Test HomeKit start method in accessory mode with an unsupported entity. | async def test_homekit_start_in_accessory_mode_unsupported_entity(
hass, hk_driver, mock_zeroconf, device_reg, caplog
):
"""Test HomeKit start method in accessory mode with an unsupported entity."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_ACCESSORY)
... | [
"async",
"def",
"test_homekit_start_in_accessory_mode_unsupported_entity",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
",",
"device_reg",
",",
"caplog",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homeki... | [
1636,
0
] | [
1663,
48
] | python | en | ['en', 'en', 'en'] | True |
test_homekit_start_in_accessory_mode_missing_entity | (
hass, hk_driver, mock_zeroconf, device_reg, caplog
) | Test HomeKit start method in accessory mode when entity is not available. | Test HomeKit start method in accessory mode when entity is not available. | async def test_homekit_start_in_accessory_mode_missing_entity(
hass, hk_driver, mock_zeroconf, device_reg, caplog
):
"""Test HomeKit start method in accessory mode when entity is not available."""
entry = await async_init_integration(hass)
homekit = _mock_homekit(hass, entry, HOMEKIT_MODE_ACCESSORY)
... | [
"async",
"def",
"test_homekit_start_in_accessory_mode_missing_entity",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
",",
"device_reg",
",",
"caplog",
")",
":",
"entry",
"=",
"await",
"async_init_integration",
"(",
"hass",
")",
"homekit",
"=",
"_mock_homekit",
... | [
1666,
0
] | [
1688,
48
] | python | en | ['en', 'en', 'en'] | True |
test_wait_for_port_to_free | (hass, hk_driver, mock_zeroconf, caplog) | Test we wait for the port to free before declaring unload success. | Test we wait for the port to free before declaring unload success. | async def test_wait_for_port_to_free(hass, hk_driver, mock_zeroconf, caplog):
"""Test we wait for the port to free before declaring unload success."""
await async_setup_component(hass, "persistent_notification", {})
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_NAME: BRIDGE_NAME, CONF_P... | [
"async",
"def",
"test_wait_for_port_to_free",
"(",
"hass",
",",
"hk_driver",
",",
"mock_zeroconf",
",",
"caplog",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"entry",
"=",
"MockConfigEntry",
"(",... | [
1691,
0
] | [
1721,
31
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) | Set up a Hyperion platform from config entry. | Set up a Hyperion platform from config entry. | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback,
) -> bool:
"""Set up a Hyperion platform from config entry."""
entry_data = hass.data[DOMAIN][config_entry.entry_id]
server_id = config_entry.unique_id
@callback
def in... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"AddEntitiesCallback",
",",
")",
"->",
"bool",
":",
"entry_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"["... | [
83,
0
] | [
124,
15
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.__init__ | (
self,
server_id: str,
instance_num: int,
instance_name: str,
options: MappingProxyType[str, Any],
hyperion_client: client.HyperionClient,
) | Initialize the light. | Initialize the light. | def __init__(
self,
server_id: str,
instance_num: int,
instance_name: str,
options: MappingProxyType[str, Any],
hyperion_client: client.HyperionClient,
) -> None:
"""Initialize the light."""
self._unique_id = self._compute_unique_id(server_id, instance... | [
"def",
"__init__",
"(",
"self",
",",
"server_id",
":",
"str",
",",
"instance_num",
":",
"int",
",",
"instance_name",
":",
"str",
",",
"options",
":",
"MappingProxyType",
"[",
"str",
",",
"Any",
"]",
",",
"hyperion_client",
":",
"client",
".",
"HyperionClie... | [
130,
4
] | [
165,
9
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight._compute_unique_id | (self, server_id: str, instance_num: int) | Compute a unique id for this instance. | Compute a unique id for this instance. | def _compute_unique_id(self, server_id: str, instance_num: int) -> str:
"""Compute a unique id for this instance."""
raise NotImplementedError | [
"def",
"_compute_unique_id",
"(",
"self",
",",
"server_id",
":",
"str",
",",
"instance_num",
":",
"int",
")",
"->",
"str",
":",
"raise",
"NotImplementedError"
] | [
167,
4
] | [
169,
33
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight._compute_name | (self, instance_name: str) | Compute the name of the light. | Compute the name of the light. | def _compute_name(self, instance_name: str) -> str:
"""Compute the name of the light."""
raise NotImplementedError | [
"def",
"_compute_name",
"(",
"self",
",",
"instance_name",
":",
"str",
")",
"->",
"str",
":",
"raise",
"NotImplementedError"
] | [
171,
4
] | [
173,
33
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.entity_registry_enabled_default | (self) | Whether or not the entity is enabled by default. | Whether or not the entity is enabled by default. | def entity_registry_enabled_default(self) -> bool:
"""Whether or not the entity is enabled by default."""
return True | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
176,
4
] | [
178,
19
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.should_poll | (self) | Return whether or not this entity should be polled. | Return whether or not this entity should be polled. | def should_poll(self) -> bool:
"""Return whether or not this entity should be polled."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
181,
4
] | [
183,
20
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.name | (self) | Return the name of the light. | Return the name of the light. | def name(self) -> str:
"""Return the name of the light."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
186,
4
] | [
188,
25
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.brightness | (self) | Return the brightness of this light between 0..255. | Return the brightness of this light between 0..255. | def brightness(self) -> int:
"""Return the brightness of this light between 0..255."""
return self._brightness | [
"def",
"brightness",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_brightness"
] | [
191,
4
] | [
193,
31
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.hs_color | (self) | Return last color value set. | Return last color value set. | def hs_color(self) -> tuple[float, float]:
"""Return last color value set."""
return color_util.color_RGB_to_hs(*self._rgb_color) | [
"def",
"hs_color",
"(",
"self",
")",
"->",
"tuple",
"[",
"float",
",",
"float",
"]",
":",
"return",
"color_util",
".",
"color_RGB_to_hs",
"(",
"*",
"self",
".",
"_rgb_color",
")"
] | [
196,
4
] | [
198,
59
] | python | da | ['es', 'da', 'en'] | False |
HyperionBaseLight.icon | (self) | Return state specific icon. | Return state specific icon. | def icon(self) -> str:
"""Return state specific icon."""
if self.is_on:
if (
self.effect in const.KEY_COMPONENTID_FROM_NAME
and const.KEY_COMPONENTID_FROM_NAME[self.effect]
in const.KEY_COMPONENTID_EXTERNAL_SOURCES
):
... | [
"def",
"icon",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"is_on",
":",
"if",
"(",
"self",
".",
"effect",
"in",
"const",
".",
"KEY_COMPONENTID_FROM_NAME",
"and",
"const",
".",
"KEY_COMPONENTID_FROM_NAME",
"[",
"self",
".",
"effect",
"]",
"in"... | [
201,
4
] | [
212,
29
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.effect | (self) | Return the current effect. | Return the current effect. | def effect(self) -> str:
"""Return the current effect."""
return self._effect | [
"def",
"effect",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_effect"
] | [
215,
4
] | [
217,
27
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.effect_list | (self) | Return the list of supported effects. | Return the list of supported effects. | def effect_list(self) -> list[str]:
"""Return the list of supported effects."""
return self._effect_list | [
"def",
"effect_list",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_effect_list"
] | [
220,
4
] | [
222,
32
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.supported_features | (self) | Flag supported features. | Flag supported features. | def supported_features(self) -> int:
"""Flag supported features."""
return SUPPORT_HYPERION | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_HYPERION"
] | [
225,
4
] | [
227,
31
] | python | en | ['da', 'en', 'en'] | True |
HyperionBaseLight.available | (self) | Return server availability. | Return server availability. | def available(self) -> bool:
"""Return server availability."""
return bool(self._client.has_loaded_state) | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"self",
".",
"_client",
".",
"has_loaded_state",
")"
] | [
230,
4
] | [
232,
50
] | python | en | ['fr', 'ga', 'en'] | False |
HyperionBaseLight.unique_id | (self) | Return a unique id for this instance. | Return a unique id for this instance. | def unique_id(self) -> str:
"""Return a unique id for this instance."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unique_id"
] | [
235,
4
] | [
237,
30
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.device_info | (self) | Return device information. | Return device information. | def device_info(self) -> DeviceInfo:
"""Return device information."""
return {
"identifiers": {(DOMAIN, self._device_id)},
"name": self._instance_name,
"manufacturer": HYPERION_MANUFACTURER_NAME,
"model": HYPERION_MODEL_NAME,
} | [
"def",
"device_info",
"(",
"self",
")",
"->",
"DeviceInfo",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_device_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"_instance_name",
",",
"\"manufacturer\"",
":",
"HYPERI... | [
240,
4
] | [
247,
9
] | python | da | ['es', 'da', 'en'] | False |
HyperionBaseLight._get_option | (self, key: str) | Get a value from the provided options. | Get a value from the provided options. | def _get_option(self, key: str) -> Any:
"""Get a value from the provided options."""
defaults = {
CONF_PRIORITY: DEFAULT_PRIORITY,
CONF_EFFECT_HIDE_LIST: [],
}
return self._options.get(key, defaults[key]) | [
"def",
"_get_option",
"(",
"self",
",",
"key",
":",
"str",
")",
"->",
"Any",
":",
"defaults",
"=",
"{",
"CONF_PRIORITY",
":",
"DEFAULT_PRIORITY",
",",
"CONF_EFFECT_HIDE_LIST",
":",
"[",
"]",
",",
"}",
"return",
"self",
".",
"_options",
".",
"get",
"(",
... | [
249,
4
] | [
255,
52
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.async_turn_on | (self, **kwargs: Any) | Turn on the light. | Turn on the light. | async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the light."""
# == Get key parameters ==
if ATTR_EFFECT not in kwargs and ATTR_HS_COLOR in kwargs:
effect = KEY_EFFECT_SOLID
else:
effect = kwargs.get(ATTR_EFFECT, self._effect)
rgb_color: Se... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"# == Get key parameters ==",
"if",
"ATTR_EFFECT",
"not",
"in",
"kwargs",
"and",
"ATTR_HS_COLOR",
"in",
"kwargs",
":",
"effect",
"=",
"KEY_EFFECT_SOLID",... | [
257,
4
] | [
353,
22
] | python | en | ['en', 'et', 'en'] | True |
HyperionBaseLight._set_internal_state | (
self,
brightness: int | None = None,
rgb_color: Sequence[int] | None = None,
effect: str | None = None,
) | Set the internal state. | Set the internal state. | def _set_internal_state(
self,
brightness: int | None = None,
rgb_color: Sequence[int] | None = None,
effect: str | None = None,
) -> None:
"""Set the internal state."""
if brightness is not None:
self._brightness = brightness
if rgb_color is not N... | [
"def",
"_set_internal_state",
"(",
"self",
",",
"brightness",
":",
"int",
"|",
"None",
"=",
"None",
",",
"rgb_color",
":",
"Sequence",
"[",
"int",
"]",
"|",
"None",
"=",
"None",
",",
"effect",
":",
"str",
"|",
"None",
"=",
"None",
",",
")",
"->",
"... | [
355,
4
] | [
367,
33
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight._update_components | (self, _: dict[str, Any] | None = None) | Update Hyperion components. | Update Hyperion components. | def _update_components(self, _: dict[str, Any] | None = None) -> None:
"""Update Hyperion components."""
self.async_write_ha_state() | [
"def",
"_update_components",
"(",
"self",
",",
"_",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
370,
4
] | [
372,
35
] | python | en | ['de', 'en', 'en'] | True |
HyperionBaseLight._update_adjustment | (self, _: dict[str, Any] | None = None) | Update Hyperion adjustments. | Update Hyperion adjustments. | def _update_adjustment(self, _: dict[str, Any] | None = None) -> None:
"""Update Hyperion adjustments."""
if self._client.adjustment:
brightness_pct = self._client.adjustment[0].get(
const.KEY_BRIGHTNESS, DEFAULT_BRIGHTNESS
)
if brightness_pct < 0 or b... | [
"def",
"_update_adjustment",
"(",
"self",
",",
"_",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"if",
"self",
".",
"_client",
".",
"adjustment",
":",
"brightness_pct",
"=",
"self",
".",
"_client",
".",
... | [
375,
4
] | [
386,
39
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight._update_priorities | (self, _: dict[str, Any] | None = None) | Update Hyperion priorities. | Update Hyperion priorities. | def _update_priorities(self, _: dict[str, Any] | None = None) -> None:
"""Update Hyperion priorities."""
priority = self._get_priority_entry_that_dictates_state()
if priority and self._allow_priority_update(priority):
componentid = priority.get(const.KEY_COMPONENTID)
if (... | [
"def",
"_update_priorities",
"(",
"self",
",",
"_",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"priority",
"=",
"self",
".",
"_get_priority_entry_that_dictates_state",
"(",
")",
"if",
"priority",
"and",
"s... | [
389,
4
] | [
414,
35
] | python | en | ['en', 'nl', 'en'] | True |
HyperionBaseLight._update_effect_list | (self, _: dict[str, Any] | None = None) | Update Hyperion effects. | Update Hyperion effects. | def _update_effect_list(self, _: dict[str, Any] | None = None) -> None:
"""Update Hyperion effects."""
if not self._client.effects:
return
effect_list: list[str] = []
hide_effects = self._get_option(CONF_EFFECT_HIDE_LIST)
for effect in self._client.effects or []:
... | [
"def",
"_update_effect_list",
"(",
"self",
",",
"_",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"_client",
".",
"effects",
":",
"return",
"effect_list",
":",
"list",
"[",
"s... | [
417,
4
] | [
433,
35
] | python | en | ['es', 'en', 'en'] | True |
HyperionBaseLight._update_full_state | (self) | Update full Hyperion state. | Update full Hyperion state. | def _update_full_state(self) -> None:
"""Update full Hyperion state."""
self._update_adjustment()
self._update_priorities()
self._update_effect_list()
_LOGGER.debug(
"Hyperion full state update: On=%s,Brightness=%i,Effect=%s "
"(%i effects total),Color=%s... | [
"def",
"_update_full_state",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_update_adjustment",
"(",
")",
"self",
".",
"_update_priorities",
"(",
")",
"self",
".",
"_update_effect_list",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Hyperion full state update:... | [
436,
4
] | [
450,
9
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight._update_client | (self, _: dict[str, Any] | None = None) | Update client connection state. | Update client connection state. | def _update_client(self, _: dict[str, Any] | None = None) -> None:
"""Update client connection state."""
self.async_write_ha_state() | [
"def",
"_update_client",
"(",
"self",
",",
"_",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"None",
":",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
453,
4
] | [
455,
35
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.async_added_to_hass | (self) | Register callbacks when entity added to hass. | Register callbacks when entity added to hass. | async def async_added_to_hass(self) -> None:
"""Register callbacks when entity added to hass."""
self.async_on_remove(
async_dispatcher_connect(
self.hass,
SIGNAL_ENTITY_REMOVE.format(self.unique_id),
functools.partial(self.async_remove, force_... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"SIGNAL_ENTITY_REMOVE",
".",
"format",
"(",
"self",
".",
"unique_id",
")",
",",
"functoo... | [
457,
4
] | [
470,
33
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight.async_will_remove_from_hass | (self) | Cleanup prior to hass removal. | Cleanup prior to hass removal. | async def async_will_remove_from_hass(self) -> None:
"""Cleanup prior to hass removal."""
self._client.remove_callbacks(self._client_callbacks) | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_client",
".",
"remove_callbacks",
"(",
"self",
".",
"_client_callbacks",
")"
] | [
472,
4
] | [
474,
61
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight._support_external_effects | (self) | Whether or not to support setting external effects from the light entity. | Whether or not to support setting external effects from the light entity. | def _support_external_effects(self) -> bool:
"""Whether or not to support setting external effects from the light entity."""
return True | [
"def",
"_support_external_effects",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
477,
4
] | [
479,
19
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight._get_priority_entry_that_dictates_state | (self) | Get the relevant Hyperion priority entry to consider. | Get the relevant Hyperion priority entry to consider. | def _get_priority_entry_that_dictates_state(self) -> dict[str, Any] | None:
"""Get the relevant Hyperion priority entry to consider."""
# Return the visible priority (whether or not it is the HA priority).
# Explicit type specifier to ensure this works when the underlying (typed)
# libr... | [
"def",
"_get_priority_entry_that_dictates_state",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
":",
"# Return the visible priority (whether or not it is the HA priority).",
"# Explicit type specifier to ensure this works when the underlying (typed)",
"#... | [
481,
4
] | [
489,
23
] | python | en | ['en', 'en', 'en'] | True |
HyperionBaseLight._allow_priority_update | (self, priority: dict[str, Any] | None = None) | Determine whether to allow a priority to update internal state. | Determine whether to allow a priority to update internal state. | def _allow_priority_update(self, priority: dict[str, Any] | None = None) -> bool:
"""Determine whether to allow a priority to update internal state."""
return True | [
"def",
"_allow_priority_update",
"(",
"self",
",",
"priority",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"bool",
":",
"return",
"True"
] | [
492,
4
] | [
494,
19
] | python | en | ['en', 'en', 'en'] | True |
HyperionLight._compute_unique_id | (self, server_id: str, instance_num: int) | Compute a unique id for this instance. | Compute a unique id for this instance. | def _compute_unique_id(self, server_id: str, instance_num: int) -> str:
"""Compute a unique id for this instance."""
return get_hyperion_unique_id(server_id, instance_num, TYPE_HYPERION_LIGHT) | [
"def",
"_compute_unique_id",
"(",
"self",
",",
"server_id",
":",
"str",
",",
"instance_num",
":",
"int",
")",
"->",
"str",
":",
"return",
"get_hyperion_unique_id",
"(",
"server_id",
",",
"instance_num",
",",
"TYPE_HYPERION_LIGHT",
")"
] | [
505,
4
] | [
507,
83
] | python | en | ['en', 'en', 'en'] | True |
HyperionLight._compute_name | (self, instance_name: str) | Compute the name of the light. | Compute the name of the light. | def _compute_name(self, instance_name: str) -> str:
"""Compute the name of the light."""
return f"{instance_name} {NAME_SUFFIX_HYPERION_LIGHT}".strip() | [
"def",
"_compute_name",
"(",
"self",
",",
"instance_name",
":",
"str",
")",
"->",
"str",
":",
"return",
"f\"{instance_name} {NAME_SUFFIX_HYPERION_LIGHT}\"",
".",
"strip",
"(",
")"
] | [
509,
4
] | [
511,
70
] | python | en | ['en', 'en', 'en'] | True |
HyperionLight.is_on | (self) | Return true if light is on. | Return true if light is on. | def is_on(self) -> bool:
"""Return true if light is on."""
return (
bool(self._client.is_on())
and self._get_priority_entry_that_dictates_state() is not None
) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"(",
"bool",
"(",
"self",
".",
"_client",
".",
"is_on",
"(",
")",
")",
"and",
"self",
".",
"_get_priority_entry_that_dictates_state",
"(",
")",
"is",
"not",
"None",
")"
] | [
514,
4
] | [
519,
9
] | python | en | ['en', 'et', 'en'] | True |
HyperionLight.async_turn_on | (self, **kwargs: Any) | Turn on the light. | Turn on the light. | async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the light."""
# == Turn device on ==
# Turn on both ALL (Hyperion itself) and LEDDEVICE. It would be
# preferable to enable LEDDEVICE after the settings (e.g. brightness,
# color, effect), but this is not possible d... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"# == Turn device on ==",
"# Turn on both ALL (Hyperion itself) and LEDDEVICE. It would be",
"# preferable to enable LEDDEVICE after the settings (e.g. brightness,",
"# colo... | [
521,
4
] | [
544,
45
] | python | en | ['en', 'et', 'en'] | True |
HyperionLight.async_turn_off | (self, **kwargs: Any) | Turn off the light. | Turn off the light. | async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the light."""
if not await self._client.async_send_set_component(
**{
const.KEY_COMPONENTSTATE: {
const.KEY_COMPONENT: const.KEY_COMPONENTID_LEDDEVICE,
const.KEY_STATE: ... | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"if",
"not",
"await",
"self",
".",
"_client",
".",
"async_send_set_component",
"(",
"*",
"*",
"{",
"const",
".",
"KEY_COMPONENTSTATE",
":",
"{",
... | [
546,
4
] | [
556,
18
] | python | en | ['en', 'zh', 'en'] | True |
HyperionPriorityLight._compute_unique_id | (self, server_id: str, instance_num: int) | Compute a unique id for this instance. | Compute a unique id for this instance. | def _compute_unique_id(self, server_id: str, instance_num: int) -> str:
"""Compute a unique id for this instance."""
return get_hyperion_unique_id(
server_id, instance_num, TYPE_HYPERION_PRIORITY_LIGHT
) | [
"def",
"_compute_unique_id",
"(",
"self",
",",
"server_id",
":",
"str",
",",
"instance_num",
":",
"int",
")",
"->",
"str",
":",
"return",
"get_hyperion_unique_id",
"(",
"server_id",
",",
"instance_num",
",",
"TYPE_HYPERION_PRIORITY_LIGHT",
")"
] | [
562,
4
] | [
566,
9
] | python | en | ['en', 'en', 'en'] | True |
HyperionPriorityLight._compute_name | (self, instance_name: str) | Compute the name of the light. | Compute the name of the light. | def _compute_name(self, instance_name: str) -> str:
"""Compute the name of the light."""
return f"{instance_name} {NAME_SUFFIX_HYPERION_PRIORITY_LIGHT}".strip() | [
"def",
"_compute_name",
"(",
"self",
",",
"instance_name",
":",
"str",
")",
"->",
"str",
":",
"return",
"f\"{instance_name} {NAME_SUFFIX_HYPERION_PRIORITY_LIGHT}\"",
".",
"strip",
"(",
")"
] | [
568,
4
] | [
570,
79
] | python | en | ['en', 'en', 'en'] | True |
HyperionPriorityLight.entity_registry_enabled_default | (self) | Whether or not the entity is enabled by default. | Whether or not the entity is enabled by default. | def entity_registry_enabled_default(self) -> bool:
"""Whether or not the entity is enabled by default."""
return False | [
"def",
"entity_registry_enabled_default",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
573,
4
] | [
575,
20
] | python | en | ['en', 'en', 'en'] | True |
HyperionPriorityLight.is_on | (self) | Return true if light is on. | Return true if light is on. | def is_on(self) -> bool:
"""Return true if light is on."""
priority = self._get_priority_entry_that_dictates_state()
return (
priority is not None
and not HyperionPriorityLight._is_priority_entry_black(priority)
) | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"priority",
"=",
"self",
".",
"_get_priority_entry_that_dictates_state",
"(",
")",
"return",
"(",
"priority",
"is",
"not",
"None",
"and",
"not",
"HyperionPriorityLight",
".",
"_is_priority_entry_black",
"(",
"... | [
578,
4
] | [
584,
9
] | python | en | ['en', 'et', 'en'] | True |
HyperionPriorityLight.async_turn_off | (self, **kwargs: Any) | Turn off the light. | Turn off the light. | async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the light."""
if not await self._client.async_send_clear(
**{const.KEY_PRIORITY: self._get_option(CONF_PRIORITY)}
):
return
await self._client.async_send_set_color(
**{
... | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"if",
"not",
"await",
"self",
".",
"_client",
".",
"async_send_clear",
"(",
"*",
"*",
"{",
"const",
".",
"KEY_PRIORITY",
":",
"self",
".",
"_g... | [
586,
4
] | [
598,
9
] | python | en | ['en', 'zh', 'en'] | True |
HyperionPriorityLight._support_external_effects | (self) | Whether or not to support setting external effects from the light entity. | Whether or not to support setting external effects from the light entity. | def _support_external_effects(self) -> bool:
"""Whether or not to support setting external effects from the light entity."""
return False | [
"def",
"_support_external_effects",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | [
601,
4
] | [
603,
20
] | python | en | ['en', 'en', 'en'] | True |
HyperionPriorityLight._get_priority_entry_that_dictates_state | (self) | Get the relevant Hyperion priority entry to consider. | Get the relevant Hyperion priority entry to consider. | def _get_priority_entry_that_dictates_state(self) -> dict[str, Any] | None:
"""Get the relevant Hyperion priority entry to consider."""
# Return the active priority (if any) at the configured HA priority.
for candidate in self._client.priorities or []:
if const.KEY_PRIORITY not in ca... | [
"def",
"_get_priority_entry_that_dictates_state",
"(",
"self",
")",
"->",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
":",
"# Return the active priority (if any) at the configured HA priority.",
"for",
"candidate",
"in",
"self",
".",
"_client",
".",
"priorities",
... | [
605,
4
] | [
619,
19
] | python | en | ['en', 'en', 'en'] | True |
HyperionPriorityLight._is_priority_entry_black | (cls, priority: dict[str, Any] | None) | Determine if a given priority entry is the color black. | Determine if a given priority entry is the color black. | def _is_priority_entry_black(cls, priority: dict[str, Any] | None) -> bool:
"""Determine if a given priority entry is the color black."""
if (
priority
and priority.get(const.KEY_COMPONENTID) == const.KEY_COMPONENTID_COLOR
):
rgb_color = priority.get(const.KEY... | [
"def",
"_is_priority_entry_black",
"(",
"cls",
",",
"priority",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
")",
"->",
"bool",
":",
"if",
"(",
"priority",
"and",
"priority",
".",
"get",
"(",
"const",
".",
"KEY_COMPONENTID",
")",
"==",
"const... | [
622,
4
] | [
631,
20
] | python | en | ['en', 'en', 'en'] | True |
HyperionPriorityLight._allow_priority_update | (self, priority: dict[str, Any] | None = None) | Determine whether to allow a Hyperion priority to update entity attributes. | Determine whether to allow a Hyperion priority to update entity attributes. | def _allow_priority_update(self, priority: dict[str, Any] | None = None) -> bool:
"""Determine whether to allow a Hyperion priority to update entity attributes."""
# Black is treated as 'off' (and Home Assistant does not support selecting black
# from the color selector). Do not set our internal... | [
"def",
"_allow_priority_update",
"(",
"self",
",",
"priority",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
")",
"->",
"bool",
":",
"# Black is treated as 'off' (and Home Assistant does not support selecting black",
"# from the color selector). Do n... | [
633,
4
] | [
639,
75
] | python | en | ['en', 'en', 'en'] | True |
test_search | (hass) | Test that search works. | Test that search works. | async def test_search(hass):
"""Test that search works."""
area_reg = ar.async_get(hass)
device_reg = dr.async_get(hass)
entity_reg = er.async_get(hass)
living_room_area = area_reg.async_create("Living Room")
# Light strip with 2 lights.
wled_config_entry = MockConfigEntry(domain="wled")
... | [
"async",
"def",
"test_search",
"(",
"hass",
")",
":",
"area_reg",
"=",
"ar",
".",
"async_get",
"(",
"hass",
")",
"device_reg",
"=",
"dr",
".",
"async_get",
"(",
"hass",
")",
"entity_reg",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"living_room_area",... | [
26,
0
] | [
309,
5
] | python | en | ['en', 'en', 'en'] | True |
test_area_lookup | (hass) | Test area based lookup. | Test area based lookup. | async def test_area_lookup(hass):
"""Test area based lookup."""
area_reg = ar.async_get(hass)
device_reg = dr.async_get(hass)
entity_reg = er.async_get(hass)
living_room_area = area_reg.async_create("Living Room")
await async_setup_component(
hass,
"script",
{
... | [
"async",
"def",
"test_area_lookup",
"(",
"hass",
")",
":",
"area_reg",
"=",
"ar",
".",
"async_get",
"(",
"hass",
")",
"device_reg",
"=",
"dr",
".",
"async_get",
"(",
"hass",
")",
"entity_reg",
"=",
"er",
".",
"async_get",
"(",
"hass",
")",
"living_room_a... | [
312,
0
] | [
367,
5
] | python | en | ['en', 'et', 'en'] | True |
test_ws_api | (hass, hass_ws_client) | Test WS API. | Test WS API. | async def test_ws_api(hass, hass_ws_client):
"""Test WS API."""
assert await async_setup_component(hass, "search", {})
area_reg = ar.async_get(hass)
device_reg = dr.async_get(hass)
kitchen_area = area_reg.async_create("Kitchen")
hue_config_entry = MockConfigEntry(domain="hue")
hue_config_... | [
"async",
"def",
"test_ws_api",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"search\"",
",",
"{",
"}",
")",
"area_reg",
"=",
"ar",
".",
"async_get",
"(",
"hass",
")",
"device_reg",
"=",
"dr",... | [
370,
0
] | [
405,
5
] | python | en | ['en', 'pl', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant,
config_entry: config_entries.ConfigEntry,
async_add_entities,
) | Set up the configuration entry. | Set up the configuration entry. | async def async_setup_entry(
hass: HomeAssistant,
config_entry: config_entries.ConfigEntry,
async_add_entities,
):
"""Set up the configuration entry."""
client = get_entry_client(hass, config_entry)
async_add_entities(
[
ArcamFmj(
config_entry.title,
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
",",
"async_add_entities",
",",
")",
":",
"client",
"=",
"get_entry_client",
"(",
"hass",
",",
"config_entry",
")",
"async_add_e... | [
38,
0
] | [
59,
15
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.__init__ | (
self,
device_name,
state: State,
uuid: str,
) | Initialize device. | Initialize device. | def __init__(
self,
device_name,
state: State,
uuid: str,
):
"""Initialize device."""
self._state = state
self._device_name = device_name
self._attr_name = f"{device_name} - Zone: {state.zn}"
self._uuid = uuid
self._attr_supported_featu... | [
"def",
"__init__",
"(",
"self",
",",
"device_name",
",",
"state",
":",
"State",
",",
"uuid",
":",
"str",
",",
")",
":",
"self",
".",
"_state",
"=",
"state",
"self",
".",
"_device_name",
"=",
"device_name",
"self",
".",
"_attr_name",
"=",
"f\"{device_name... | [
67,
4
] | [
91,
66
] | python | en | ['fr', 'en', 'en'] | False |
ArcamFmj._get_2ch | (self) | Return if source is 2 channel or not. | Return if source is 2 channel or not. | def _get_2ch(self):
"""Return if source is 2 channel or not."""
audio_format, _ = self._state.get_incoming_audio_format()
return bool(
audio_format
in (
IncomingAudioFormat.PCM,
IncomingAudioFormat.ANALOGUE_DIRECT,
IncomingA... | [
"def",
"_get_2ch",
"(",
"self",
")",
":",
"audio_format",
",",
"_",
"=",
"self",
".",
"_state",
".",
"get_incoming_audio_format",
"(",
")",
"return",
"bool",
"(",
"audio_format",
"in",
"(",
"IncomingAudioFormat",
".",
"PCM",
",",
"IncomingAudioFormat",
".",
... | [
93,
4
] | [
104,
9
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
if self._state.get_power():
return STATE_ON
return STATE_OFF | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
".",
"get_power",
"(",
")",
":",
"return",
"STATE_ON",
"return",
"STATE_OFF"
] | [
107,
4
] | [
111,
24
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.device_info | (self) | Return a device description for device registry. | Return a device description for device registry. | def device_info(self):
"""Return a device description for device registry."""
return {
"name": self._device_name,
"identifiers": {
(DOMAIN, self._uuid),
(DOMAIN, self._state.client.host, self._state.client.port),
},
"model":... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"name\"",
":",
"self",
".",
"_device_name",
",",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_uuid",
")",
",",
"(",
"DOMAIN",
",",
"self",
".",
"_state",
".",
"client",
... | [
114,
4
] | [
124,
9
] | python | en | ['ro', 'fr', 'en'] | False |
ArcamFmj.async_added_to_hass | (self) | Once registered, add listener for events. | Once registered, add listener for events. | async def async_added_to_hass(self):
"""Once registered, add listener for events."""
await self._state.start()
@callback
def _data(host):
if host == self._state.client.host:
self.async_write_ha_state()
@callback
def _started(host):
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"self",
".",
"_state",
".",
"start",
"(",
")",
"@",
"callback",
"def",
"_data",
"(",
"host",
")",
":",
"if",
"host",
"==",
"self",
".",
"_state",
".",
"client",
".",
"host",
":",
... | [
126,
4
] | [
161,
9
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.async_update | (self) | Force update of state. | Force update of state. | async def async_update(self):
"""Force update of state."""
_LOGGER.debug("Update state %s", self.name)
await self._state.update() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Update state %s\"",
",",
"self",
".",
"name",
")",
"await",
"self",
".",
"_state",
".",
"update",
"(",
")"
] | [
163,
4
] | [
166,
34
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.async_mute_volume | (self, mute) | Send mute command. | Send mute command. | async def async_mute_volume(self, mute):
"""Send mute command."""
await self._state.set_mute(mute)
self.async_write_ha_state() | [
"async",
"def",
"async_mute_volume",
"(",
"self",
",",
"mute",
")",
":",
"await",
"self",
".",
"_state",
".",
"set_mute",
"(",
"mute",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
168,
4
] | [
171,
35
] | python | en | ['en', 'co', 'en'] | True |
ArcamFmj.async_select_source | (self, source) | Select a specific source. | Select a specific source. | async def async_select_source(self, source):
"""Select a specific source."""
try:
value = SourceCodes[source]
except KeyError:
_LOGGER.error("Unsupported source %s", source)
return
await self._state.set_source(value)
self.async_write_ha_state(... | [
"async",
"def",
"async_select_source",
"(",
"self",
",",
"source",
")",
":",
"try",
":",
"value",
"=",
"SourceCodes",
"[",
"source",
"]",
"except",
"KeyError",
":",
"_LOGGER",
".",
"error",
"(",
"\"Unsupported source %s\"",
",",
"source",
")",
"return",
"awa... | [
173,
4
] | [
182,
35
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.async_select_sound_mode | (self, sound_mode) | Select a specific source. | Select a specific source. | async def async_select_sound_mode(self, sound_mode):
"""Select a specific source."""
try:
if self._get_2ch():
await self._state.set_decode_mode_2ch(DecodeMode2CH[sound_mode])
else:
await self._state.set_decode_mode_mch(DecodeModeMCH[sound_mode])
... | [
"async",
"def",
"async_select_sound_mode",
"(",
"self",
",",
"sound_mode",
")",
":",
"try",
":",
"if",
"self",
".",
"_get_2ch",
"(",
")",
":",
"await",
"self",
".",
"_state",
".",
"set_decode_mode_2ch",
"(",
"DecodeMode2CH",
"[",
"sound_mode",
"]",
")",
"e... | [
184,
4
] | [
195,
35
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.async_set_volume_level | (self, volume) | Set volume level, range 0..1. | Set volume level, range 0..1. | async def async_set_volume_level(self, volume):
"""Set volume level, range 0..1."""
await self._state.set_volume(round(volume * 99.0))
self.async_write_ha_state() | [
"async",
"def",
"async_set_volume_level",
"(",
"self",
",",
"volume",
")",
":",
"await",
"self",
".",
"_state",
".",
"set_volume",
"(",
"round",
"(",
"volume",
"*",
"99.0",
")",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
197,
4
] | [
200,
35
] | python | en | ['fr', 'zu', 'en'] | False |
ArcamFmj.async_volume_up | (self) | Turn volume up for media player. | Turn volume up for media player. | async def async_volume_up(self):
"""Turn volume up for media player."""
await self._state.inc_volume()
self.async_write_ha_state() | [
"async",
"def",
"async_volume_up",
"(",
"self",
")",
":",
"await",
"self",
".",
"_state",
".",
"inc_volume",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
202,
4
] | [
205,
35
] | python | en | ['en', 'no', 'en'] | True |
ArcamFmj.async_volume_down | (self) | Turn volume up for media player. | Turn volume up for media player. | async def async_volume_down(self):
"""Turn volume up for media player."""
await self._state.dec_volume()
self.async_write_ha_state() | [
"async",
"def",
"async_volume_down",
"(",
"self",
")",
":",
"await",
"self",
".",
"_state",
".",
"dec_volume",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
207,
4
] | [
210,
35
] | python | en | ['en', 'no', 'en'] | True |
ArcamFmj.async_turn_on | (self) | Turn the media player on. | Turn the media player on. | async def async_turn_on(self):
"""Turn the media player on."""
if self._state.get_power() is not None:
_LOGGER.debug("Turning on device using connection")
await self._state.set_power(True)
else:
_LOGGER.debug("Firing event to turn on device")
self.... | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
".",
"get_power",
"(",
")",
"is",
"not",
"None",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Turning on device using connection\"",
")",
"await",
"self",
".",
"_state",
".",
"se... | [
212,
4
] | [
219,
85
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.async_turn_off | (self) | Turn the media player off. | Turn the media player off. | async def async_turn_off(self):
"""Turn the media player off."""
await self._state.set_power(False) | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
":",
"await",
"self",
".",
"_state",
".",
"set_power",
"(",
"False",
")"
] | [
221,
4
] | [
223,
42
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.async_browse_media | (self, media_content_type=None, media_content_id=None) | Implement the websocket media browsing helper. | Implement the websocket media browsing helper. | async def async_browse_media(self, media_content_type=None, media_content_id=None):
"""Implement the websocket media browsing helper."""
if media_content_id not in (None, "root"):
raise BrowseError(
f"Media not found: {media_content_type} / {media_content_id}"
)
... | [
"async",
"def",
"async_browse_media",
"(",
"self",
",",
"media_content_type",
"=",
"None",
",",
"media_content_id",
"=",
"None",
")",
":",
"if",
"media_content_id",
"not",
"in",
"(",
"None",
",",
"\"root\"",
")",
":",
"raise",
"BrowseError",
"(",
"f\"Media not... | [
225,
4
] | [
256,
19
] | python | en | ['en', 'af', 'en'] | True |
ArcamFmj.async_play_media | (self, media_type: str, media_id: str, **kwargs) | Play media. | Play media. | async def async_play_media(self, media_type: str, media_id: str, **kwargs) -> None:
"""Play media."""
if media_id.startswith("preset:"):
preset = int(media_id[7:])
await self._state.set_tuner_preset(preset)
else:
_LOGGER.error("Media %s is not supported", med... | [
"async",
"def",
"async_play_media",
"(",
"self",
",",
"media_type",
":",
"str",
",",
"media_id",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"if",
"media_id",
".",
"startswith",
"(",
"\"preset:\"",
")",
":",
"preset",
"=",
"int",
"(",
... | [
258,
4
] | [
266,
18
] | python | en | ['en', 'sv', 'en'] | False |
ArcamFmj.source | (self) | Return the current input source. | Return the current input source. | def source(self):
"""Return the current input source."""
value = self._state.get_source()
if value is None:
return None
return value.name | [
"def",
"source",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_state",
".",
"get_source",
"(",
")",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"return",
"value",
".",
"name"
] | [
269,
4
] | [
274,
25
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.source_list | (self) | List of available input sources. | List of available input sources. | def source_list(self):
"""List of available input sources."""
return [x.name for x in self._state.get_source_list()] | [
"def",
"source_list",
"(",
"self",
")",
":",
"return",
"[",
"x",
".",
"name",
"for",
"x",
"in",
"self",
".",
"_state",
".",
"get_source_list",
"(",
")",
"]"
] | [
277,
4
] | [
279,
62
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.sound_mode | (self) | Name of the current sound mode. | Name of the current sound mode. | def sound_mode(self):
"""Name of the current sound mode."""
if self._state.zn != 1:
return None
if self._get_2ch():
value = self._state.get_decode_mode_2ch()
else:
value = self._state.get_decode_mode_mch()
if value:
return value.na... | [
"def",
"sound_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
".",
"zn",
"!=",
"1",
":",
"return",
"None",
"if",
"self",
".",
"_get_2ch",
"(",
")",
":",
"value",
"=",
"self",
".",
"_state",
".",
"get_decode_mode_2ch",
"(",
")",
"else",
"... | [
282,
4
] | [
293,
19
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.sound_mode_list | (self) | List of available sound modes. | List of available sound modes. | def sound_mode_list(self):
"""List of available sound modes."""
if self._state.zn != 1:
return None
if self._get_2ch():
return [x.name for x in DecodeMode2CH]
return [x.name for x in DecodeModeMCH] | [
"def",
"sound_mode_list",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
".",
"zn",
"!=",
"1",
":",
"return",
"None",
"if",
"self",
".",
"_get_2ch",
"(",
")",
":",
"return",
"[",
"x",
".",
"name",
"for",
"x",
"in",
"DecodeMode2CH",
"]",
"retur... | [
296,
4
] | [
303,
46
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.is_volume_muted | (self) | Boolean if volume is currently muted. | Boolean if volume is currently muted. | def is_volume_muted(self):
"""Boolean if volume is currently muted."""
value = self._state.get_mute()
if value is None:
return None
return value | [
"def",
"is_volume_muted",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_state",
".",
"get_mute",
"(",
")",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"return",
"value"
] | [
306,
4
] | [
311,
20
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.volume_level | (self) | Volume level of device. | Volume level of device. | def volume_level(self):
"""Volume level of device."""
value = self._state.get_volume()
if value is None:
return None
return value / 99.0 | [
"def",
"volume_level",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_state",
".",
"get_volume",
"(",
")",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"return",
"value",
"/",
"99.0"
] | [
314,
4
] | [
319,
27
] | python | en | ['en', 'sr', 'en'] | True |
ArcamFmj.media_content_type | (self) | Content type of current playing media. | Content type of current playing media. | def media_content_type(self):
"""Content type of current playing media."""
source = self._state.get_source()
if source == SourceCodes.DAB:
value = MEDIA_TYPE_MUSIC
elif source == SourceCodes.FM:
value = MEDIA_TYPE_MUSIC
else:
value = None
... | [
"def",
"media_content_type",
"(",
"self",
")",
":",
"source",
"=",
"self",
".",
"_state",
".",
"get_source",
"(",
")",
"if",
"source",
"==",
"SourceCodes",
".",
"DAB",
":",
"value",
"=",
"MEDIA_TYPE_MUSIC",
"elif",
"source",
"==",
"SourceCodes",
".",
"FM",... | [
322,
4
] | [
331,
20
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.media_content_id | (self) | Content type of current playing media. | Content type of current playing media. | def media_content_id(self):
"""Content type of current playing media."""
source = self._state.get_source()
if source in (SourceCodes.DAB, SourceCodes.FM):
preset = self._state.get_tuner_preset()
if preset:
value = f"preset:{preset}"
else:
... | [
"def",
"media_content_id",
"(",
"self",
")",
":",
"source",
"=",
"self",
".",
"_state",
".",
"get_source",
"(",
")",
"if",
"source",
"in",
"(",
"SourceCodes",
".",
"DAB",
",",
"SourceCodes",
".",
"FM",
")",
":",
"preset",
"=",
"self",
".",
"_state",
... | [
334,
4
] | [
346,
20
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.media_channel | (self) | Channel currently playing. | Channel currently playing. | def media_channel(self):
"""Channel currently playing."""
source = self._state.get_source()
if source == SourceCodes.DAB:
value = self._state.get_dab_station()
elif source == SourceCodes.FM:
value = self._state.get_rds_information()
else:
value... | [
"def",
"media_channel",
"(",
"self",
")",
":",
"source",
"=",
"self",
".",
"_state",
".",
"get_source",
"(",
")",
"if",
"source",
"==",
"SourceCodes",
".",
"DAB",
":",
"value",
"=",
"self",
".",
"_state",
".",
"get_dab_station",
"(",
")",
"elif",
"sour... | [
349,
4
] | [
358,
20
] | python | en | ['en', 'en', 'en'] | True |
ArcamFmj.media_artist | (self) | Artist of current playing media, music track only. | Artist of current playing media, music track only. | def media_artist(self):
"""Artist of current playing media, music track only."""
source = self._state.get_source()
if source == SourceCodes.DAB:
value = self._state.get_dls_pdt()
else:
value = None
return value | [
"def",
"media_artist",
"(",
"self",
")",
":",
"source",
"=",
"self",
".",
"_state",
".",
"get_source",
"(",
")",
"if",
"source",
"==",
"SourceCodes",
".",
"DAB",
":",
"value",
"=",
"self",
".",
"_state",
".",
"get_dls_pdt",
"(",
")",
"else",
":",
"va... | [
361,
4
] | [
368,
20
] | 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.