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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
create_value_id | (value: OZWValue) | Generate unique value_id from an OZWValue. | Generate unique value_id from an OZWValue. | def create_value_id(value: OZWValue):
"""Generate unique value_id from an OZWValue."""
# [OZW_INSTANCE_ID]-[NODE_ID]-[VALUE_ID_KEY]
return f"{value.node.parent.id}-{value.node.id}-{value.value_id_key}" | [
"def",
"create_value_id",
"(",
"value",
":",
"OZWValue",
")",
":",
"# [OZW_INSTANCE_ID]-[NODE_ID]-[VALUE_ID_KEY]",
"return",
"f\"{value.node.parent.id}-{value.node.id}-{value.value_id_key}\""
] | [
299,
0
] | [
302,
73
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntityValues.__init__ | (self, hass, options, schema, primary_value) | Initialize the values object with the passed entity schema. | Initialize the values object with the passed entity schema. | def __init__(self, hass, options, schema, primary_value):
"""Initialize the values object with the passed entity schema."""
self._hass = hass
self._entity_created = False
self._schema = copy.deepcopy(schema)
self._values = {}
self.options = options
# Go through v... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"options",
",",
"schema",
",",
"primary_value",
")",
":",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_entity_created",
"=",
"False",
"self",
".",
"_schema",
"=",
"copy",
".",
"deepcopy",
"(",
"sch... | [
33,
4
] | [
49,
63
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntityValues.async_setup | (self) | Set up values instance. | Set up values instance. | def async_setup(self):
"""Set up values instance."""
# Check values that have already been discovered for node
# and see if they match the schema and need added to the entity.
for value in self._node.values():
self.async_check_value(value)
# Check if all the _require... | [
"def",
"async_setup",
"(",
"self",
")",
":",
"# Check values that have already been discovered for node",
"# and see if they match the schema and need added to the entity.",
"for",
"value",
"in",
"self",
".",
"_node",
".",
"values",
"(",
")",
":",
"self",
".",
"async_check_... | [
51,
4
] | [
60,
40
] | python | en | ['en', 'fr', 'en'] | True |
ZWaveDeviceEntityValues.__getattr__ | (self, name) | Get the specified value for this entity. | Get the specified value for this entity. | def __getattr__(self, name):
"""Get the specified value for this entity."""
return self._values.get(name, None) | [
"def",
"__getattr__",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_values",
".",
"get",
"(",
"name",
",",
"None",
")"
] | [
62,
4
] | [
64,
43
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntityValues.__iter__ | (self) | Allow iteration over all values. | Allow iteration over all values. | def __iter__(self):
"""Allow iteration over all values."""
return iter(self._values.values()) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"iter",
"(",
"self",
".",
"_values",
".",
"values",
"(",
")",
")"
] | [
66,
4
] | [
68,
42
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntityValues.__contains__ | (self, name) | Check if the specified name/key exists in the values. | Check if the specified name/key exists in the values. | def __contains__(self, name):
"""Check if the specified name/key exists in the values."""
return name in self._values | [
"def",
"__contains__",
"(",
"self",
",",
"name",
")",
":",
"return",
"name",
"in",
"self",
".",
"_values"
] | [
70,
4
] | [
72,
35
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntityValues.async_check_value | (self, value) | Check if the new value matches a missing value for this entity.
If a match is found, it is added to the values mapping.
| Check if the new value matches a missing value for this entity. | def async_check_value(self, value):
"""Check if the new value matches a missing value for this entity.
If a match is found, it is added to the values mapping.
"""
# Make sure the node matches the schema for this entity.
if not check_node_schema(value.node, self._schema):
... | [
"def",
"async_check_value",
"(",
"self",
",",
"value",
")",
":",
"# Make sure the node matches the schema for this entity.",
"if",
"not",
"check_node_schema",
"(",
"value",
".",
"node",
",",
"self",
".",
"_schema",
")",
":",
"return",
"# Go through the possible values f... | [
75,
4
] | [
103,
44
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntityValues._async_check_entity_ready | (self) | Check if all required values are discovered and create entity. | Check if all required values are discovered and create entity. | def _async_check_entity_ready(self):
"""Check if all required values are discovered and create entity."""
# Abort if the entity has already been created
if self._entity_created:
return
# Go through values defined in the schema and abort if a required value is missing.
... | [
"def",
"_async_check_entity_ready",
"(",
"self",
")",
":",
"# Abort if the entity has already been created",
"if",
"self",
".",
"_entity_created",
":",
"return",
"# Go through values defined in the schema and abort if a required value is missing.",
"for",
"name",
",",
"disc_setting... | [
106,
4
] | [
139,
80
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntityValues.values_id | (self) | Identification for this values collection. | Identification for this values collection. | def values_id(self):
"""Identification for this values collection."""
return create_value_id(self.primary) | [
"def",
"values_id",
"(",
"self",
")",
":",
"return",
"create_value_id",
"(",
"self",
".",
"primary",
")"
] | [
142,
4
] | [
144,
44
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity.__init__ | (self, values) | Initialize a generic Z-Wave device entity. | Initialize a generic Z-Wave device entity. | def __init__(self, values):
"""Initialize a generic Z-Wave device entity."""
self.values = values
self.options = values.options | [
"def",
"__init__",
"(",
"self",
",",
"values",
")",
":",
"self",
".",
"values",
"=",
"values",
"self",
".",
"options",
"=",
"values",
".",
"options"
] | [
150,
4
] | [
153,
37
] | python | en | ['en', 'pl', 'en'] | True |
ZWaveDeviceEntity.on_value_update | (self) | Call when a value is added/updated in the entity EntityValues Collection.
To be overridden by platforms needing this event.
| Call when a value is added/updated in the entity EntityValues Collection. | def on_value_update(self):
"""Call when a value is added/updated in the entity EntityValues Collection.
To be overridden by platforms needing this event.
""" | [
"def",
"on_value_update",
"(",
"self",
")",
":"
] | [
156,
4
] | [
160,
11
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity.async_added_to_hass | (self) | Call when entity is added. | Call when entity is added. | async def async_added_to_hass(self):
"""Call when entity is added."""
# Add dispatcher and OZW listeners callbacks.
# Add to on_remove so they will be cleaned up on entity removal.
self.async_on_remove(
self.options.listen(EVENT_VALUE_CHANGED, self._value_changed)
)
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"# Add dispatcher and OZW listeners callbacks.",
"# Add to on_remove so they will be cleaned up on entity removal.",
"self",
".",
"async_on_remove",
"(",
"self",
".",
"options",
".",
"listen",
"(",
"EVENT_VALUE_CHANG... | [
162,
4
] | [
183,
9
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity.device_info | (self) | Return device information for the device registry. | Return device information for the device registry. | def device_info(self):
"""Return device information for the device registry."""
node = self.values.primary.node
node_instance = self.values.primary.instance
dev_id = create_device_id(node, self.values.primary.instance)
node_firmware = node.get_value(
CommandClass.VERS... | [
"def",
"device_info",
"(",
"self",
")",
":",
"node",
"=",
"self",
".",
"values",
".",
"primary",
".",
"node",
"node_instance",
"=",
"self",
".",
"values",
".",
"primary",
".",
"instance",
"dev_id",
"=",
"create_device_id",
"(",
"node",
",",
"self",
".",
... | [
186,
4
] | [
208,
26
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity.extra_state_attributes | (self) | Return the device specific state attributes. | Return the device specific state attributes. | def extra_state_attributes(self):
"""Return the device specific state attributes."""
return {const.ATTR_NODE_ID: self.values.primary.node.node_id} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"const",
".",
"ATTR_NODE_ID",
":",
"self",
".",
"values",
".",
"primary",
".",
"node",
".",
"node_id",
"}"
] | [
211,
4
] | [
213,
69
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
node = self.values.primary.node
return f"{create_device_name(node)}: {self.values.primary.label}" | [
"def",
"name",
"(",
"self",
")",
":",
"node",
"=",
"self",
".",
"values",
".",
"primary",
".",
"node",
"return",
"f\"{create_device_name(node)}: {self.values.primary.label}\""
] | [
216,
4
] | [
219,
73
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity.unique_id | (self) | Return the unique_id of the entity. | Return the unique_id of the entity. | def unique_id(self):
"""Return the unique_id of the entity."""
return self.values.values_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"values",
".",
"values_id"
] | [
222,
4
] | [
224,
36
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity.available | (self) | Return entity availability. | Return entity availability. | def available(self) -> bool:
"""Return entity availability."""
# Use OZW Daemon status for availability.
instance_status = self.values.primary.ozw_instance.get_status()
return instance_status and instance_status.status in OZW_READY_STATES_VALUES | [
"def",
"available",
"(",
"self",
")",
"->",
"bool",
":",
"# Use OZW Daemon status for availability.",
"instance_status",
"=",
"self",
".",
"values",
".",
"primary",
".",
"ozw_instance",
".",
"get_status",
"(",
")",
"return",
"instance_status",
"and",
"instance_statu... | [
227,
4
] | [
231,
84
] | python | en | ['en', 'ga', 'en'] | True |
ZWaveDeviceEntity._value_changed | (self, value) | Call when a value from ZWaveDeviceEntityValues is changed.
Should not be overridden by subclasses.
| Call when a value from ZWaveDeviceEntityValues is changed. | def _value_changed(self, value):
"""Call when a value from ZWaveDeviceEntityValues is changed.
Should not be overridden by subclasses.
"""
if value.value_id_key in (v.value_id_key for v in self.values if v):
self.on_value_update()
self.async_write_ha_state() | [
"def",
"_value_changed",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
".",
"value_id_key",
"in",
"(",
"v",
".",
"value_id_key",
"for",
"v",
"in",
"self",
".",
"values",
"if",
"v",
")",
":",
"self",
".",
"on_value_update",
"(",
")",
"self",
"."... | [
234,
4
] | [
241,
39
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity._value_added | (self) | Call when a value from ZWaveDeviceEntityValues is added.
Should not be overridden by subclasses.
| Call when a value from ZWaveDeviceEntityValues is added. | def _value_added(self):
"""Call when a value from ZWaveDeviceEntityValues is added.
Should not be overridden by subclasses.
"""
self.on_value_update() | [
"def",
"_value_added",
"(",
"self",
")",
":",
"self",
".",
"on_value_update",
"(",
")"
] | [
244,
4
] | [
249,
30
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity._instance_updated | (self, new_status) | Call when the instance status changes.
Should not be overridden by subclasses.
| Call when the instance status changes. | def _instance_updated(self, new_status):
"""Call when the instance status changes.
Should not be overridden by subclasses.
"""
self.on_value_update()
self.async_write_ha_state() | [
"def",
"_instance_updated",
"(",
"self",
",",
"new_status",
")",
":",
"self",
".",
"on_value_update",
"(",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
252,
4
] | [
258,
35
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
261,
4
] | [
263,
20
] | python | en | ['en', 'en', 'en'] | True |
ZWaveDeviceEntity._delete_callback | (self, values_id) | Remove this entity. | Remove this entity. | async def _delete_callback(self, values_id):
"""Remove this entity."""
if not self.values:
return # race condition: delete already requested
if values_id == self.values.values_id:
await self.async_remove(force_remove=True) | [
"async",
"def",
"_delete_callback",
"(",
"self",
",",
"values_id",
")",
":",
"if",
"not",
"self",
".",
"values",
":",
"return",
"# race condition: delete already requested",
"if",
"values_id",
"==",
"self",
".",
"values",
".",
"values_id",
":",
"await",
"self",
... | [
265,
4
] | [
270,
54
] | python | en | ['en', 'en', 'en'] | True |
encrypt_payload | (secret_key, payload) | Return a encrypted payload given a key and dictionary of data. | Return a encrypted payload given a key and dictionary of data. | def encrypt_payload(secret_key, payload):
"""Return a encrypted payload given a key and dictionary of data."""
try:
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
except (ImportError, OSError):
pytest.skip("libnacl/libsodium is not installed")
retur... | [
"def",
"encrypt_payload",
"(",
"secret_key",
",",
"payload",
")",
":",
"try",
":",
"from",
"nacl",
".",
"encoding",
"import",
"Base64Encoder",
"from",
"nacl",
".",
"secret",
"import",
"SecretBox",
"except",
"(",
"ImportError",
",",
"OSError",
")",
":",
"pyte... | [
17,
0
] | [
37,
5
] | python | en | ['en', 'en', 'en'] | True |
decrypt_payload | (secret_key, encrypted_data) | Return a decrypted payload given a key and a string of encrypted data. | Return a decrypted payload given a key and a string of encrypted data. | def decrypt_payload(secret_key, encrypted_data):
"""Return a decrypted payload given a key and a string of encrypted data."""
try:
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
except (ImportError, OSError):
pytest.skip("libnacl/libsodium is not installed"... | [
"def",
"decrypt_payload",
"(",
"secret_key",
",",
"encrypted_data",
")",
":",
"try",
":",
"from",
"nacl",
".",
"encoding",
"import",
"Base64Encoder",
"from",
"nacl",
".",
"secret",
"import",
"SecretBox",
"except",
"(",
"ImportError",
",",
"OSError",
")",
":",
... | [
40,
0
] | [
61,
37
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_render_template | (create_registrations, webhook_client) | Test that we render templates properly. | Test that we render templates properly. | async def test_webhook_handle_render_template(create_registrations, webhook_client):
"""Test that we render templates properly."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json={
"type": "render_template",
"data": ... | [
"async",
"def",
"test_webhook_handle_render_template",
"(",
"create_registrations",
",",
"webhook_client",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
"1",
"]",
"[",
"\"w... | [
64,
0
] | [
87,
5
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_call_services | (hass, create_registrations, webhook_client) | Test that we call services properly. | Test that we call services properly. | async def test_webhook_handle_call_services(hass, create_registrations, webhook_client):
"""Test that we call services properly."""
calls = async_mock_service(hass, "test", "mobile_app")
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json=... | [
"async",
"def",
"test_webhook_handle_call_services",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"calls",
"=",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"mobile_app\"",
")",
"resp",
"=",
"await",
"webhook_client",
".",... | [
90,
0
] | [
101,
26
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_fire_event | (hass, create_registrations, webhook_client) | Test that we can fire events. | Test that we can fire events. | async def test_webhook_handle_fire_event(hass, create_registrations, webhook_client):
"""Test that we can fire events."""
events = []
@callback
def store_event(event):
"""Help store events."""
events.append(event)
hass.bus.async_listen("test_event", store_event)
resp = await w... | [
"async",
"def",
"test_webhook_handle_fire_event",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"store_event",
"(",
"event",
")",
":",
"\"\"\"Help store events.\"\"\"",
"events",
".",
"a... | [
104,
0
] | [
124,
48
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_update_registration | (webhook_client, authed_api_client) | Test that a we can update an existing registration via webhook. | Test that a we can update an existing registration via webhook. | async def test_webhook_update_registration(webhook_client, authed_api_client):
"""Test that a we can update an existing registration via webhook."""
register_resp = await authed_api_client.post(
"/api/mobile_app/registrations", json=REGISTER_CLEARTEXT
)
assert register_resp.status == 201
re... | [
"async",
"def",
"test_webhook_update_registration",
"(",
"webhook_client",
",",
"authed_api_client",
")",
":",
"register_resp",
"=",
"await",
"authed_api_client",
".",
"post",
"(",
"\"/api/mobile_app/registrations\"",
",",
"json",
"=",
"REGISTER_CLEARTEXT",
")",
"assert",... | [
127,
0
] | [
148,
41
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_get_zones | (hass, create_registrations, webhook_client) | Test that we can get zones properly. | Test that we can get zones properly. | async def test_webhook_handle_get_zones(hass, create_registrations, webhook_client):
"""Test that we can get zones properly."""
# Zone is already loaded as part of the fixture,
# so we just trigger a reload.
with patch(
"homeassistant.config.load_yaml_config_file",
autospec=True,
... | [
"async",
"def",
"test_webhook_handle_get_zones",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"# Zone is already loaded as part of the fixture,",
"# so we just trigger a reload.",
"with",
"patch",
"(",
"\"homeassistant.config.load_yaml_config_file\"",
... | [
151,
0
] | [
198,
62
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_get_config | (hass, create_registrations, webhook_client) | Test that we can get config properly. | Test that we can get config properly. | async def test_webhook_handle_get_config(hass, create_registrations, webhook_client):
"""Test that we can get config properly."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json={"type": "get_config"},
)
assert resp.status == 200
... | [
"async",
"def",
"test_webhook_handle_get_config",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
"1",
"]",
... | [
201,
0
] | [
230,
32
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_returns_error_incorrect_json | (
webhook_client, create_registrations, caplog
) | Test that an error is returned when JSON is invalid. | Test that an error is returned when JSON is invalid. | async def test_webhook_returns_error_incorrect_json(
webhook_client, create_registrations, caplog
):
"""Test that an error is returned when JSON is invalid."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]), data="not json"
)
assert resp.st... | [
"async",
"def",
"test_webhook_returns_error_incorrect_json",
"(",
"webhook_client",
",",
"create_registrations",
",",
"caplog",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
... | [
233,
0
] | [
244,
40
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_decryption | (webhook_client, create_registrations) | Test that we can encrypt/decrypt properly. | Test that we can encrypt/decrypt properly. | async def test_webhook_handle_decryption(webhook_client, create_registrations):
"""Test that we can encrypt/decrypt properly."""
key = create_registrations[0]["secret"]
data = encrypt_payload(key, RENDER_TEMPLATE["data"])
container = {"type": "render_template", "encrypted": True, "encrypted_data": data... | [
"async",
"def",
"test_webhook_handle_decryption",
"(",
"webhook_client",
",",
"create_registrations",
")",
":",
"key",
"=",
"create_registrations",
"[",
"0",
"]",
"[",
"\"secret\"",
"]",
"data",
"=",
"encrypt_payload",
"(",
"key",
",",
"RENDER_TEMPLATE",
"[",
"\"d... | [
247,
0
] | [
265,
51
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_requires_encryption | (webhook_client, create_registrations) | Test that encrypted registrations only accept encrypted data. | Test that encrypted registrations only accept encrypted data. | async def test_webhook_requires_encryption(webhook_client, create_registrations):
"""Test that encrypted registrations only accept encrypted data."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[0]["webhook_id"]),
json=RENDER_TEMPLATE,
)
assert resp.st... | [
"async",
"def",
"test_webhook_requires_encryption",
"(",
"webhook_client",
",",
"create_registrations",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
"0",
"]",
"[",
"\"webh... | [
268,
0
] | [
280,
65
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_update_location | (hass, webhook_client, create_registrations) | Test that location can be updated. | Test that location can be updated. | async def test_webhook_update_location(hass, webhook_client, create_registrations):
"""Test that location can be updated."""
resp = await webhook_client.post(
"/api/webhook/{}".format(create_registrations[1]["webhook_id"]),
json={
"type": "update_location",
"data": {"gps"... | [
"async",
"def",
"test_webhook_update_location",
"(",
"hass",
",",
"webhook_client",
",",
"create_registrations",
")",
":",
"resp",
"=",
"await",
"webhook_client",
".",
"post",
"(",
"\"/api/webhook/{}\"",
".",
"format",
"(",
"create_registrations",
"[",
"1",
"]",
"... | [
283,
0
] | [
300,
46
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_enable_encryption | (hass, webhook_client, create_registrations) | Test that encryption can be added to a reg initially created without. | Test that encryption can be added to a reg initially created without. | async def test_webhook_enable_encryption(hass, webhook_client, create_registrations):
"""Test that encryption can be added to a reg initially created without."""
webhook_id = create_registrations[1]["webhook_id"]
enable_enc_resp = await webhook_client.post(
f"/api/webhook/{webhook_id}",
jso... | [
"async",
"def",
"test_webhook_enable_encryption",
"(",
"hass",
",",
"webhook_client",
",",
"create_registrations",
")",
":",
"webhook_id",
"=",
"create_registrations",
"[",
"1",
"]",
"[",
"\"webhook_id\"",
"]",
"enable_enc_resp",
"=",
"await",
"webhook_client",
".",
... | [
303,
0
] | [
349,
51
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_camera_stream_non_existent | (
hass, create_registrations, webhook_client
) | Test fetching camera stream URLs for a non-existent camera. | Test fetching camera stream URLs for a non-existent camera. | async def test_webhook_camera_stream_non_existent(
hass, create_registrations, webhook_client
):
"""Test fetching camera stream URLs for a non-existent camera."""
webhook_id = create_registrations[1]["webhook_id"]
resp = await webhook_client.post(
f"/api/webhook/{webhook_id}",
json={
... | [
"async",
"def",
"test_webhook_camera_stream_non_existent",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"webhook_id",
"=",
"create_registrations",
"[",
"1",
"]",
"[",
"\"webhook_id\"",
"]",
"resp",
"=",
"await",
"webhook_client",
".",
"... | [
352,
0
] | [
368,
43
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_camera_stream_non_hls | (
hass, create_registrations, webhook_client
) | Test fetching camera stream URLs for a non-HLS/stream-supporting camera. | Test fetching camera stream URLs for a non-HLS/stream-supporting camera. | async def test_webhook_camera_stream_non_hls(
hass, create_registrations, webhook_client
):
"""Test fetching camera stream URLs for a non-HLS/stream-supporting camera."""
hass.states.async_set("camera.non_stream_camera", "idle", {"supported_features": 0})
webhook_id = create_registrations[1]["webhook_i... | [
"async",
"def",
"test_webhook_camera_stream_non_hls",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.non_stream_camera\"",
",",
"\"idle\"",
",",
"{",
"\"supported_features\"",
":",
"0"... | [
371,
0
] | [
393,
5
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_camera_stream_stream_available | (
hass, create_registrations, webhook_client
) | Test fetching camera stream URLs for an HLS/stream-supporting camera. | Test fetching camera stream URLs for an HLS/stream-supporting camera. | async def test_webhook_camera_stream_stream_available(
hass, create_registrations, webhook_client
):
"""Test fetching camera stream URLs for an HLS/stream-supporting camera."""
hass.states.async_set(
"camera.stream_camera", "idle", {"supported_features": CAMERA_SUPPORT_STREAM}
)
webhook_id ... | [
"async",
"def",
"test_webhook_camera_stream_stream_available",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.stream_camera\"",
",",
"\"idle\"",
",",
"{",
"\"supported_features\"",
":",
... | [
396,
0
] | [
421,
88
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_camera_stream_stream_available_but_errors | (
hass, create_registrations, webhook_client
) | Test fetching camera stream URLs for an HLS/stream-supporting camera but that streaming errors. | Test fetching camera stream URLs for an HLS/stream-supporting camera but that streaming errors. | async def test_webhook_camera_stream_stream_available_but_errors(
hass, create_registrations, webhook_client
):
"""Test fetching camera stream URLs for an HLS/stream-supporting camera but that streaming errors."""
hass.states.async_set(
"camera.stream_camera", "idle", {"supported_features": CAMERA_S... | [
"async",
"def",
"test_webhook_camera_stream_stream_available_but_errors",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"camera.stream_camera\"",
",",
"\"idle\"",
",",
"{",
"\"supported_features\... | [
424,
0
] | [
449,
88
] | python | en | ['en', 'en', 'en'] | True |
test_webhook_handle_scan_tag | (hass, create_registrations, webhook_client) | Test that we can scan tags. | Test that we can scan tags. | async def test_webhook_handle_scan_tag(hass, create_registrations, webhook_client):
"""Test that we can scan tags."""
events = []
@callback
def store_event(event):
"""Helepr to store events."""
events.append(event)
hass.bus.async_listen("tag_scanned", store_event)
resp = await... | [
"async",
"def",
"test_webhook_handle_scan_tag",
"(",
"hass",
",",
"create_registrations",
",",
"webhook_client",
")",
":",
"events",
"=",
"[",
"]",
"@",
"callback",
"def",
"store_event",
"(",
"event",
")",
":",
"\"\"\"Helepr to store events.\"\"\"",
"events",
".",
... | [
452,
0
] | [
474,
58
] | python | en | ['en', 'en', 'en'] | True |
mkpath | (name, mode=0o777, verbose=1, dry_run=0) | Create a directory and any missing ancestor directories.
If the directory already exists (or if 'name' is the empty string, which
means the current directory, which of course exists), then do nothing.
Raise DistutilsFileError if unable to create some directory along the way
(eg. some sub-path exists, b... | Create a directory and any missing ancestor directories. | def mkpath(name, mode=0o777, verbose=1, dry_run=0):
"""Create a directory and any missing ancestor directories.
If the directory already exists (or if 'name' is the empty string, which
means the current directory, which of course exists), then do nothing.
Raise DistutilsFileError if unable to create so... | [
"def",
"mkpath",
"(",
"name",
",",
"mode",
"=",
"0o777",
",",
"verbose",
"=",
"1",
",",
"dry_run",
"=",
"0",
")",
":",
"global",
"_path_created",
"# Detect a common bug -- name is None",
"if",
"not",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"raise"... | [
16,
0
] | [
77,
23
] | python | en | ['en', 'en', 'en'] | True |
create_tree | (base_dir, files, mode=0o777, verbose=1, dry_run=0) | Create all the empty directories under 'base_dir' needed to put 'files'
there.
'base_dir' is just the name of a directory which doesn't necessarily
exist yet; 'files' is a list of filenames to be interpreted relative to
'base_dir'. 'base_dir' + the directory portion of every file in 'files'
will b... | Create all the empty directories under 'base_dir' needed to put 'files'
there. | def create_tree(base_dir, files, mode=0o777, verbose=1, dry_run=0):
"""Create all the empty directories under 'base_dir' needed to put 'files'
there.
'base_dir' is just the name of a directory which doesn't necessarily
exist yet; 'files' is a list of filenames to be interpreted relative to
'base_di... | [
"def",
"create_tree",
"(",
"base_dir",
",",
"files",
",",
"mode",
"=",
"0o777",
",",
"verbose",
"=",
"1",
",",
"dry_run",
"=",
"0",
")",
":",
"# First get the list of directories to create",
"need_dir",
"=",
"set",
"(",
")",
"for",
"file",
"in",
"files",
"... | [
79,
0
] | [
96,
59
] | python | en | ['en', 'en', 'en'] | True |
copy_tree | (src, dst, preserve_mode=1, preserve_times=1,
preserve_symlinks=0, update=0, verbose=1, dry_run=0) | Copy an entire directory tree 'src' to a new location 'dst'.
Both 'src' and 'dst' must be directory names. If 'src' is not a
directory, raise DistutilsFileError. If 'dst' does not exist, it is
created with 'mkpath()'. The end result of the copy is that every
file in 'src' is copied to 'dst', and dir... | Copy an entire directory tree 'src' to a new location 'dst'. | def copy_tree(src, dst, preserve_mode=1, preserve_times=1,
preserve_symlinks=0, update=0, verbose=1, dry_run=0):
"""Copy an entire directory tree 'src' to a new location 'dst'.
Both 'src' and 'dst' must be directory names. If 'src' is not a
directory, raise DistutilsFileError. If 'dst' does... | [
"def",
"copy_tree",
"(",
"src",
",",
"dst",
",",
"preserve_mode",
"=",
"1",
",",
"preserve_times",
"=",
"1",
",",
"preserve_symlinks",
"=",
"0",
",",
"update",
"=",
"0",
",",
"verbose",
"=",
"1",
",",
"dry_run",
"=",
"0",
")",
":",
"from",
"distutils... | [
98,
0
] | [
165,
18
] | python | en | ['en', 'en', 'en'] | True |
_build_cmdtuple | (path, cmdtuples) | Helper for remove_tree(). | Helper for remove_tree(). | def _build_cmdtuple(path, cmdtuples):
"""Helper for remove_tree()."""
for f in os.listdir(path):
real_f = os.path.join(path,f)
if os.path.isdir(real_f) and not os.path.islink(real_f):
_build_cmdtuple(real_f, cmdtuples)
else:
cmdtuples.append((os.remove, real_f))
... | [
"def",
"_build_cmdtuple",
"(",
"path",
",",
"cmdtuples",
")",
":",
"for",
"f",
"in",
"os",
".",
"listdir",
"(",
"path",
")",
":",
"real_f",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"f",
")",
"if",
"os",
".",
"path",
".",
"isdir",
... | [
167,
0
] | [
175,
38
] | python | da | ['da', 'it', 'en'] | False |
remove_tree | (directory, verbose=1, dry_run=0) | Recursively remove an entire directory tree.
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true).
| Recursively remove an entire directory tree. | def remove_tree(directory, verbose=1, dry_run=0):
"""Recursively remove an entire directory tree.
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true).
"""
global _path_created
if verbose >= 1:
log.info("removing '%s' (and everything under it)", directory)
... | [
"def",
"remove_tree",
"(",
"directory",
",",
"verbose",
"=",
"1",
",",
"dry_run",
"=",
"0",
")",
":",
"global",
"_path_created",
"if",
"verbose",
">=",
"1",
":",
"log",
".",
"info",
"(",
"\"removing '%s' (and everything under it)\"",
",",
"directory",
")",
"... | [
177,
0
] | [
199,
61
] | python | en | ['en', 'en', 'en'] | True |
ensure_relative | (path) | Take the full path 'path', and make it a relative path.
This is useful to make 'path' the second argument to os.path.join().
| Take the full path 'path', and make it a relative path. | def ensure_relative(path):
"""Take the full path 'path', and make it a relative path.
This is useful to make 'path' the second argument to os.path.join().
"""
drive, path = os.path.splitdrive(path)
if path[0:1] == os.sep:
path = drive + path[1:]
return path | [
"def",
"ensure_relative",
"(",
"path",
")",
":",
"drive",
",",
"path",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"path",
")",
"if",
"path",
"[",
"0",
":",
"1",
"]",
"==",
"os",
".",
"sep",
":",
"path",
"=",
"drive",
"+",
"path",
"[",
"1",... | [
201,
0
] | [
209,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) | Set up device tracker for AsusWrt component. | Set up device tracker for AsusWrt component. | async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up device tracker for AsusWrt component."""
router = hass.data[DOMAIN][entry.entry_id][DATA_ASUSWRT]
tracked: set = set()
@callback
def update_router():
"""Update the values of the... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"router",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"[",
... | [
16,
0
] | [
32,
19
] | python | en | ['en', 'en', 'en'] | True |
add_entities | (router, async_add_entities, tracked) | Add new tracker entities from the router. | Add new tracker entities from the router. | def add_entities(router, async_add_entities, tracked):
"""Add new tracker entities from the router."""
new_tracked = []
for mac, device in router.devices.items():
if mac in tracked:
continue
new_tracked.append(AsusWrtDevice(router, device))
tracked.add(mac)
if new_... | [
"def",
"add_entities",
"(",
"router",
",",
"async_add_entities",
",",
"tracked",
")",
":",
"new_tracked",
"=",
"[",
"]",
"for",
"mac",
",",
"device",
"in",
"router",
".",
"devices",
".",
"items",
"(",
")",
":",
"if",
"mac",
"in",
"tracked",
":",
"conti... | [
36,
0
] | [
48,
39
] | python | en | ['en', 'en', 'en'] | True |
AsusWrtDevice.__init__ | (self, router: AsusWrtRouter, device) | Initialize a AsusWrt device. | Initialize a AsusWrt device. | def __init__(self, router: AsusWrtRouter, device) -> None:
"""Initialize a AsusWrt device."""
self._router = router
self._device = device
self._attr_unique_id = device.mac
self._attr_name = device.name or DEFAULT_DEVICE_NAME
self._attr_device_info = {
"connect... | [
"def",
"__init__",
"(",
"self",
",",
"router",
":",
"AsusWrtRouter",
",",
"device",
")",
"->",
"None",
":",
"self",
".",
"_router",
"=",
"router",
"self",
".",
"_device",
"=",
"device",
"self",
".",
"_attr_unique_id",
"=",
"device",
".",
"mac",
"self",
... | [
56,
4
] | [
67,
64
] | python | en | ['fr', 'en', 'en'] | True |
AsusWrtDevice.is_connected | (self) | Return true if the device is connected to the network. | Return true if the device is connected to the network. | def is_connected(self):
"""Return true if the device is connected to the network."""
return self._device.is_connected | [
"def",
"is_connected",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"is_connected"
] | [
70,
4
] | [
72,
40
] | python | en | ['en', 'en', 'en'] | True |
AsusWrtDevice.source_type | (self) | Return the source type. | Return the source type. | def source_type(self) -> str:
"""Return the source type."""
return SOURCE_TYPE_ROUTER | [
"def",
"source_type",
"(",
"self",
")",
"->",
"str",
":",
"return",
"SOURCE_TYPE_ROUTER"
] | [
75,
4
] | [
77,
33
] | python | en | ['en', 'en', 'en'] | True |
AsusWrtDevice.hostname | (self) | Return the hostname of device. | Return the hostname of device. | def hostname(self) -> str:
"""Return the hostname of device."""
return self._device.name | [
"def",
"hostname",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device",
".",
"name"
] | [
80,
4
] | [
82,
32
] | python | en | ['en', 'sl', 'en'] | True |
AsusWrtDevice.ip_address | (self) | Return the primary ip address of the device. | Return the primary ip address of the device. | def ip_address(self) -> str:
"""Return the primary ip address of the device."""
return self._device.ip_address | [
"def",
"ip_address",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device",
".",
"ip_address"
] | [
85,
4
] | [
87,
38
] | python | en | ['en', 'en', 'en'] | True |
AsusWrtDevice.mac_address | (self) | Return the mac address of the device. | Return the mac address of the device. | def mac_address(self) -> str:
"""Return the mac address of the device."""
return self._device.mac | [
"def",
"mac_address",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_device",
".",
"mac"
] | [
90,
4
] | [
92,
31
] | python | en | ['en', 'en', 'en'] | True |
AsusWrtDevice.async_on_demand_update | (self) | Update state. | Update state. | def async_on_demand_update(self):
"""Update state."""
self._device = self._router.devices[self._device.mac]
self._attr_extra_state_attributes = {}
if self._device.last_activity:
self._attr_extra_state_attributes[
"last_time_reachable"
] = self._dev... | [
"def",
"async_on_demand_update",
"(",
"self",
")",
":",
"self",
".",
"_device",
"=",
"self",
".",
"_router",
".",
"devices",
"[",
"self",
".",
"_device",
".",
"mac",
"]",
"self",
".",
"_attr_extra_state_attributes",
"=",
"{",
"}",
"if",
"self",
".",
"_de... | [
95,
4
] | [
103,
35
] | python | en | ['en', 'co', 'en'] | False |
AsusWrtDevice.async_added_to_hass | (self) | Register state update callback. | Register state update callback. | async def async_added_to_hass(self):
"""Register state update callback."""
self.async_on_remove(
async_dispatcher_connect(
self.hass,
self._router.signal_device_update,
self.async_on_demand_update,
)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_router",
".",
"signal_device_update",
",",
"self",
".",
"async_on_demand_update",
",",
")... | [
105,
4
] | [
113,
9
] | python | en | ['en', 'co', 'en'] | True |
test_controlling_state_via_topic | (hass, mqtt_mock) | Test the controlling state via topic. | Test the controlling state via topic. | async def test_controlling_state_via_topic(hass, mqtt_mock):
"""Test the controlling state via topic."""
assert await async_setup_component(
hass,
switch.DOMAIN,
{
switch.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topi... | [
"async",
"def",
"test_controlling_state_via_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"switch",
".",
"DOMAIN",
",",
"{",
"switch",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",... | [
46,
0
] | [
76,
35
] | python | en | ['en', 'en', 'en'] | True |
test_sending_mqtt_commands_and_optimistic | (hass, mqtt_mock) | Test the sending MQTT commands in optimistic mode. | Test the sending MQTT commands in optimistic mode. | async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
"""Test the sending MQTT commands in optimistic mode."""
fake_state = ha.State("switch.test", "on")
with patch(
"homeassistant.helpers.restore_state.RestoreEntity.async_get_last_state",
return_value=fake_state,
):
... | [
"async",
"def",
"test_sending_mqtt_commands_and_optimistic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"fake_state",
"=",
"ha",
".",
"State",
"(",
"\"switch.test\"",
",",
"\"on\"",
")",
"with",
"patch",
"(",
"\"homeassistant.helpers.restore_state.RestoreEntity.async_get_la... | [
79,
0
] | [
122,
35
] | python | en | ['en', 'no', 'en'] | True |
test_controlling_state_via_topic_and_json_message | (hass, mqtt_mock) | Test the controlling state via topic and JSON message. | Test the controlling state via topic and JSON message. | async def test_controlling_state_via_topic_and_json_message(hass, mqtt_mock):
"""Test the controlling state via topic and JSON message."""
assert await async_setup_component(
hass,
switch.DOMAIN,
{
switch.DOMAIN: {
"platform": "mqtt",
"name": "... | [
"async",
"def",
"test_controlling_state_via_topic_and_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"switch",
".",
"DOMAIN",
",",
"{",
"switch",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
... | [
125,
0
] | [
155,
35
] | python | en | ['en', 'en', 'en'] | True |
test_availability_when_connection_lost | (hass, mqtt_mock) | Test availability after MQTT disconnection. | Test availability after MQTT disconnection. | async def test_availability_when_connection_lost(hass, mqtt_mock):
"""Test availability after MQTT disconnection."""
await help_test_availability_when_connection_lost(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
158,
0
] | [
162,
5
] | python | en | ['en', 'en', 'en'] | True |
test_availability_without_topic | (hass, mqtt_mock) | Test availability without defined availability topic. | Test availability without defined availability topic. | async def test_availability_without_topic(hass, mqtt_mock):
"""Test availability without defined availability topic."""
await help_test_availability_without_topic(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
165,
0
] | [
169,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_availability_payload | (hass, mqtt_mock) | Test availability by default payload with defined topic. | Test availability by default payload with defined topic. | async def test_default_availability_payload(hass, mqtt_mock):
"""Test availability by default payload with defined topic."""
config = {
switch.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-topic",
"command_topic": "command-topic",
... | [
"async",
"def",
"test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"switch",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\""... | [
172,
0
] | [
187,
5
] | python | en | ['en', 'en', 'en'] | True |
test_custom_availability_payload | (hass, mqtt_mock) | Test availability by custom payload with defined topic. | Test availability by custom payload with defined topic. | async def test_custom_availability_payload(hass, mqtt_mock):
"""Test availability by custom payload with defined topic."""
config = {
switch.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-topic",
"command_topic": "command-topic",
... | [
"async",
"def",
"test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"switch",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"state_topic\"",
":",
"\"state-topic\"",... | [
190,
0
] | [
205,
5
] | python | en | ['en', 'en', 'en'] | True |
test_custom_state_payload | (hass, mqtt_mock) | Test the state payload. | Test the state payload. | async def test_custom_state_payload(hass, mqtt_mock):
"""Test the state payload."""
assert await async_setup_component(
hass,
switch.DOMAIN,
{
switch.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "state-topic",
... | [
"async",
"def",
"test_custom_state_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"switch",
".",
"DOMAIN",
",",
"{",
"switch",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\... | [
208,
0
] | [
240,
35
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_via_mqtt_json_message | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_via_mqtt_json_message(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
243,
0
] | [
247,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_blocked_attribute_via_mqtt_json_message | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_blocked_attribute_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_blocked_attribute_via_mqtt_json_message(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG, MQTT_SWITCH_ATTRIBUTES_BLOCKED
) | [
"async",
"def",
"test_setting_blocked_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_blocked_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
",",
... | [
250,
0
] | [
254,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_with_template | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_with_template(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_with_template(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
257,
0
] | [
261,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_not_dict | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_not_dict(
hass, mqtt_mock, caplog, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
"... | [
264,
0
] | [
268,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_bad_JSON | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_bad_JSON(
hass, mqtt_mock, caplog, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
"... | [
271,
0
] | [
275,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_attr | (hass, mqtt_mock, caplog) | Test update of discovered MQTTAttributes. | Test update of discovered MQTTAttributes. | async def test_discovery_update_attr(hass, mqtt_mock, caplog):
"""Test update of discovered MQTTAttributes."""
await help_test_discovery_update_attr(
hass, mqtt_mock, caplog, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
278,
0
] | [
282,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass, mqtt_mock) | Test unique id option only creates one switch per unique_id. | Test unique id option only creates one switch per unique_id. | async def test_unique_id(hass, mqtt_mock):
"""Test unique id option only creates one switch per unique_id."""
config = {
switch.DOMAIN: [
{
"platform": "mqtt",
"name": "Test 1",
"state_topic": "test-topic",
"command_topic": "com... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"switch",
".",
"DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 1\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
",",
... | [
285,
0
] | [
305,
69
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_removal_switch | (hass, mqtt_mock, caplog) | Test removal of discovered switch. | Test removal of discovered switch. | async def test_discovery_removal_switch(hass, mqtt_mock, caplog):
"""Test removal of discovered switch."""
data = (
'{ "name": "test",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic" }'
)
await help_test_discovery_removal(hass, mqtt_mock, caplog, switch.DOMAIN,... | [
"async",
"def",
"test_discovery_removal_switch",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"(",
"'{ \"name\": \"test\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\" }'",
")",
"await",
"help_test_discovery_removal",
... | [
308,
0
] | [
315,
83
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_switch_topic_template | (hass, mqtt_mock, caplog) | Test update of discovered switch. | Test update of discovered switch. | async def test_discovery_update_switch_topic_template(hass, mqtt_mock, caplog):
"""Test update of discovered switch."""
config1 = copy.deepcopy(DEFAULT_CONFIG[switch.DOMAIN])
config2 = copy.deepcopy(DEFAULT_CONFIG[switch.DOMAIN])
config1["name"] = "Beer"
config2["name"] = "Milk"
config1["state_t... | [
"async",
"def",
"test_discovery_update_switch_topic_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"switch",
".",
"DOMAIN",
"]",
")",
"config2",
"=",
"copy",
".",
"deepcop... | [
318,
0
] | [
352,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_switch_template | (hass, mqtt_mock, caplog) | Test update of discovered switch. | Test update of discovered switch. | async def test_discovery_update_switch_template(hass, mqtt_mock, caplog):
"""Test update of discovered switch."""
config1 = copy.deepcopy(DEFAULT_CONFIG[switch.DOMAIN])
config2 = copy.deepcopy(DEFAULT_CONFIG[switch.DOMAIN])
config1["name"] = "Beer"
config2["name"] = "Milk"
config1["state_topic"]... | [
"async",
"def",
"test_discovery_update_switch_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
"DEFAULT_CONFIG",
"[",
"switch",
".",
"DOMAIN",
"]",
")",
"config2",
"=",
"copy",
".",
"deepcopy",
... | [
355,
0
] | [
387,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_switch | (hass, mqtt_mock, caplog) | Test update of discovered switch. | Test update of discovered switch. | async def test_discovery_update_unchanged_switch(hass, mqtt_mock, caplog):
"""Test update of discovered switch."""
data1 = (
'{ "name": "Beer",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic" }'
)
with patch(
"homeassistant.components.mqtt.switch.MqttSw... | [
"async",
"def",
"test_discovery_update_unchanged_switch",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"(",
"'{ \"name\": \"Beer\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\" }'",
")",
"with",
"patch",
"(",
"\"h... | [
390,
0
] | [
402,
9
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_broken | (hass, mqtt_mock, caplog) | Test handling of bad discovery message. | Test handling of bad discovery message. | async def test_discovery_broken(hass, mqtt_mock, caplog):
"""Test handling of bad discovery message."""
data1 = '{ "name": "Beer" }'
data2 = (
'{ "name": "Milk",'
' "state_topic": "test_topic",'
' "command_topic": "test_topic" }'
)
await help_test_discovery_broken(
... | [
"async",
"def",
"test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\" }'",
"data2",
"=",
"(",
"'{ \"name\": \"Milk\",'",
"' \"state_topic\": \"test_topic\",'",
"' \"command_topic\": \"test_topic\" }'",
")",
"... | [
406,
0
] | [
416,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT switch device registry integration. | Test MQTT switch device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT switch device registry integration."""
await help_test_entity_device_info_with_connection(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
419,
0
] | [
423,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT switch device registry integration. | Test MQTT switch device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT switch device registry integration."""
await help_test_entity_device_info_with_identifier(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
426,
0
] | [
430,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_update | (hass, mqtt_mock) | Test device registry update. | Test device registry update. | async def test_entity_device_info_update(hass, mqtt_mock):
"""Test device registry update."""
await help_test_entity_device_info_update(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
433,
0
] | [
437,
5
] | python | en | ['fr', 'fy', 'en'] | False |
test_entity_device_info_remove | (hass, mqtt_mock) | Test device registry remove. | Test device registry remove. | async def test_entity_device_info_remove(hass, mqtt_mock):
"""Test device registry remove."""
await help_test_entity_device_info_remove(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
440,
0
] | [
444,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_entity_id_update_subscriptions | (hass, mqtt_mock) | Test MQTT subscriptions are managed when entity_id is updated. | Test MQTT subscriptions are managed when entity_id is updated. | async def test_entity_id_update_subscriptions(hass, mqtt_mock):
"""Test MQTT subscriptions are managed when entity_id is updated."""
await help_test_entity_id_update_subscriptions(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
447,
0
] | [
451,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_id_update_discovery_update | (hass, mqtt_mock) | Test MQTT discovery update when entity_id is updated. | Test MQTT discovery update when entity_id is updated. | async def test_entity_id_update_discovery_update(hass, mqtt_mock):
"""Test MQTT discovery update when entity_id is updated."""
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
454,
0
] | [
458,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_debug_info_message | (hass, mqtt_mock) | Test MQTT debug info. | Test MQTT debug info. | async def test_entity_debug_info_message(hass, mqtt_mock):
"""Test MQTT debug info."""
await help_test_entity_debug_info_message(
hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"switch",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
461,
0
] | [
465,
5
] | python | es | ['es', 'mt', 'it'] | False |
device_reg | (hass: HomeAssistant) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def device_reg(hass: HomeAssistant) -> device_registry.DeviceRegistry:
"""Return an empty, loaded, registry."""
return mock_device_registry(hass) | [
"def",
"device_reg",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"device_registry",
".",
"DeviceRegistry",
":",
"return",
"mock_device_registry",
"(",
"hass",
")"
] | [
30,
0
] | [
32,
37
] | python | en | ['en', 'fy', 'en'] | True |
entity_reg | (hass: HomeAssistant) | Return an empty, loaded, registry. | Return an empty, loaded, registry. | def entity_reg(hass: HomeAssistant) -> entity_registry.EntityRegistry:
"""Return an empty, loaded, registry."""
return mock_registry(hass) | [
"def",
"entity_reg",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"entity_registry",
".",
"EntityRegistry",
":",
"return",
"mock_registry",
"(",
"hass",
")"
] | [
36,
0
] | [
38,
30
] | python | en | ['en', 'fy', 'en'] | True |
calls | (hass: HomeAssistant) | Track calls to a mock service. | Track calls to a mock service. | def calls(hass: HomeAssistant) -> list[ServiceCall]:
"""Track calls to a mock service."""
return async_mock_service(hass, "test", "automation") | [
"def",
"calls",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"list",
"[",
"ServiceCall",
"]",
":",
"return",
"async_mock_service",
"(",
"hass",
",",
"\"test\"",
",",
"\"automation\"",
")"
] | [
42,
0
] | [
44,
57
] | python | en | ['en', 'en', 'en'] | True |
test_get_conditions | (
hass: HomeAssistant,
device_reg: device_registry.DeviceRegistry,
entity_reg: entity_registry.EntityRegistry,
) | Test we get the expected conditions from a select. | Test we get the expected conditions from a select. | async def test_get_conditions(
hass: HomeAssistant,
device_reg: device_registry.DeviceRegistry,
entity_reg: entity_registry.EntityRegistry,
) -> None:
"""Test we get the expected conditions from a select."""
config_entry = MockConfigEntry(domain="test", data={})
config_entry.add_to_hass(hass)
... | [
"async",
"def",
"test_get_conditions",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_reg",
":",
"device_registry",
".",
"DeviceRegistry",
",",
"entity_reg",
":",
"entity_registry",
".",
"EntityRegistry",
",",
")",
"->",
"None",
":",
"config_entry",
"=",
"MockCon... | [
47,
0
] | [
70,
54
] | python | en | ['en', 'en', 'en'] | True |
test_if_selected_option | (
hass: HomeAssistant, calls: list[ServiceCall]
) | Test for selected_option conditions. | Test for selected_option conditions. | async def test_if_selected_option(
hass: HomeAssistant, calls: list[ServiceCall]
) -> None:
"""Test for selected_option conditions."""
assert await async_setup_component(
hass,
automation.DOMAIN,
{
automation.DOMAIN: [
{
"trigger": {"pl... | [
"async",
"def",
"test_if_selected_option",
"(",
"hass",
":",
"HomeAssistant",
",",
"calls",
":",
"list",
"[",
"ServiceCall",
"]",
")",
"->",
"None",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"automation",
".",
"DOMAIN",
",",
"{",
"au... | [
73,
0
] | [
146,
69
] | python | en | ['en', 'en', 'en'] | True |
test_get_condition_capabilities | (hass: HomeAssistant) | Test we get the expected capabilities from a select condition. | Test we get the expected capabilities from a select condition. | async def test_get_condition_capabilities(hass: HomeAssistant) -> None:
"""Test we get the expected capabilities from a select condition."""
config = {
"platform": "device",
"domain": DOMAIN,
"type": "selected_option",
"entity_id": "select.test",
"option": "option1",
... | [
"async",
"def",
"test_get_condition_capabilities",
"(",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"config",
"=",
"{",
"\"platform\"",
":",
"\"device\"",
",",
"\"domain\"",
":",
"DOMAIN",
",",
"\"type\"",
":",
"\"selected_option\"",
",",
"\"entity_id\""... | [
149,
0
] | [
200,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up Hive thermostat based on a config entry. | Set up Hive thermostat based on a config entry. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up Hive thermostat based on a config entry."""
hive = hass.data[DOMAIN][entry.entry_id]
devices = hive.session.deviceList.get("binary_sensor")
entities = []
if devices:
for dev in devices:
entities.append(HiveB... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"hive",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"devices",
"=",
"hive",
".",
"session",
".",
"deviceList",
".",... | [
27,
0
] | [
36,
38
] | python | en | ['en', 'en', 'en'] | True |
HiveBinarySensorEntity.unique_id | (self) | Return unique ID of entity. | Return unique ID of entity. | def unique_id(self):
"""Return unique ID of entity."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
43,
4
] | [
45,
30
] | python | en | ['en', 'cy', 'en'] | True |
HiveBinarySensorEntity.device_info | (self) | Return device information. | Return device information. | def device_info(self):
"""Return device information."""
return {
"identifiers": {(DOMAIN, self.device["device_id"])},
"name": self.device["device_name"],
"model": self.device["deviceData"]["model"],
"manufacturer": self.device["deviceData"]["manufacturer"]... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"device",
"[",
"\"device_id\"",
"]",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"device",
"[",
"\"device_name\"",
"]",
",",
"\"m... | [
48,
4
] | [
57,
9
] | python | da | ['es', 'da', 'en'] | False |
HiveBinarySensorEntity.device_class | (self) | Return the class of this sensor. | Return the class of this sensor. | def device_class(self):
"""Return the class of this sensor."""
return DEVICETYPE.get(self.device["hiveType"]) | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICETYPE",
".",
"get",
"(",
"self",
".",
"device",
"[",
"\"hiveType\"",
"]",
")"
] | [
60,
4
] | [
62,
54
] | python | en | ['en', 'en', 'en'] | True |
HiveBinarySensorEntity.name | (self) | Return the name of the binary sensor. | Return the name of the binary sensor. | def name(self):
"""Return the name of the binary sensor."""
return self.device["haName"] | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
"[",
"\"haName\"",
"]"
] | [
65,
4
] | [
67,
36
] | python | en | ['en', 'mi', 'en'] | True |
HiveBinarySensorEntity.available | (self) | Return if the device is available. | Return if the device is available. | def available(self):
"""Return if the device is available."""
if self.device["hiveType"] != "Connectivity":
return self.device["deviceData"]["online"]
return True | [
"def",
"available",
"(",
"self",
")",
":",
"if",
"self",
".",
"device",
"[",
"\"hiveType\"",
"]",
"!=",
"\"Connectivity\"",
":",
"return",
"self",
".",
"device",
"[",
"\"deviceData\"",
"]",
"[",
"\"online\"",
"]",
"return",
"True"
] | [
70,
4
] | [
74,
19
] | python | en | ['en', 'en', 'en'] | True |
HiveBinarySensorEntity.extra_state_attributes | (self) | Show Device Attributes. | Show Device Attributes. | def extra_state_attributes(self):
"""Show Device Attributes."""
return {
ATTR_MODE: self.attributes.get(ATTR_MODE),
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_MODE",
":",
"self",
".",
"attributes",
".",
"get",
"(",
"ATTR_MODE",
")",
",",
"}"
] | [
77,
4
] | [
81,
9
] | python | en | ['en', 'en', 'en'] | True |
HiveBinarySensorEntity.is_on | (self) | Return true if the binary sensor is on. | Return true if the binary sensor is on. | def is_on(self):
"""Return true if the binary sensor is on."""
return self.device["status"]["state"] | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"device",
"[",
"\"status\"",
"]",
"[",
"\"state\"",
"]"
] | [
84,
4
] | [
86,
45
] | python | en | ['en', 'fy', 'en'] | True |
HiveBinarySensorEntity.async_update | (self) | Update all Node data from Hive. | Update all Node data from Hive. | async def async_update(self):
"""Update all Node data from Hive."""
await self.hive.session.updateData(self.device)
self.device = await self.hive.sensor.getSensor(self.device)
self.attributes = self.device.get("attributes", {}) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"hive",
".",
"session",
".",
"updateData",
"(",
"self",
".",
"device",
")",
"self",
".",
"device",
"=",
"await",
"self",
".",
"hive",
".",
"sensor",
".",
"getSensor",
"(",
"... | [
88,
4
] | [
92,
59
] | python | en | ['en', 'en', 'en'] | True |
Configuration.__init__ | (self, host=None,
api_key=None, api_key_prefix=None,
username=None, password=None,
discard_unknown_keys=False,
disabled_client_side_validations="",
server_index=None, server_variables=None,
server_operation_index=None,... | Constructor
| Constructor
| def __init__(self, host=None,
api_key=None, api_key_prefix=None,
username=None, password=None,
discard_unknown_keys=False,
disabled_client_side_validations="",
server_index=None, server_variables=None,
server_operation... | [
"def",
"__init__",
"(",
"self",
",",
"host",
"=",
"None",
",",
"api_key",
"=",
"None",
",",
"api_key_prefix",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"discard_unknown_keys",
"=",
"False",
",",
"disabled_client_side_valid... | [
123,
4
] | [
237,
11
] | python | en | ['en', 'en', 'pt'] | False |
Configuration.set_default | (cls, default) | Set default instance of configuration.
It stores default configuration, which can be
returned by get_default_copy method.
:param default: object of Configuration
| Set default instance of configuration. | def set_default(cls, default):
"""Set default instance of configuration.
It stores default configuration, which can be
returned by get_default_copy method.
:param default: object of Configuration
"""
cls._default = copy.deepcopy(default) | [
"def",
"set_default",
"(",
"cls",
",",
"default",
")",
":",
"cls",
".",
"_default",
"=",
"copy",
".",
"deepcopy",
"(",
"default",
")"
] | [
264,
4
] | [
272,
45
] | python | en | ['en', 'fr', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.