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_input_number_context | (hass, hass_admin_user) | Test that input_number context works. | Test that input_number context works. | async def test_input_number_context(hass, hass_admin_user):
"""Test that input_number context works."""
assert await async_setup_component(
hass, "input_number", {"input_number": {"b1": {"min": 0, "max": 100}}}
)
state = hass.states.get("input_number.b1")
assert state is not None
await... | [
"async",
"def",
"test_input_number_context",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"input_number\"",
",",
"{",
"\"input_number\"",
":",
"{",
"\"b1\"",
":",
"{",
"\"min\"",
":",
"0",
",",
... | [
275,
0
] | [
295,
55
] | python | en | ['en', 'en', 'en'] | True |
test_reload | (hass, hass_admin_user, hass_read_only_user) | Test reload service. | Test reload service. | async def test_reload(hass, hass_admin_user, hass_read_only_user):
"""Test reload service."""
count_start = len(hass.states.async_entity_ids())
ent_reg = await entity_registry.async_get_registry(hass)
assert await async_setup_component(
hass,
DOMAIN,
{
DOMAIN: {
... | [
"async",
"def",
"test_reload",
"(",
"hass",
",",
"hass_admin_user",
",",
"hass_read_only_user",
")",
":",
"count_start",
"=",
"len",
"(",
"hass",
".",
"states",
".",
"async_entity_ids",
"(",
")",
")",
"ent_reg",
"=",
"await",
"entity_registry",
".",
"async_get... | [
298,
0
] | [
367,
72
] | python | en | ['en', 'da', 'en'] | True |
test_load_from_storage | (hass, storage_setup) | Test set up from storage. | Test set up from storage. | async def test_load_from_storage(hass, storage_setup):
"""Test set up from storage."""
assert await storage_setup()
state = hass.states.get(f"{DOMAIN}.from_storage")
assert float(state.state) == 10
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "from storage"
assert state.attributes.get(ATTR... | [
"async",
"def",
"test_load_from_storage",
"(",
"hass",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"f\"{DOMAIN}.from_storage\"",
")",
"assert",
"float",
"(",
"state",
".",
... | [
370,
0
] | [
376,
46
] | python | en | ['en', 'en', 'en'] | True |
test_editable_state_attribute | (hass, storage_setup) | Test editable attribute. | Test editable attribute. | async def test_editable_state_attribute(hass, storage_setup):
"""Test editable attribute."""
assert await storage_setup(
config={
DOMAIN: {
"from_yaml": {
"min": 1,
"max": 10,
"initial": 5,
"step"... | [
"async",
"def",
"test_editable_state_attribute",
"(",
"hass",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"from_yaml\"",
":",
"{",
"\"min\"",
":",
"1",
",",
"\"max\"",
":",
"10",
",",
"... | [
379,
0
] | [
402,
50
] | python | de | ['de', 'et', 'en'] | False |
test_ws_list | (hass, hass_ws_client, storage_setup) | Test listing via WS. | Test listing via WS. | async def test_ws_list(hass, hass_ws_client, storage_setup):
"""Test listing via WS."""
assert await storage_setup(
config={
DOMAIN: {
"from_yaml": {
"min": 1,
"max": 10,
"initial": 5,
"step": 1,
... | [
"async",
"def",
"test_ws_list",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
"config",
"=",
"{",
"DOMAIN",
":",
"{",
"\"from_yaml\"",
":",
"{",
"\"min\"",
":",
"1",
",",
"\"max\"",
":",
"10",
... | [
405,
0
] | [
434,
59
] | python | hmn | ['nl', 'hmn', 'it'] | False |
test_ws_delete | (hass, hass_ws_client, storage_setup) | Test WS delete cleans up entity registry. | Test WS delete cleans up entity registry. | async def test_ws_delete(hass, hass_ws_client, storage_setup):
"""Test WS delete cleans up entity registry."""
assert await storage_setup()
input_id = "from_storage"
input_entity_id = f"{DOMAIN}.{input_id}"
ent_reg = await entity_registry.async_get_registry(hass)
state = hass.states.get(input_... | [
"async",
"def",
"test_ws_delete",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
")",
"input_id",
"=",
"\"from_storage\"",
"input_entity_id",
"=",
"f\"{DOMAIN}.{input_id}\"",
"ent_reg",
"=",
"await",
"ent... | [
437,
0
] | [
459,
72
] | python | en | ['en', 'en', 'en'] | True |
test_update_min_max | (hass, hass_ws_client, storage_setup) | Test updating min/max updates the state. | Test updating min/max updates the state. | async def test_update_min_max(hass, hass_ws_client, storage_setup):
"""Test updating min/max updates the state."""
items = [
{
"id": "from_storage",
"name": "from storage",
"max": 100,
"min": 0,
"step": 1,
"mode": "slider",
... | [
"async",
"def",
"test_update_min_max",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"items",
"=",
"[",
"{",
"\"id\"",
":",
"\"from_storage\"",
",",
"\"name\"",
":",
"\"from storage\"",
",",
"\"max\"",
":",
"100",
",",
"\"min\"",
":",
"... | [
462,
0
] | [
510,
34
] | python | en | ['en', 'en', 'en'] | True |
test_ws_create | (hass, hass_ws_client, storage_setup) | Test create WS. | Test create WS. | async def test_ws_create(hass, hass_ws_client, storage_setup):
"""Test create WS."""
assert await storage_setup(items=[])
input_id = "new_input"
input_entity_id = f"{DOMAIN}.{input_id}"
ent_reg = await entity_registry.async_get_registry(hass)
state = hass.states.get(input_entity_id)
assert... | [
"async",
"def",
"test_ws_create",
"(",
"hass",
",",
"hass_ws_client",
",",
"storage_setup",
")",
":",
"assert",
"await",
"storage_setup",
"(",
"items",
"=",
"[",
"]",
")",
"input_id",
"=",
"\"new_input\"",
"input_entity_id",
"=",
"f\"{DOMAIN}.{input_id}\"",
"ent_r... | [
513,
0
] | [
543,
35
] | python | en | ['en', 'gd', 'en'] | True |
test_setup_no_config | (hass, hass_admin_user) | Test component setup with no config. | Test component setup with no config. | async def test_setup_no_config(hass, hass_admin_user):
"""Test component setup with no config."""
count_start = len(hass.states.async_entity_ids())
assert await async_setup_component(hass, DOMAIN, {})
with patch(
"homeassistant.config.load_yaml_config_file", autospec=True, return_value={}
)... | [
"async",
"def",
"test_setup_no_config",
"(",
"hass",
",",
"hass_admin_user",
")",
":",
"count_start",
"=",
"len",
"(",
"hass",
".",
"states",
".",
"async_entity_ids",
"(",
")",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
... | [
546,
0
] | [
562,
61
] | python | en | ['en', 'pt', 'en'] | True |
test_show_form | (hass) | Test we get the form. | Test we get the form. | async def test_show_form(hass):
"""Test we get the form."""
await setup.async_setup_component(hass, "persistent_notification", {})
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE... | [
"async",
"def",
"test_show_form",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",... | [
33,
0
] | [
40,
38
] | python | en | ['en', 'en', 'en'] | True |
test_device_step_form | (hass) | Test we get the second step of config. | Test we get the second step of config. | async def test_device_step_form(hass):
"""Test we get the second step of config."""
with patch(
"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list",
return_value=[DEVICE],
):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"so... | [
"async",
"def",
"test_device_step_form",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list\"",
",",
"return_value",
"=",
"[",
"DEVICE",
"]",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
... | [
43,
0
] | [
54,
40
] | python | en | ['en', 'en', 'en'] | True |
test_create_entry | (hass) | Test entity creation from device step. | Test entity creation from device step. | async def test_create_entry(hass):
"""Test entity creation from device step."""
with patch(
"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list",
return_value=[DEVICE],
), patch("homeassistant.components.wolflink.async_setup_entry", return_value=True):
result ... | [
"async",
"def",
"test_create_entry",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list\"",
",",
"return_value",
"=",
"[",
"DEVICE",
"]",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.wolfl... | [
57,
0
] | [
74,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_invalid_auth | (hass) | Test we handle invalid auth. | Test we handle invalid auth. | async def test_form_invalid_auth(hass):
"""Test we handle invalid auth."""
with patch(
"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list",
side_effect=InvalidAuth,
):
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": ... | [
"async",
"def",
"test_form_invalid_auth",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list\"",
",",
"side_effect",
"=",
"InvalidAuth",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_e... | [
77,
0
] | [
88,
55
] | python | en | ['en', 'en', 'en'] | True |
test_form_cannot_connect | (hass) | Test we handle cannot connect error. | Test we handle cannot connect error. | async def test_form_cannot_connect(hass):
"""Test we handle cannot connect error."""
with patch(
"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list",
side_effect=ConnectError,
):
result = await hass.config_entries.flow.async_init(
DOMAIN, context=... | [
"async",
"def",
"test_form_cannot_connect",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list\"",
",",
"side_effect",
"=",
"ConnectError",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
"confi... | [
91,
0
] | [
102,
57
] | python | en | ['en', 'en', 'en'] | True |
test_form_unknown_exception | (hass) | Test we handle cannot connect error. | Test we handle cannot connect error. | async def test_form_unknown_exception(hass):
"""Test we handle cannot connect error."""
with patch(
"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list",
side_effect=Exception,
):
result = await hass.config_entries.flow.async_init(
DOMAIN, context=... | [
"async",
"def",
"test_form_unknown_exception",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list\"",
",",
"side_effect",
"=",
"Exception",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
"confi... | [
105,
0
] | [
116,
50
] | python | en | ['en', 'en', 'en'] | True |
test_already_configured_error | (hass) | Test already configured while creating entry. | Test already configured while creating entry. | async def test_already_configured_error(hass):
"""Test already configured while creating entry."""
with patch(
"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list",
return_value=[DEVICE],
), patch("homeassistant.components.wolflink.async_setup_entry", return_value=Tru... | [
"async",
"def",
"test_already_configured_error",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.wolflink.config_flow.WolfClient.fetch_system_list\"",
",",
"return_value",
"=",
"[",
"DEVICE",
"]",
",",
")",
",",
"patch",
"(",
"\"homeassistant.comp... | [
119,
0
] | [
140,
64
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the PCAL9535A devices. | Set up the PCAL9535A devices. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the PCAL9535A devices."""
invert_logic = config[CONF_INVERT_LOGIC]
i2c_address = config[CONF_I2C_ADDRESS]
bus = config[CONF_I2C_BUS]
pcal = PCAL9535A(bus, i2c_address)
switches = []
pins = config[CONF_PINS]
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"invert_logic",
"=",
"config",
"[",
"CONF_INVERT_LOGIC",
"]",
"i2c_address",
"=",
"config",
"[",
"CONF_I2C_ADDRESS",
"]",
"bus",
"=",
"confi... | [
39,
0
] | [
53,
26
] | python | en | ['en', 'en', 'en'] | True |
PCAL9535ASwitch.__init__ | (self, name, pin, invert_logic) | Initialize the pin. | Initialize the pin. | def __init__(self, name, pin, invert_logic):
"""Initialize the pin."""
self._name = name or DEVICE_DEFAULT_NAME
self._pin = pin
self._pin.inverted = invert_logic
self._pin.input = False
self._state = self._pin.level | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"pin",
",",
"invert_logic",
")",
":",
"self",
".",
"_name",
"=",
"name",
"or",
"DEVICE_DEFAULT_NAME",
"self",
".",
"_pin",
"=",
"pin",
"self",
".",
"_pin",
".",
"inverted",
"=",
"invert_logic",
"self",
... | [
59,
4
] | [
65,
37
] | python | en | ['en', 'en', 'en'] | True |
PCAL9535ASwitch.name | (self) | Return the name of the switch. | Return the name of the switch. | def name(self):
"""Return the name of the switch."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
68,
4
] | [
70,
25
] | python | en | ['en', 'en', 'en'] | True |
PCAL9535ASwitch.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
73,
4
] | [
75,
20
] | python | en | ['en', 'en', 'en'] | True |
PCAL9535ASwitch.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
78,
4
] | [
80,
26
] | python | en | ['en', 'fy', 'en'] | True |
PCAL9535ASwitch.assumed_state | (self) | Return true if optimistic updates are used. | Return true if optimistic updates are used. | def assumed_state(self):
"""Return true if optimistic updates are used."""
return True | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"True"
] | [
83,
4
] | [
85,
19
] | python | en | ['en', 'la', 'en'] | True |
PCAL9535ASwitch.turn_on | (self, **kwargs) | Turn the device on. | Turn the device on. | def turn_on(self, **kwargs):
"""Turn the device on."""
self._pin.level = True
self._state = True
self.schedule_update_ha_state() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_pin",
".",
"level",
"=",
"True",
"self",
".",
"_state",
"=",
"True",
"self",
".",
"schedule_update_ha_state",
"(",
")"
] | [
87,
4
] | [
91,
39
] | python | en | ['en', 'en', 'en'] | True |
PCAL9535ASwitch.turn_off | (self, **kwargs) | Turn the device off. | Turn the device off. | def turn_off(self, **kwargs):
"""Turn the device off."""
self._pin.level = False
self._state = False
self.schedule_update_ha_state() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_pin",
".",
"level",
"=",
"False",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"schedule_update_ha_state",
"(",
")"
] | [
93,
4
] | [
97,
39
] | python | en | ['en', 'en', 'en'] | True |
test_issur_melacha_sensor | (
hass,
legacy_patchable_time,
now,
candle_lighting,
havdalah,
diaspora,
tzname,
latitude,
longitude,
result,
) | Test Issur Melacha sensor output. | Test Issur Melacha sensor output. | async def test_issur_melacha_sensor(
hass,
legacy_patchable_time,
now,
candle_lighting,
havdalah,
diaspora,
tzname,
latitude,
longitude,
result,
):
"""Test Issur Melacha sensor output."""
time_zone = dt_util.get_time_zone(tzname)
test_time = time_zone.localize(now)
... | [
"async",
"def",
"test_issur_melacha_sensor",
"(",
"hass",
",",
"legacy_patchable_time",
",",
"now",
",",
"candle_lighting",
",",
"havdalah",
",",
"diaspora",
",",
"tzname",
",",
"latitude",
",",
"longitude",
",",
"result",
",",
")",
":",
"time_zone",
"=",
"dt_... | [
66,
0
] | [
129,
45
] | python | en | ['es', 'no', 'en'] | False |
get_total_num_weights | (model, op_types=['default']) |
calculate the total number of weights
Returns
-------
int
total weights of all the op considered
|
calculate the total number of weights | def get_total_num_weights(model, op_types=['default']):
'''
calculate the total number of weights
Returns
-------
int
total weights of all the op considered
'''
num_weights = 0
for _, module in model.named_modules():
if module == m... | [
"def",
"get_total_num_weights",
"(",
"model",
",",
"op_types",
"=",
"[",
"'default'",
"]",
")",
":",
"num_weights",
"=",
"0",
"for",
"_",
",",
"module",
"in",
"model",
".",
"named_modules",
"(",
")",
":",
"if",
"module",
"==",
"model",
":",
"continue",
... | [
0,
0
] | [
15,
26
] | python | en | ['en', 'error', 'th'] | False |
setup_comp | (hass, mqtt_mock) | Initialize components. | Initialize components. | def setup_comp(hass, mqtt_mock):
"""Initialize components."""
yaml_devices = hass.config.path(YAML_DEVICES)
yield
if os.path.isfile(yaml_devices):
os.remove(yaml_devices) | [
"def",
"setup_comp",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"yaml_devices",
"=",
"hass",
".",
"config",
".",
"path",
"(",
"YAML_DEVICES",
")",
"yield",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"yaml_devices",
")",
":",
"os",
".",
"remove",
"(",
... | [
28,
0
] | [
33,
31
] | python | en | ['de', 'en', 'en'] | False |
test_ensure_device_tracker_platform_validation | (hass) | Test if platform validation was done. | Test if platform validation was done. | async def test_ensure_device_tracker_platform_validation(hass):
"""Test if platform validation was done."""
async def mock_setup_scanner(hass, config, see, discovery_info=None):
"""Check that Qos was added by validation."""
assert "qos" in config
with patch(
"homeassistant.componen... | [
"async",
"def",
"test_ensure_device_tracker_platform_validation",
"(",
"hass",
")",
":",
"async",
"def",
"mock_setup_scanner",
"(",
"hass",
",",
"config",
",",
"see",
",",
"discovery_info",
"=",
"None",
")",
":",
"\"\"\"Check that Qos was added by validation.\"\"\"",
"a... | [
36,
0
] | [
56,
38
] | python | en | ['en', 'de', 'en'] | True |
test_json_message | (hass) | Test json location message. | Test json location message. | async def test_json_message(hass):
"""Test json location message."""
dev_id = "zanzito"
topic = "location/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await async_setup_component(
hass,
DT_DOMAIN,
{DT_DOMAIN: {CONF_PLATFORM: "mqtt_json", "devices": {dev_id: topic}... | [
"async",
"def",
"test_json_message",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"json",
".",
"dumps",
"(",
"LOCATION_MESSAGE",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DT... | [
59,
0
] | [
74,
51
] | python | en | ['es', 'fr', 'en'] | False |
test_non_json_message | (hass, caplog) | Test receiving a non JSON message. | Test receiving a non JSON message. | async def test_non_json_message(hass, caplog):
"""Test receiving a non JSON message."""
dev_id = "zanzito"
topic = "location/zanzito"
location = "home"
assert await async_setup_component(
hass,
DT_DOMAIN,
{DT_DOMAIN: {CONF_PLATFORM: "mqtt_json", "devices": {dev_id: topic}}},... | [
"async",
"def",
"test_non_json_message",
"(",
"hass",
",",
"caplog",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"\"home\"",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"DT_DOMAIN",
",",
"{",
"... | [
77,
0
] | [
93,
60
] | python | en | ['en', 'fr', 'en'] | True |
test_incomplete_message | (hass, caplog) | Test receiving an incomplete message. | Test receiving an incomplete message. | async def test_incomplete_message(hass, caplog):
"""Test receiving an incomplete message."""
dev_id = "zanzito"
topic = "location/zanzito"
location = json.dumps(LOCATION_MESSAGE_INCOMPLETE)
assert await async_setup_component(
hass,
DT_DOMAIN,
{DT_DOMAIN: {CONF_PLATFORM: "mqt... | [
"async",
"def",
"test_incomplete_message",
"(",
"hass",
",",
"caplog",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"json",
".",
"dumps",
"(",
"LOCATION_MESSAGE_INCOMPLETE",
")",
"assert",
"await",
"async_setup_compo... | [
96,
0
] | [
115,
5
] | python | en | ['en', 'en', 'en'] | True |
test_single_level_wildcard_topic | (hass) | Test single level wildcard topic. | Test single level wildcard topic. | async def test_single_level_wildcard_topic(hass):
"""Test single level wildcard topic."""
dev_id = "zanzito"
subscription = "location/+/zanzito"
topic = "location/room/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await async_setup_component(
hass,
DT_DOMAIN,
{... | [
"async",
"def",
"test_single_level_wildcard_topic",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"subscription",
"=",
"\"location/+/zanzito\"",
"topic",
"=",
"\"location/room/zanzito\"",
"location",
"=",
"json",
".",
"dumps",
"(",
"LOCATION_MESSAGE",
")",
"ass... | [
118,
0
] | [
134,
51
] | python | en | ['en', 'en', 'en'] | True |
test_multi_level_wildcard_topic | (hass) | Test multi level wildcard topic. | Test multi level wildcard topic. | async def test_multi_level_wildcard_topic(hass):
"""Test multi level wildcard topic."""
dev_id = "zanzito"
subscription = "location/#"
topic = "location/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await async_setup_component(
hass,
DT_DOMAIN,
{DT_DOMAIN: {CON... | [
"async",
"def",
"test_multi_level_wildcard_topic",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"subscription",
"=",
"\"location/#\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"json",
".",
"dumps",
"(",
"LOCATION_MESSAGE",
")",
"assert",
"await... | [
137,
0
] | [
153,
51
] | python | en | ['en', 'en', 'en'] | True |
test_single_level_wildcard_topic_not_matching | (hass) | Test not matching single level wildcard topic. | Test not matching single level wildcard topic. | async def test_single_level_wildcard_topic_not_matching(hass):
"""Test not matching single level wildcard topic."""
dev_id = "zanzito"
entity_id = f"{DT_DOMAIN}.{dev_id}"
subscription = "location/+/zanzito"
topic = "location/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await asyn... | [
"async",
"def",
"test_single_level_wildcard_topic_not_matching",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"entity_id",
"=",
"f\"{DT_DOMAIN}.{dev_id}\"",
"subscription",
"=",
"\"location/+/zanzito\"",
"topic",
"=",
"\"location/zanzito\"",
"location",
"=",
"json",... | [
156,
0
] | [
171,
45
] | python | en | ['en', 'en', 'en'] | True |
test_multi_level_wildcard_topic_not_matching | (hass) | Test not matching multi level wildcard topic. | Test not matching multi level wildcard topic. | async def test_multi_level_wildcard_topic_not_matching(hass):
"""Test not matching multi level wildcard topic."""
dev_id = "zanzito"
entity_id = f"{DT_DOMAIN}.{dev_id}"
subscription = "location/#"
topic = "somewhere/zanzito"
location = json.dumps(LOCATION_MESSAGE)
assert await async_setup_c... | [
"async",
"def",
"test_multi_level_wildcard_topic_not_matching",
"(",
"hass",
")",
":",
"dev_id",
"=",
"\"zanzito\"",
"entity_id",
"=",
"f\"{DT_DOMAIN}.{dev_id}\"",
"subscription",
"=",
"\"location/#\"",
"topic",
"=",
"\"somewhere/zanzito\"",
"location",
"=",
"json",
".",
... | [
174,
0
] | [
189,
45
] | python | en | ['en', 'en', 'en'] | True |
mock_impl | (hass) | Mock implementation. | Mock implementation. | async def mock_impl(hass):
"""Mock implementation."""
await setup.async_setup_component(hass, "http", {})
impl = config_entry_oauth2_flow.LocalOAuth2Implementation(
hass,
DOMAIN,
CLIENT_ID_VALUE,
CLIENT_SECRET_VALUE,
"https://accounts.somfy.com/oauth/oauth/v2/auth",
... | [
"async",
"def",
"mock_impl",
"(",
"hass",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"http\"",
",",
"{",
"}",
")",
"impl",
"=",
"config_entry_oauth2_flow",
".",
"LocalOAuth2Implementation",
"(",
"hass",
",",
"DOMAIN",
",",
... | [
18,
0
] | [
31,
15
] | python | en | ['en', 'da', 'en'] | False |
test_abort_if_no_configuration | (hass) | Check flow abort when no configuration. | Check flow abort when no configuration. | async def test_abort_if_no_configuration(hass):
"""Check flow abort when no configuration."""
flow = config_flow.SomfyFlowHandler()
flow.hass = hass
result = await flow.async_step_user()
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "missing_configuration" | [
"async",
"def",
"test_abort_if_no_configuration",
"(",
"hass",
")",
":",
"flow",
"=",
"config_flow",
".",
"SomfyFlowHandler",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"result",
"=",
"await",
"flow",
".",
"async_step_user",
"(",
")",
"assert",
"result",
"[... | [
34,
0
] | [
40,
54
] | python | en | ['en', 'fr', 'en'] | True |
test_abort_if_existing_entry | (hass) | Check flow abort when an entry already exist. | Check flow abort when an entry already exist. | async def test_abort_if_existing_entry(hass):
"""Check flow abort when an entry already exist."""
flow = config_flow.SomfyFlowHandler()
flow.hass = hass
MockConfigEntry(domain=DOMAIN).add_to_hass(hass)
result = await flow.async_step_user()
assert result["type"] == data_entry_flow.RESULT_TYPE_AB... | [
"async",
"def",
"test_abort_if_existing_entry",
"(",
"hass",
")",
":",
"flow",
"=",
"config_flow",
".",
"SomfyFlowHandler",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
")",
".",
"add_to_hass",
"(",
"hass",
")"... | [
43,
0
] | [
51,
56
] | python | en | ['en', 'en', 'en'] | True |
test_full_flow | (hass, aiohttp_client, aioclient_mock, current_request) | Check full flow. | Check full flow. | async def test_full_flow(hass, aiohttp_client, aioclient_mock, current_request):
"""Check full flow."""
assert await setup.async_setup_component(
hass,
DOMAIN,
{
DOMAIN: {
CONF_CLIENT_ID: CLIENT_ID_VALUE,
CONF_CLIENT_SECRET: CLIENT_SECRET_VALUE... | [
"async",
"def",
"test_full_flow",
"(",
"hass",
",",
"aiohttp_client",
",",
"aioclient_mock",
",",
"current_request",
")",
":",
"assert",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"DOMAIN",
",",
"{",
"DOMAIN",
":",
"{",
"CONF_CLIENT_ID",
... | [
54,
0
] | [
114,
63
] | python | en | ['sv', 'no', 'en'] | False |
test_abort_if_authorization_timeout | (hass, mock_impl) | Check Somfy authorization timeout. | Check Somfy authorization timeout. | async def test_abort_if_authorization_timeout(hass, mock_impl):
"""Check Somfy authorization timeout."""
flow = config_flow.SomfyFlowHandler()
flow.hass = hass
with patch.object(
mock_impl, "async_generate_authorize_url", side_effect=asyncio.TimeoutError
):
result = await flow.async... | [
"async",
"def",
"test_abort_if_authorization_timeout",
"(",
"hass",
",",
"mock_impl",
")",
":",
"flow",
"=",
"config_flow",
".",
"SomfyFlowHandler",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"with",
"patch",
".",
"object",
"(",
"mock_impl",
",",
"\"async_gen... | [
117,
0
] | [
128,
54
] | python | en | ['en', 'en', 'en'] | True |
test_set_temp_schema_no_req | (hass, caplog) | Test the set temperature schema with missing required data. | Test the set temperature schema with missing required data. | async def test_set_temp_schema_no_req(hass, caplog):
"""Test the set temperature schema with missing required data."""
domain = "climate"
service = "test_set_temperature"
schema = SET_TEMPERATURE_SCHEMA
calls = async_mock_service(hass, domain, service, schema)
data = {"hvac_mode": "off", "entit... | [
"async",
"def",
"test_set_temp_schema_no_req",
"(",
"hass",
",",
"caplog",
")",
":",
"domain",
"=",
"\"climate\"",
"service",
"=",
"\"test_set_temperature\"",
"schema",
"=",
"SET_TEMPERATURE_SCHEMA",
"calls",
"=",
"async_mock_service",
"(",
"hass",
",",
"domain",
",... | [
18,
0
] | [
30,
26
] | python | en | ['en', 'en', 'en'] | True |
test_set_temp_schema | (hass, caplog) | Test the set temperature schema with ok required data. | Test the set temperature schema with ok required data. | async def test_set_temp_schema(hass, caplog):
"""Test the set temperature schema with ok required data."""
domain = "climate"
service = "test_set_temperature"
schema = SET_TEMPERATURE_SCHEMA
calls = async_mock_service(hass, domain, service, schema)
data = {"temperature": 20.0, "hvac_mode": "hea... | [
"async",
"def",
"test_set_temp_schema",
"(",
"hass",
",",
"caplog",
")",
":",
"domain",
"=",
"\"climate\"",
"service",
"=",
"\"test_set_temperature\"",
"schema",
"=",
"SET_TEMPERATURE_SCHEMA",
"calls",
"=",
"async_mock_service",
"(",
"hass",
",",
"domain",
",",
"s... | [
33,
0
] | [
45,
33
] | python | en | ['en', 'de', 'en'] | True |
test_sync_turn_on | (hass) | Test if async turn_on calls sync turn_on. | Test if async turn_on calls sync turn_on. | async def test_sync_turn_on(hass):
"""Test if async turn_on calls sync turn_on."""
climate = MockClimateEntity()
climate.hass = hass
climate.turn_on = MagicMock()
await climate.async_turn_on()
assert climate.turn_on.called | [
"async",
"def",
"test_sync_turn_on",
"(",
"hass",
")",
":",
"climate",
"=",
"MockClimateEntity",
"(",
")",
"climate",
".",
"hass",
"=",
"hass",
"climate",
".",
"turn_on",
"=",
"MagicMock",
"(",
")",
"await",
"climate",
".",
"async_turn_on",
"(",
")",
"asse... | [
74,
0
] | [
82,
33
] | python | en | ['en', 'cy', 'en'] | True |
test_sync_turn_off | (hass) | Test if async turn_off calls sync turn_off. | Test if async turn_off calls sync turn_off. | async def test_sync_turn_off(hass):
"""Test if async turn_off calls sync turn_off."""
climate = MockClimateEntity()
climate.hass = hass
climate.turn_off = MagicMock()
await climate.async_turn_off()
assert climate.turn_off.called | [
"async",
"def",
"test_sync_turn_off",
"(",
"hass",
")",
":",
"climate",
"=",
"MockClimateEntity",
"(",
")",
"climate",
".",
"hass",
"=",
"hass",
"climate",
".",
"turn_off",
"=",
"MagicMock",
"(",
")",
"await",
"climate",
".",
"async_turn_off",
"(",
")",
"a... | [
85,
0
] | [
93,
34
] | python | en | ['en', 'cy', 'en'] | True |
test_deprecated_base_class | (caplog) | Test deprecated base class. | Test deprecated base class. | def test_deprecated_base_class(caplog):
"""Test deprecated base class."""
class CustomClimate(ClimateDevice):
"""Custom climate entity class."""
@property
def hvac_mode(self):
pass
@property
def hvac_modes(self):
pass
CustomClimate()
as... | [
"def",
"test_deprecated_base_class",
"(",
"caplog",
")",
":",
"class",
"CustomClimate",
"(",
"ClimateDevice",
")",
":",
"\"\"\"Custom climate entity class.\"\"\"",
"@",
"property",
"def",
"hvac_mode",
"(",
"self",
")",
":",
"pass",
"@",
"property",
"def",
"hvac_mode... | [
96,
0
] | [
111,
77
] | python | en | ['en', 'en', 'en'] | True |
MockClimateEntity.hvac_mode | (self) | Return hvac operation ie. heat, cool mode.
Need 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.
Need to be one of HVAC_MODE_*.
"""
return HVAC_MODE_HEAT | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"return",
"HVAC_MODE_HEAT"
] | [
52,
4
] | [
57,
29
] | python | bg | ['en', 'bg', 'bg'] | True |
MockClimateEntity.hvac_modes | (self) | Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
| Return the list of available hvac operation modes. | def hvac_modes(self) -> List[str]:
"""Return the list of available hvac operation modes.
Need to be a subset of HVAC_MODES.
"""
return [HVAC_MODE_OFF, HVAC_MODE_HEAT] | [
"def",
"hvac_modes",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"[",
"HVAC_MODE_OFF",
",",
"HVAC_MODE_HEAT",
"]"
] | [
60,
4
] | [
65,
46
] | python | en | ['en', 'en', 'en'] | True |
setup | (hass: core.HomeAssistant, config: dict) | Set up the denonavr platform. | Set up the denonavr platform. | def setup(hass: core.HomeAssistant, config: dict):
"""Set up the denonavr platform."""
def service_handler(service):
method = SERVICE_TO_METHOD.get(service.service)
data = service.data.copy()
data["method"] = method["method"]
dispatcher_send(hass, DOMAIN, data)
for service ... | [
"def",
"setup",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
":",
"def",
"service_handler",
"(",
"service",
")",
":",
"method",
"=",
"SERVICE_TO_METHOD",
".",
"get",
"(",
"service",
".",
"service",
")",
"data",
"=",
... | [
39,
0
] | [
52,
15
] | python | en | ['en', 'da', 'en'] | True |
async_setup_entry | (
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
) | Set up the denonavr components from a config entry. | Set up the denonavr components from a config entry. | async def async_setup_entry(
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
):
"""Set up the denonavr components from a config entry."""
hass.data.setdefault(DOMAIN, {})
# Connect to receiver
connect_denonavr = ConnectDenonAVR(
hass,
entry.data[CONF_HOST],
DEFAU... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"# Connect to receiver",
"conne... | [
55,
0
] | [
85,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (
hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry
) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(
hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry
):
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_forward_entry_unload(
config_entry, "media_player"
)
hass.data[DOMAIN][config_entry.entry_id][UNDO_UPDATE_LISTENER]()
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
":",
"unload_ok",
"=",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"confi... | [
88,
0
] | [
114,
20
] | python | en | ['en', 'es', 'en'] | True |
update_listener | (
hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry
) | Handle options update. | Handle options update. | async def update_listener(
hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry
):
"""Handle options update."""
await hass.config_entries.async_reload(config_entry.entry_id) | [
"async",
"def",
"update_listener",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_reload",
"(",
"config_entry",
".",
"entry_id",
")"
] | [
117,
0
] | [
121,
65
] | python | en | ['en', 'nl', 'en'] | True |
device_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def device_reg(hass):
"""Return an empty, loaded, registry."""
return mock_device_registry(hass) | [
"def",
"device_reg",
"(",
"hass",
")",
":",
"return",
"mock_device_registry",
"(",
"hass",
")"
] | [
21,
0
] | [
23,
37
] | python | en | ['en', 'fy', 'en'] | True |
entity_reg | (hass) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def entity_reg(hass):
"""Return an empty, loaded, registry."""
return mock_registry(hass) | [
"def",
"entity_reg",
"(",
"hass",
")",
":",
"return",
"mock_registry",
"(",
"hass",
")"
] | [
27,
0
] | [
29,
30
] | python | en | ['en', 'fy', 'en'] | True |
calls | (hass) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass):
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
")",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
33,
0
] | [
35,
57
] | python | en | ['en', 'en', 'en'] | True |
test_get_actions | (hass, device_reg, entity_reg) | Test we get the expected actions from a remote. | Test we get the expected actions from a remote. | async def test_get_actions(hass, device_reg, entity_reg):
"""Test we get the expected actions from a remote."""
config_entry = MockConfigEntry(domain="test", data={})
config_entry.add_to_hass(hass)
device_entry = device_reg.async_get_or_create(
config_entry_id=config_entry.entry_id,
conn... | [
"async",
"def",
"test_get_actions",
"(",
"hass",
",",
"device_reg",
",",
"entity_reg",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"test\"",
",",
"data",
"=",
"{",
"}",
")",
"config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
... | [
38,
0
] | [
68,
38
] | python | en | ['en', 'en', 'en'] | True |
test_action | (hass, calls) | Test for turn_on and turn_off actions. | Test for turn_on and turn_off actions. | async def test_action(hass, calls):
"""Test for turn_on and turn_off actions."""
platform = getattr(hass.components, f"test.{DOMAIN}")
platform.init()
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
await hass.async_block_till_done()
ent1, ent2, ent3 = platf... | [
"async",
"def",
"test_action",
"(",
"hass",
",",
"calls",
")",
":",
"platform",
"=",
"getattr",
"(",
"hass",
".",
"components",
",",
"f\"test.{DOMAIN}\"",
")",
"platform",
".",
"init",
"(",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
... | [
71,
0
] | [
142,
60
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[List[Entity], bool], None],
) | Set up WLED sensor based on a config entry. | Set up WLED sensor based on a config entry. | async def async_setup_entry(
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[List[Entity], bool], None],
) -> None:
"""Set up WLED sensor based on a config entry."""
coordinator: WLEDDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
sensors = [
WLEDEst... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
"[",
"[",
"List",
"[",
"Entity",
"]",
",",
"bool",
"]",
",",
"None",
"]",
",",
")",
"->",
"None",
":... | [
21,
0
] | [
39,
37
] | python | en | ['en', 'da', 'en'] | True |
WLEDSensor.__init__ | (
self,
*,
coordinator: WLEDDataUpdateCoordinator,
enabled_default: bool = True,
entry_id: str,
icon: str,
key: str,
name: str,
unit_of_measurement: Optional[str] = None,
) | Initialize WLED sensor. | Initialize WLED sensor. | def __init__(
self,
*,
coordinator: WLEDDataUpdateCoordinator,
enabled_default: bool = True,
entry_id: str,
icon: str,
key: str,
name: str,
unit_of_measurement: Optional[str] = None,
) -> None:
"""Initialize WLED sensor."""
self... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
",",
"enabled_default",
":",
"bool",
"=",
"True",
",",
"entry_id",
":",
"str",
",",
"icon",
":",
"str",
",",
"key",
":",
"str",
",",
"name",
":",
"str",
","... | [
45,
4
] | [
66,
9
] | python | en | ['en', 'zu', 'it'] | False |
WLEDSensor.unique_id | (self) | Return the unique ID for this sensor. | Return the unique ID for this sensor. | def unique_id(self) -> str:
"""Return the unique ID for this sensor."""
return f"{self.coordinator.data.info.mac_address}_{self._key}" | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"f\"{self.coordinator.data.info.mac_address}_{self._key}\""
] | [
69,
4
] | [
71,
70
] | python | en | ['en', 'la', 'en'] | True |
WLEDSensor.unit_of_measurement | (self) | Return the unit this state is expressed in. | Return the unit this state is expressed in. | def unit_of_measurement(self) -> str:
"""Return the unit this state is expressed in."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
74,
4
] | [
76,
40
] | python | en | ['en', 'en', 'en'] | True |
WLEDEstimatedCurrentSensor.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED estimated current sensor. | Initialize WLED estimated current sensor. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED estimated current sensor."""
super().__init__(
coordinator=coordinator,
entry_id=entry_id,
icon="mdi:power",
key="estimated_current",
name=f"{... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"entry_id",
"=",
"entry_id",
",",
"i... | [
82,
4
] | [
91,
9
] | python | en | ['en', 'da', 'en'] | True |
WLEDEstimatedCurrentSensor.device_state_attributes | (self) | Return the state attributes of the entity. | Return the state attributes of the entity. | def device_state_attributes(self) -> Optional[Dict[str, Any]]:
"""Return the state attributes of the entity."""
return {
ATTR_LED_COUNT: self.coordinator.data.info.leds.count,
ATTR_MAX_POWER: self.coordinator.data.info.leds.max_power,
} | [
"def",
"device_state_attributes",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"{",
"ATTR_LED_COUNT",
":",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"leds",
".",
"count",
",",
"ATTR_... | [
94,
4
] | [
99,
9
] | python | en | ['en', 'en', 'en'] | True |
WLEDEstimatedCurrentSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self) -> int:
"""Return the state of the sensor."""
return self.coordinator.data.info.leds.power | [
"def",
"state",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"leds",
".",
"power"
] | [
102,
4
] | [
104,
52
] | python | en | ['en', 'en', 'en'] | True |
WLEDEstimatedCurrentSensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self) -> Optional[str]:
"""Return the class of this sensor."""
return DEVICE_CLASS_CURRENT | [
"def",
"device_class",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"DEVICE_CLASS_CURRENT"
] | [
107,
4
] | [
109,
35
] | python | en | ['en', 'en', 'en'] | True |
WLEDUptimeSensor.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED uptime sensor. | Initialize WLED uptime sensor. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED uptime sensor."""
super().__init__(
coordinator=coordinator,
enabled_default=False,
entry_id=entry_id,
icon="mdi:clock-outline",
key="uptime",... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"enabled_default",
"=",
"False",
",",
... | [
115,
4
] | [
124,
9
] | python | en | ['en', 'zu', 'en'] | True |
WLEDUptimeSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self) -> str:
"""Return the state of the sensor."""
uptime = utcnow() - timedelta(seconds=self.coordinator.data.info.uptime)
return uptime.replace(microsecond=0).isoformat() | [
"def",
"state",
"(",
"self",
")",
"->",
"str",
":",
"uptime",
"=",
"utcnow",
"(",
")",
"-",
"timedelta",
"(",
"seconds",
"=",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"uptime",
")",
"return",
"uptime",
".",
"replace",
"(",
"microsec... | [
127,
4
] | [
130,
56
] | python | en | ['en', 'en', 'en'] | True |
WLEDUptimeSensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self) -> Optional[str]:
"""Return the class of this sensor."""
return DEVICE_CLASS_TIMESTAMP | [
"def",
"device_class",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"DEVICE_CLASS_TIMESTAMP"
] | [
133,
4
] | [
135,
37
] | python | en | ['en', 'en', 'en'] | True |
WLEDFreeHeapSensor.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED free heap sensor. | Initialize WLED free heap sensor. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED free heap sensor."""
super().__init__(
coordinator=coordinator,
enabled_default=False,
entry_id=entry_id,
icon="mdi:memory",
key="free_heap",
... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"enabled_default",
"=",
"False",
",",
... | [
141,
4
] | [
151,
9
] | python | en | ['en', 'zh-Latn', 'en'] | True |
WLEDFreeHeapSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self) -> int:
"""Return the state of the sensor."""
return self.coordinator.data.info.free_heap | [
"def",
"state",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"free_heap"
] | [
154,
4
] | [
156,
51
] | python | en | ['en', 'en', 'en'] | True |
WLEDWifiSignalSensor.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED Wi-Fi signal sensor. | Initialize WLED Wi-Fi signal sensor. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED Wi-Fi signal sensor."""
super().__init__(
coordinator=coordinator,
enabled_default=False,
entry_id=entry_id,
icon="mdi:wifi",
key="wifi_signal... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"enabled_default",
"=",
"False",
",",
... | [
162,
4
] | [
172,
9
] | python | en | ['en', 'pl', 'it'] | False |
WLEDWifiSignalSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self) -> int:
"""Return the state of the sensor."""
return self.coordinator.data.info.wifi.signal | [
"def",
"state",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"wifi",
".",
"signal"
] | [
175,
4
] | [
177,
53
] | python | en | ['en', 'en', 'en'] | True |
WLEDWifiRSSISensor.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED Wi-Fi RSSI sensor. | Initialize WLED Wi-Fi RSSI sensor. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED Wi-Fi RSSI sensor."""
super().__init__(
coordinator=coordinator,
enabled_default=False,
entry_id=entry_id,
icon="mdi:wifi",
key="wifi_rssi",
... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"enabled_default",
"=",
"False",
",",
... | [
183,
4
] | [
193,
9
] | python | co | ['en', 'co', 'it'] | False |
WLEDWifiRSSISensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self) -> int:
"""Return the state of the sensor."""
return self.coordinator.data.info.wifi.rssi | [
"def",
"state",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"wifi",
".",
"rssi"
] | [
196,
4
] | [
198,
51
] | python | en | ['en', 'en', 'en'] | True |
WLEDWifiRSSISensor.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self) -> Optional[str]:
"""Return the class of this sensor."""
return DEVICE_CLASS_SIGNAL_STRENGTH | [
"def",
"device_class",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"DEVICE_CLASS_SIGNAL_STRENGTH"
] | [
201,
4
] | [
203,
43
] | python | en | ['en', 'en', 'en'] | True |
WLEDWifiChannelSensor.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED Wi-Fi Channel sensor. | Initialize WLED Wi-Fi Channel sensor. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED Wi-Fi Channel sensor."""
super().__init__(
coordinator=coordinator,
enabled_default=False,
entry_id=entry_id,
icon="mdi:wifi",
key="wifi_chann... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"enabled_default",
"=",
"False",
",",
... | [
209,
4
] | [
218,
9
] | python | it | ['it', 'fy', 'it'] | True |
WLEDWifiChannelSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self) -> int:
"""Return the state of the sensor."""
return self.coordinator.data.info.wifi.channel | [
"def",
"state",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"wifi",
".",
"channel"
] | [
221,
4
] | [
223,
54
] | python | en | ['en', 'en', 'en'] | True |
WLEDWifiBSSIDSensor.__init__ | (self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) | Initialize WLED Wi-Fi BSSID sensor. | Initialize WLED Wi-Fi BSSID sensor. | def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None:
"""Initialize WLED Wi-Fi BSSID sensor."""
super().__init__(
coordinator=coordinator,
enabled_default=False,
entry_id=entry_id,
icon="mdi:wifi",
key="wifi_bssid",... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"WLEDDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
"=",
"coordinator",
",",
"enabled_default",
"=",
"False",
",",
... | [
229,
4
] | [
238,
9
] | python | en | ['en', 'mt', 'it'] | False |
WLEDWifiBSSIDSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self) -> str:
"""Return the state of the sensor."""
return self.coordinator.data.info.wifi.bssid | [
"def",
"state",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
".",
"info",
".",
"wifi",
".",
"bssid"
] | [
241,
4
] | [
243,
52
] | python | en | ['en', 'en', 'en'] | True |
mock_version | () | Mock current version. | Mock current version. | def mock_version():
"""Mock current version."""
with patch("homeassistant.components.updater.current_version", MOCK_VERSION):
yield | [
"def",
"mock_version",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.updater.current_version\"",
",",
"MOCK_VERSION",
")",
":",
"yield"
] | [
20,
0
] | [
23,
13
] | python | en | ['en', 'da', 'en'] | True |
mock_get_newest_version_fixture | () | Fixture to mock get_newest_version. | Fixture to mock get_newest_version. | def mock_get_newest_version_fixture():
"""Fixture to mock get_newest_version."""
with patch(
"homeassistant.components.updater.get_newest_version",
return_value=(NEW_VERSION, RELEASE_NOTES),
) as mock:
yield mock | [
"def",
"mock_get_newest_version_fixture",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.updater.get_newest_version\"",
",",
"return_value",
"=",
"(",
"NEW_VERSION",
",",
"RELEASE_NOTES",
")",
",",
")",
"as",
"mock",
":",
"yield",
"mock"
] | [
27,
0
] | [
33,
18
] | python | en | ['en', 'en', 'en'] | True |
mock_get_uuid_fixture | () | Fixture to mock get_uuid. | Fixture to mock get_uuid. | def mock_get_uuid_fixture():
"""Fixture to mock get_uuid."""
with patch("homeassistant.helpers.instance_id.async_get") as mock:
yield mock | [
"def",
"mock_get_uuid_fixture",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.helpers.instance_id.async_get\"",
")",
"as",
"mock",
":",
"yield",
"mock"
] | [
37,
0
] | [
40,
18
] | python | en | ['en', 'nl', 'sw'] | False |
test_new_version_shows_entity_true | (
hass, mock_get_uuid, mock_get_newest_version
) | Test if sensor is true if new version is available. | Test if sensor is true if new version is available. | async def test_new_version_shows_entity_true(
hass, mock_get_uuid, mock_get_newest_version
):
"""Test if sensor is true if new version is available."""
mock_get_uuid.return_value = MOCK_HUUID
assert await async_setup_component(hass, updater.DOMAIN, {updater.DOMAIN: {}})
await hass.async_block_till... | [
"async",
"def",
"test_new_version_shows_entity_true",
"(",
"hass",
",",
"mock_get_uuid",
",",
"mock_get_newest_version",
")",
":",
"mock_get_uuid",
".",
"return_value",
"=",
"MOCK_HUUID",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"updater",
".",
"D... | [
43,
0
] | [
60,
5
] | python | en | ['en', 'en', 'en'] | True |
test_same_version_shows_entity_false | (
hass, mock_get_uuid, mock_get_newest_version
) | Test if sensor is false if no new version is available. | Test if sensor is false if no new version is available. | async def test_same_version_shows_entity_false(
hass, mock_get_uuid, mock_get_newest_version
):
"""Test if sensor is false if no new version is available."""
mock_get_uuid.return_value = MOCK_HUUID
mock_get_newest_version.return_value = (MOCK_VERSION, "")
assert await async_setup_component(hass, up... | [
"async",
"def",
"test_same_version_shows_entity_false",
"(",
"hass",
",",
"mock_get_uuid",
",",
"mock_get_newest_version",
")",
":",
"mock_get_uuid",
".",
"return_value",
"=",
"MOCK_HUUID",
"mock_get_newest_version",
".",
"return_value",
"=",
"(",
"MOCK_VERSION",
",",
"... | [
63,
0
] | [
79,
85
] | python | en | ['en', 'en', 'en'] | True |
test_disable_reporting | (hass, mock_get_uuid, mock_get_newest_version) | Test we do not gather analytics when disable reporting is active. | Test we do not gather analytics when disable reporting is active. | async def test_disable_reporting(hass, mock_get_uuid, mock_get_newest_version):
"""Test we do not gather analytics when disable reporting is active."""
mock_get_uuid.return_value = MOCK_HUUID
mock_get_newest_version.return_value = (MOCK_VERSION, "")
assert await async_setup_component(
hass, upd... | [
"async",
"def",
"test_disable_reporting",
"(",
"hass",
",",
"mock_get_uuid",
",",
"mock_get_newest_version",
")",
":",
"mock_get_uuid",
".",
"return_value",
"=",
"MOCK_HUUID",
"mock_get_newest_version",
".",
"return_value",
"=",
"(",
"MOCK_VERSION",
",",
"\"\"",
")",
... | [
82,
0
] | [
96,
26
] | python | en | ['en', 'en', 'en'] | True |
test_get_newest_version_no_analytics_when_no_huuid | (hass, aioclient_mock) | Test we do not gather analytics when no huuid is passed in. | Test we do not gather analytics when no huuid is passed in. | async def test_get_newest_version_no_analytics_when_no_huuid(hass, aioclient_mock):
"""Test we do not gather analytics when no huuid is passed in."""
aioclient_mock.post(updater.UPDATER_URL, json=MOCK_RESPONSE)
with patch(
"homeassistant.helpers.system_info.async_get_system_info", side_effect=Excep... | [
"async",
"def",
"test_get_newest_version_no_analytics_when_no_huuid",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"post",
"(",
"updater",
".",
"UPDATER_URL",
",",
"json",
"=",
"MOCK_RESPONSE",
")",
"with",
"patch",
"(",
"\"homeassistant.helper... | [
99,
0
] | [
107,
80
] | python | en | ['en', 'en', 'en'] | True |
test_get_newest_version_analytics_when_huuid | (hass, aioclient_mock) | Test we gather analytics when huuid is passed in. | Test we gather analytics when huuid is passed in. | async def test_get_newest_version_analytics_when_huuid(hass, aioclient_mock):
"""Test we gather analytics when huuid is passed in."""
aioclient_mock.post(updater.UPDATER_URL, json=MOCK_RESPONSE)
with patch(
"homeassistant.helpers.system_info.async_get_system_info",
return_value={"fake": "bl... | [
"async",
"def",
"test_get_newest_version_analytics_when_huuid",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"post",
"(",
"updater",
".",
"UPDATER_URL",
",",
"json",
"=",
"MOCK_RESPONSE",
")",
"with",
"patch",
"(",
"\"homeassistant.helpers.syst... | [
110,
0
] | [
119,
80
] | python | en | ['en', 'en', 'en'] | True |
test_error_fetching_new_version_bad_json | (hass, aioclient_mock) | Test we handle json error while fetching new version. | Test we handle json error while fetching new version. | async def test_error_fetching_new_version_bad_json(hass, aioclient_mock):
"""Test we handle json error while fetching new version."""
aioclient_mock.post(updater.UPDATER_URL, text="not json")
with patch(
"homeassistant.helpers.system_info.async_get_system_info",
return_value={"fake": "bla"}... | [
"async",
"def",
"test_error_fetching_new_version_bad_json",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"post",
"(",
"updater",
".",
"UPDATER_URL",
",",
"text",
"=",
"\"not json\"",
")",
"with",
"patch",
"(",
"\"homeassistant.helpers.system_in... | [
122,
0
] | [
130,
65
] | python | en | ['en', 'en', 'en'] | True |
test_error_fetching_new_version_invalid_response | (hass, aioclient_mock) | Test we handle response error while fetching new version. | Test we handle response error while fetching new version. | async def test_error_fetching_new_version_invalid_response(hass, aioclient_mock):
"""Test we handle response error while fetching new version."""
aioclient_mock.post(
updater.UPDATER_URL,
json={
"version": "0.15"
# 'release-notes' is missing
},
)
with pat... | [
"async",
"def",
"test_error_fetching_new_version_invalid_response",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"post",
"(",
"updater",
".",
"UPDATER_URL",
",",
"json",
"=",
"{",
"\"version\"",
":",
"\"0.15\"",
"# 'release-notes' is missing",
... | [
133,
0
] | [
147,
65
] | python | en | ['en', 'en', 'en'] | True |
test_new_version_shows_entity_after_hour_hassio | (
hass, mock_get_uuid, mock_get_newest_version
) | Test if binary sensor gets updated if new version is available / Hass.io. | Test if binary sensor gets updated if new version is available / Hass.io. | async def test_new_version_shows_entity_after_hour_hassio(
hass, mock_get_uuid, mock_get_newest_version
):
"""Test if binary sensor gets updated if new version is available / Hass.io."""
mock_get_uuid.return_value = MOCK_HUUID
mock_component(hass, "hassio")
hass.data["hassio_core_info"] = {"version_... | [
"async",
"def",
"test_new_version_shows_entity_after_hour_hassio",
"(",
"hass",
",",
"mock_get_uuid",
",",
"mock_get_newest_version",
")",
":",
"mock_get_uuid",
".",
"return_value",
"=",
"MOCK_HUUID",
"mock_component",
"(",
"hass",
",",
"\"hassio\"",
")",
"hass",
".",
... | [
150,
0
] | [
169,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass) | Set up the Hassbian config. | Set up the Hassbian config. | async def async_setup(hass):
"""Set up the Hassbian config."""
hass.http.register_view(CheckConfigView)
websocket_api.async_register_command(hass, websocket_update_config)
websocket_api.async_register_command(hass, websocket_detect_config)
return True | [
"async",
"def",
"async_setup",
"(",
"hass",
")",
":",
"hass",
".",
"http",
".",
"register_view",
"(",
"CheckConfigView",
")",
"websocket_api",
".",
"async_register_command",
"(",
"hass",
",",
"websocket_update_config",
")",
"websocket_api",
".",
"async_register_comm... | [
12,
0
] | [
17,
15
] | python | en | ['en', 'en', 'en'] | True |
websocket_update_config | (hass, connection, msg) | Handle update core config command. | Handle update core config command. | async def websocket_update_config(hass, connection, msg):
"""Handle update core config command."""
data = dict(msg)
data.pop("id")
data.pop("type")
try:
await hass.config.async_update(**data)
connection.send_result(msg["id"])
except ValueError as err:
connection.send_err... | [
"async",
"def",
"websocket_update_config",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"data",
"=",
"dict",
"(",
"msg",
")",
"data",
".",
"pop",
"(",
"\"id\"",
")",
"data",
".",
"pop",
"(",
"\"type\"",
")",
"try",
":",
"await",
"hass",
".",... | [
50,
0
] | [
60,
66
] | python | en | ['en', 'en', 'en'] | True |
websocket_detect_config | (hass, connection, msg) | Detect core config. | Detect core config. | async def websocket_detect_config(hass, connection, msg):
"""Detect core config."""
session = hass.helpers.aiohttp_client.async_get_clientsession()
location_info = await location.async_detect_location_info(session)
info = {}
if location_info is None:
connection.send_result(msg["id"], info)... | [
"async",
"def",
"websocket_detect_config",
"(",
"hass",
",",
"connection",
",",
"msg",
")",
":",
"session",
"=",
"hass",
".",
"helpers",
".",
"aiohttp_client",
".",
"async_get_clientsession",
"(",
")",
"location_info",
"=",
"await",
"location",
".",
"async_detec... | [
66,
0
] | [
91,
43
] | python | en | ['en', 'fr', 'en'] | True |
CheckConfigView.post | (self, request) | Validate configuration and return results. | Validate configuration and return results. | async def post(self, request):
"""Validate configuration and return results."""
errors = await async_check_ha_config_file(request.app["hass"])
state = "invalid" if errors else "valid"
return self.json({"result": state, "errors": errors}) | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
")",
":",
"errors",
"=",
"await",
"async_check_ha_config_file",
"(",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
")",
"state",
"=",
"\"invalid\"",
"if",
"errors",
"else",
"\"valid\"",
"return",
"self",
... | [
26,
4
] | [
32,
61
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Volumio media player platform. | Set up the Volumio media player platform. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Volumio media player platform."""
data = hass.data[DOMAIN][config_entry.entry_id]
volumio = data[DATA_VOLUMIO]
info = data[DATA_INFO]
uid = config_entry.data[CONF_ID]
name = config_entry.data[CONF_NAME]
enti... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"volumio",
"=",
"data",
"[",
"DATA_VOLUMIO",
"]",
"... | [
60,
0
] | [
70,
32
] | python | en | ['en', 'lv', 'en'] | True |
Volumio.__init__ | (self, volumio, uid, name, info) | Initialize the media player. | Initialize the media player. | def __init__(self, volumio, uid, name, info):
"""Initialize the media player."""
self._volumio = volumio
self._uid = uid
self._name = name
self._info = info
self._state = {}
self._playlists = []
self._currentplaylist = None | [
"def",
"__init__",
"(",
"self",
",",
"volumio",
",",
"uid",
",",
"name",
",",
"info",
")",
":",
"self",
".",
"_volumio",
"=",
"volumio",
"self",
".",
"_uid",
"=",
"uid",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_info",
"=",
"info",
"self",
... | [
76,
4
] | [
84,
36
] | python | en | ['en', 'en', 'en'] | True |
Volumio.async_update | (self) | Update state. | Update state. | async def async_update(self):
"""Update state."""
self._state = await self._volumio.get_state()
await self._async_update_playlists() | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"await",
"self",
".",
"_volumio",
".",
"get_state",
"(",
")",
"await",
"self",
".",
"_async_update_playlists",
"(",
")"
] | [
86,
4
] | [
89,
44
] | python | en | ['en', 'co', 'en'] | False |
Volumio.unique_id | (self) | Return the unique id for the entity. | Return the unique id for the entity. | def unique_id(self):
"""Return the unique id for the entity."""
return self._uid | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_uid"
] | [
92,
4
] | [
94,
24
] | python | en | ['en', 'en', 'en'] | True |
Volumio.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
97,
4
] | [
99,
25
] | python | en | ['en', 'en', 'en'] | True |
Volumio.device_info | (self) | Return device info for this device. | Return device info for this device. | def device_info(self):
"""Return device info for this device."""
return {
"identifiers": {(DOMAIN, self.unique_id)},
"name": self.name,
"manufacturer": "Volumio",
"sw_version": self._info["systemversion"],
"model": self._info["hardware"],
... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"unique_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"name",
",",
"\"manufacturer\"",
":",
"\"Volumio\"",
",",
"\"sw_version\"",
... | [
102,
4
] | [
110,
9
] | python | en | ['en', 'en', 'en'] | True |
Volumio.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."""
return MEDIA_TYPE_MUSIC | [
"def",
"media_content_type",
"(",
"self",
")",
":",
"return",
"MEDIA_TYPE_MUSIC"
] | [
113,
4
] | [
115,
31
] | 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.