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_discovery_connection | (hass, mock_auth, mock_entry_setup) | Test a connection via discovery. | Test a connection via discovery. | async def test_discovery_connection(hass, mock_auth, mock_entry_setup):
"""Test a connection via discovery."""
mock_auth.side_effect = lambda hass, host, code: {"host": host, "gateway_id": "bla"}
flow = await hass.config_entries.flow.async_init(
"tradfri",
context={"source": "homekit"},
... | [
"async",
"def",
"test_discovery_connection",
"(",
"hass",
",",
"mock_auth",
",",
"mock_entry_setup",
")",
":",
"mock_auth",
".",
"side_effect",
"=",
"lambda",
"hass",
",",
"host",
",",
"code",
":",
"{",
"\"host\"",
":",
"host",
",",
"\"gateway_id\"",
":",
"\... | [
77,
0
] | [
99,
5
] | python | en | ['it', 'en', 'en'] | True |
test_import_connection | (hass, mock_auth, mock_entry_setup) | Test a connection via import. | Test a connection via import. | async def test_import_connection(hass, mock_auth, mock_entry_setup):
"""Test a connection via import."""
mock_auth.side_effect = lambda hass, host, code: {
"host": host,
"gateway_id": "bla",
"identity": "mock-iden",
"key": "mock-key",
}
flow = await hass.config_entries.f... | [
"async",
"def",
"test_import_connection",
"(",
"hass",
",",
"mock_auth",
",",
"mock_entry_setup",
")",
":",
"mock_auth",
".",
"side_effect",
"=",
"lambda",
"hass",
",",
"host",
",",
"code",
":",
"{",
"\"host\"",
":",
"host",
",",
"\"gateway_id\"",
":",
"\"bl... | [
102,
0
] | [
130,
48
] | python | en | ['es', 'fr', 'en'] | False |
test_import_connection_no_groups | (hass, mock_auth, mock_entry_setup) | Test a connection via import and no groups allowed. | Test a connection via import and no groups allowed. | async def test_import_connection_no_groups(hass, mock_auth, mock_entry_setup):
"""Test a connection via import and no groups allowed."""
mock_auth.side_effect = lambda hass, host, code: {
"host": host,
"gateway_id": "bla",
"identity": "mock-iden",
"key": "mock-key",
}
fl... | [
"async",
"def",
"test_import_connection_no_groups",
"(",
"hass",
",",
"mock_auth",
",",
"mock_entry_setup",
")",
":",
"mock_auth",
".",
"side_effect",
"=",
"lambda",
"hass",
",",
"host",
",",
"code",
":",
"{",
"\"host\"",
":",
"host",
",",
"\"gateway_id\"",
":... | [
133,
0
] | [
161,
48
] | python | en | ['en', 'en', 'en'] | True |
test_import_connection_legacy | (hass, mock_gateway_info, mock_entry_setup) | Test a connection via import. | Test a connection via import. | async def test_import_connection_legacy(hass, mock_gateway_info, mock_entry_setup):
"""Test a connection via import."""
mock_gateway_info.side_effect = lambda hass, host, identity, key: {
"host": host,
"identity": identity,
"key": key,
"gateway_id": "mock-gateway",
}
res... | [
"async",
"def",
"test_import_connection_legacy",
"(",
"hass",
",",
"mock_gateway_info",
",",
"mock_entry_setup",
")",
":",
"mock_gateway_info",
".",
"side_effect",
"=",
"lambda",
"hass",
",",
"host",
",",
"identity",
",",
"key",
":",
"{",
"\"host\"",
":",
"host"... | [
164,
0
] | [
189,
48
] | python | en | ['es', 'fr', 'en'] | False |
test_import_connection_legacy_no_groups | (
hass, mock_gateway_info, mock_entry_setup
) | Test a connection via legacy import and no groups allowed. | Test a connection via legacy import and no groups allowed. | async def test_import_connection_legacy_no_groups(
hass, mock_gateway_info, mock_entry_setup
):
"""Test a connection via legacy import and no groups allowed."""
mock_gateway_info.side_effect = lambda hass, host, identity, key: {
"host": host,
"identity": identity,
"key": key,
... | [
"async",
"def",
"test_import_connection_legacy_no_groups",
"(",
"hass",
",",
"mock_gateway_info",
",",
"mock_entry_setup",
")",
":",
"mock_gateway_info",
".",
"side_effect",
"=",
"lambda",
"hass",
",",
"host",
",",
"identity",
",",
"key",
":",
"{",
"\"host\"",
":"... | [
192,
0
] | [
219,
48
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_duplicate_aborted | (hass) | Test a duplicate discovery host aborts and updates existing entry. | Test a duplicate discovery host aborts and updates existing entry. | async def test_discovery_duplicate_aborted(hass):
"""Test a duplicate discovery host aborts and updates existing entry."""
entry = MockConfigEntry(
domain="tradfri", data={"host": "some-host"}, unique_id="homekit-id"
)
entry.add_to_hass(hass)
flow = await hass.config_entries.flow.async_init... | [
"async",
"def",
"test_discovery_duplicate_aborted",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"tradfri\"",
",",
"data",
"=",
"{",
"\"host\"",
":",
"\"some-host\"",
"}",
",",
"unique_id",
"=",
"\"homekit-id\"",
")",
"entry",
... | [
222,
0
] | [
238,
43
] | python | en | ['en', 'en', 'en'] | True |
test_import_duplicate_aborted | (hass) | Test a duplicate import host is ignored. | Test a duplicate import host is ignored. | async def test_import_duplicate_aborted(hass):
"""Test a duplicate import host is ignored."""
MockConfigEntry(domain="tradfri", data={"host": "some-host"}).add_to_hass(hass)
flow = await hass.config_entries.flow.async_init(
"tradfri", context={"source": "import"}, data={"host": "some-host"}
)
... | [
"async",
"def",
"test_import_duplicate_aborted",
"(",
"hass",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"\"tradfri\"",
",",
"data",
"=",
"{",
"\"host\"",
":",
"\"some-host\"",
"}",
")",
".",
"add_to_hass",
"(",
"hass",
")",
"flow",
"=",
"await",
"hass... | [
241,
0
] | [
250,
49
] | python | en | ['en', 'en', 'en'] | True |
test_duplicate_discovery | (hass, mock_auth, mock_entry_setup) | Test a duplicate discovery in progress is ignored. | Test a duplicate discovery in progress is ignored. | async def test_duplicate_discovery(hass, mock_auth, mock_entry_setup):
"""Test a duplicate discovery in progress is ignored."""
result = await hass.config_entries.flow.async_init(
"tradfri",
context={"source": "homekit"},
data={"host": "123.123.123.123", "properties": {"id": "homekit-id"... | [
"async",
"def",
"test_duplicate_discovery",
"(",
"hass",
",",
"mock_auth",
",",
"mock_entry_setup",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"\"tradfri\"",
",",
"context",
"=",
"{",
"\"source\"",
":"... | [
253,
0
] | [
269,
63
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_updates_unique_id | (hass) | Test a duplicate discovery host aborts and updates existing entry. | Test a duplicate discovery host aborts and updates existing entry. | async def test_discovery_updates_unique_id(hass):
"""Test a duplicate discovery host aborts and updates existing entry."""
entry = MockConfigEntry(
domain="tradfri",
data={"host": "some-host"},
)
entry.add_to_hass(hass)
flow = await hass.config_entries.flow.async_init(
"trad... | [
"async",
"def",
"test_discovery_updates_unique_id",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"tradfri\"",
",",
"data",
"=",
"{",
"\"host\"",
":",
"\"some-host\"",
"}",
",",
")",
"entry",
".",
"add_to_hass",
"(",
"hass",
"... | [
272,
0
] | [
289,
42
] | python | en | ['en', 'en', 'en'] | True |
facebook | () | Fixture for facebook. | Fixture for facebook. | def facebook():
"""Fixture for facebook."""
access_token = "page-access-token"
return fb.FacebookNotificationService(access_token) | [
"def",
"facebook",
"(",
")",
":",
"access_token",
"=",
"\"page-access-token\"",
"return",
"fb",
".",
"FacebookNotificationService",
"(",
"access_token",
")"
] | [
8,
0
] | [
11,
55
] | python | en | ['en', 'en', 'en'] | True |
test_send_simple_message | (hass, facebook) | Test sending a simple message with success. | Test sending a simple message with success. | async def test_send_simple_message(hass, facebook):
"""Test sending a simple message with success."""
with requests_mock.Mocker() as mock:
mock.register_uri(requests_mock.POST, fb.BASE_URL, status_code=200)
message = "This is just a test"
target = ["+15555551234"]
facebook.send... | [
"async",
"def",
"test_send_simple_message",
"(",
"hass",
",",
"facebook",
")",
":",
"with",
"requests_mock",
".",
"Mocker",
"(",
")",
"as",
"mock",
":",
"mock",
".",
"register_uri",
"(",
"requests_mock",
".",
"POST",
",",
"fb",
".",
"BASE_URL",
",",
"statu... | [
14,
0
] | [
35,
54
] | python | en | ['en', 'en', 'en'] | True |
test_send_multiple_message | (hass, facebook) | Test sending a message to multiple targets. | Test sending a message to multiple targets. | async def test_send_multiple_message(hass, facebook):
"""Test sending a message to multiple targets."""
with requests_mock.Mocker() as mock:
mock.register_uri(requests_mock.POST, fb.BASE_URL, status_code=200)
message = "This is just a test"
targets = ["+15555551234", "+15555551235"]
... | [
"async",
"def",
"test_send_multiple_message",
"(",
"hass",
",",
"facebook",
")",
":",
"with",
"requests_mock",
".",
"Mocker",
"(",
")",
"as",
"mock",
":",
"mock",
".",
"register_uri",
"(",
"requests_mock",
".",
"POST",
",",
"fb",
".",
"BASE_URL",
",",
"sta... | [
38,
0
] | [
61,
48
] | python | en | ['en', 'en', 'en'] | True |
test_send_message_attachment | (hass, facebook) | Test sending a message with a remote attachment. | Test sending a message with a remote attachment. | async def test_send_message_attachment(hass, facebook):
"""Test sending a message with a remote attachment."""
with requests_mock.Mocker() as mock:
mock.register_uri(requests_mock.POST, fb.BASE_URL, status_code=200)
message = "This will be thrown away."
data = {
"attachment"... | [
"async",
"def",
"test_send_message_attachment",
"(",
"hass",
",",
"facebook",
")",
":",
"with",
"requests_mock",
".",
"Mocker",
"(",
")",
"as",
"mock",
":",
"mock",
".",
"register_uri",
"(",
"requests_mock",
".",
"POST",
",",
"fb",
".",
"BASE_URL",
",",
"s... | [
64,
0
] | [
119,
39
] | python | en | ['en', 'en', 'en'] | True |
load_defs | (fname="definitions.json") |
Loads JSON from the definitions file and converts it to a preferred format.
(The definitions file should be drop-in compatible with the one from the
ripple-binary-codec JavaScript package.)
|
Loads JSON from the definitions file and converts it to a preferred format. | def load_defs(fname="definitions.json"):
"""
Loads JSON from the definitions file and converts it to a preferred format.
(The definitions file should be drop-in compatible with the one from the
ripple-binary-codec JavaScript package.)
"""
with open(fname) as definitions_file:
definition... | [
"def",
"load_defs",
"(",
"fname",
"=",
"\"definitions.json\"",
")",
":",
"with",
"open",
"(",
"fname",
")",
"as",
"definitions_file",
":",
"definitions",
"=",
"json",
".",
"load",
"(",
"definitions_file",
")",
"return",
"{",
"\"TYPES\"",
":",
"definitions",
... | [
19,
0
] | [
42,
9
] | python | en | ['en', 'error', 'th'] | False |
field_sort_key | (field_name) | Return a tuple sort key for a given field name | Return a tuple sort key for a given field name | def field_sort_key(field_name):
"""Return a tuple sort key for a given field name"""
field_type_name = DEFINITIONS["FIELDS"][field_name]["type"]
return (DEFINITIONS["TYPES"][field_type_name], DEFINITIONS["FIELDS"][field_name]["nth"]) | [
"def",
"field_sort_key",
"(",
"field_name",
")",
":",
"field_type_name",
"=",
"DEFINITIONS",
"[",
"\"FIELDS\"",
"]",
"[",
"field_name",
"]",
"[",
"\"type\"",
"]",
"return",
"(",
"DEFINITIONS",
"[",
"\"TYPES\"",
"]",
"[",
"field_type_name",
"]",
",",
"DEFINITIO... | [
45,
0
] | [
48,
92
] | python | en | ['en', 'en', 'en'] | True |
field_id | (field_name) |
Returns the unique field ID for a given field name.
This field ID consists of the type code and field code, in 1 to 3 bytes
depending on whether those values are "common" (<16) or "uncommon" (>=16)
|
Returns the unique field ID for a given field name.
This field ID consists of the type code and field code, in 1 to 3 bytes
depending on whether those values are "common" (<16) or "uncommon" (>=16)
| def field_id(field_name):
"""
Returns the unique field ID for a given field name.
This field ID consists of the type code and field code, in 1 to 3 bytes
depending on whether those values are "common" (<16) or "uncommon" (>=16)
"""
field_type_name = DEFINITIONS["FIELDS"][field_name]["type"]
... | [
"def",
"field_id",
"(",
"field_name",
")",
":",
"field_type_name",
"=",
"DEFINITIONS",
"[",
"\"FIELDS\"",
"]",
"[",
"field_name",
"]",
"[",
"\"type\"",
"]",
"type_code",
"=",
"DEFINITIONS",
"[",
"\"TYPES\"",
"]",
"[",
"field_type_name",
"]",
"field_code",
"=",... | [
50,
0
] | [
89,
51
] | python | en | ['en', 'error', 'th'] | False |
vl_encode | (vl_contents) |
Helper function for length-prefixed fields including Blob types
and some AccountID types.
Encodes arbitrary binary data with a length prefix. The length of the prefix
is 1-3 bytes depending on the length of the contents:
Content length <= 192 bytes: prefix is 1 byte
192 bytes < Content length... |
Helper function for length-prefixed fields including Blob types
and some AccountID types. | def vl_encode(vl_contents):
"""
Helper function for length-prefixed fields including Blob types
and some AccountID types.
Encodes arbitrary binary data with a length prefix. The length of the prefix
is 1-3 bytes depending on the length of the contents:
Content length <= 192 bytes: prefix is 1 ... | [
"def",
"vl_encode",
"(",
"vl_contents",
")",
":",
"vl_len",
"=",
"len",
"(",
"vl_contents",
")",
"if",
"vl_len",
"<=",
"192",
":",
"len_byte",
"=",
"vl_len",
".",
"to_bytes",
"(",
"1",
",",
"byteorder",
"=",
"\"big\"",
",",
"signed",
"=",
"False",
")",... | [
91,
0
] | [
120,
73
] | python | en | ['en', 'error', 'th'] | False |
accountid_to_bytes | (address) |
Serialize an AccountID field type. These are length-prefixed.
Some fields contain nested non-length-prefixed AccountIDs directly; those
call decode_address() instead of this function.
|
Serialize an AccountID field type. These are length-prefixed. | def accountid_to_bytes(address):
"""
Serialize an AccountID field type. These are length-prefixed.
Some fields contain nested non-length-prefixed AccountIDs directly; those
call decode_address() instead of this function.
"""
return vl_encode(decode_address(address)) | [
"def",
"accountid_to_bytes",
"(",
"address",
")",
":",
"return",
"vl_encode",
"(",
"decode_address",
"(",
"address",
")",
")"
] | [
125,
0
] | [
132,
45
] | python | en | ['en', 'error', 'th'] | False |
amount_to_bytes | (a) |
Serializes an "Amount" type, which can be either XRP or an issued currency:
- XRP: 64 bits; 0, followed by 1 ("is positive"), followed by 62 bit UInt amount
- Issued Currency: 64 bits of amount, followed by 160 bit currency code and
160 bit issuer AccountID.
|
Serializes an "Amount" type, which can be either XRP or an issued currency:
- XRP: 64 bits; 0, followed by 1 ("is positive"), followed by 62 bit UInt amount
- Issued Currency: 64 bits of amount, followed by 160 bit currency code and
160 bit issuer AccountID.
| def amount_to_bytes(a):
"""
Serializes an "Amount" type, which can be either XRP or an issued currency:
- XRP: 64 bits; 0, followed by 1 ("is positive"), followed by 62 bit UInt amount
- Issued Currency: 64 bits of amount, followed by 160 bit currency code and
160 bit issuer AccountID.
"""
... | [
"def",
"amount_to_bytes",
"(",
"a",
")",
":",
"if",
"type",
"(",
"a",
")",
"==",
"str",
":",
"# is XRP",
"xrp_amt",
"=",
"int",
"(",
"a",
")",
"if",
"(",
"xrp_amt",
">=",
"0",
")",
":",
"assert",
"xrp_amt",
"<=",
"10",
"**",
"17",
"# set the \"is p... | [
134,
0
] | [
163,
82
] | python | en | ['en', 'error', 'th'] | False |
array_to_bytes | (array) |
Serialize an array of objects from decoded JSON.
Each member object must have a type wrapper and an inner object.
For example:
[
{
// wrapper object
"Memo": {
// inner object
"MemoType": "687474703a2f2f6578616d706c652e636f6d2f6d656d6f2f676... |
Serialize an array of objects from decoded JSON.
Each member object must have a type wrapper and an inner object.
For example:
[
{
// wrapper object
"Memo": {
// inner object
"MemoType": "687474703a2f2f6578616d706c652e636f6d2f6d656d6f2f676... | def array_to_bytes(array):
"""
Serialize an array of objects from decoded JSON.
Each member object must have a type wrapper and an inner object.
For example:
[
{
// wrapper object
"Memo": {
// inner object
"MemoType": "687474703a2f2f657... | [
"def",
"array_to_bytes",
"(",
"array",
")",
":",
"members_as_bytes",
"=",
"[",
"]",
"for",
"el",
"in",
"array",
":",
"wrapper_key",
"=",
"list",
"(",
"el",
".",
"keys",
"(",
")",
")",
"[",
"0",
"]",
"inner_obj",
"=",
"el",
"[",
"wrapper_key",
"]",
... | [
165,
0
] | [
187,
37
] | python | en | ['en', 'error', 'th'] | False |
blob_to_bytes | (field_val) |
Serializes a string of hex as binary data with a length prefix.
|
Serializes a string of hex as binary data with a length prefix.
| def blob_to_bytes(field_val):
"""
Serializes a string of hex as binary data with a length prefix.
"""
vl_contents = bytes.fromhex(field_val)
return vl_encode(vl_contents) | [
"def",
"blob_to_bytes",
"(",
"field_val",
")",
":",
"vl_contents",
"=",
"bytes",
".",
"fromhex",
"(",
"field_val",
")",
"return",
"vl_encode",
"(",
"vl_contents",
")"
] | [
189,
0
] | [
194,
33
] | python | en | ['en', 'error', 'th'] | False |
hash128_to_bytes | (contents) |
Serializes a hexadecimal string as binary and confirms that it's 128 bits
|
Serializes a hexadecimal string as binary and confirms that it's 128 bits
| def hash128_to_bytes(contents):
"""
Serializes a hexadecimal string as binary and confirms that it's 128 bits
"""
b = hash_to_bytes(contents)
if len(b) != 16: # 16 bytes = 128 bits
raise ValueError("Hash128 is not 128 bits long")
return b | [
"def",
"hash128_to_bytes",
"(",
"contents",
")",
":",
"b",
"=",
"hash_to_bytes",
"(",
"contents",
")",
"if",
"len",
"(",
"b",
")",
"!=",
"16",
":",
"# 16 bytes = 128 bits",
"raise",
"ValueError",
"(",
"\"Hash128 is not 128 bits long\"",
")",
"return",
"b"
] | [
222,
0
] | [
229,
12
] | python | en | ['en', 'error', 'th'] | False |
hash_to_bytes | (contents) |
Helper function; serializes a hash value from a hexadecimal string
of any length.
|
Helper function; serializes a hash value from a hexadecimal string
of any length.
| def hash_to_bytes(contents):
"""
Helper function; serializes a hash value from a hexadecimal string
of any length.
"""
return bytes.fromhex(field_val) | [
"def",
"hash_to_bytes",
"(",
"contents",
")",
":",
"return",
"bytes",
".",
"fromhex",
"(",
"field_val",
")"
] | [
243,
0
] | [
248,
35
] | python | en | ['en', 'error', 'th'] | False |
object_to_bytes | (obj) |
Serialize an object from decoded JSON.
Each object must have a type wrapper and an inner object. For example:
{
// type wrapper
"SignerEntry": {
// inner object
"Account": "rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v",
"SignerWeight": 1
}
}
Puts ... |
Serialize an object from decoded JSON.
Each object must have a type wrapper and an inner object. For example: | def object_to_bytes(obj):
"""
Serialize an object from decoded JSON.
Each object must have a type wrapper and an inner object. For example:
{
// type wrapper
"SignerEntry": {
// inner object
"Account": "rUpy3eEg8rqjqfUoLeBnZkscbKbFsKXC3v",
"SignerWeig... | [
"def",
"object_to_bytes",
"(",
"obj",
")",
":",
"wrapper_key",
"=",
"list",
"(",
"obj",
".",
"keys",
"(",
")",
")",
"[",
"0",
"]",
"inner_obj",
"=",
"obj",
"[",
"wrapper_key",
"]",
"child_order",
"=",
"sorted",
"(",
"inner_obj",
".",
"keys",
"(",
")"... | [
250,
0
] | [
279,
36
] | python | en | ['en', 'error', 'th'] | False |
pathset_to_bytes | (pathset) |
Serialize a PathSet, which is an array of arrays,
where each inner array represents one possible payment path.
A path consists of "path step" objects in sequence, each with one or
more of "account", "currency", and "issuer" fields, plus (ignored) "type"
and "type_hex" fields which indicate which fi... |
Serialize a PathSet, which is an array of arrays,
where each inner array represents one possible payment path.
A path consists of "path step" objects in sequence, each with one or
more of "account", "currency", and "issuer" fields, plus (ignored) "type"
and "type_hex" fields which indicate which fi... | def pathset_to_bytes(pathset):
"""
Serialize a PathSet, which is an array of arrays,
where each inner array represents one possible payment path.
A path consists of "path step" objects in sequence, each with one or
more of "account", "currency", and "issuer" fields, plus (ignored) "type"
and "ty... | [
"def",
"pathset_to_bytes",
"(",
"pathset",
")",
":",
"if",
"not",
"len",
"(",
"pathset",
")",
":",
"raise",
"ValueError",
"(",
"\"PathSet type must not be empty\"",
")",
"paths_as_bytes",
"=",
"[",
"]",
"for",
"n",
"in",
"range",
"(",
"len",
"(",
"pathset",
... | [
281,
0
] | [
305,
35
] | python | en | ['en', 'error', 'th'] | False |
path_as_bytes | (path) |
Helper function for representing one member of a pathset as a bytes object
|
Helper function for representing one member of a pathset as a bytes object
| def path_as_bytes(path):
"""
Helper function for representing one member of a pathset as a bytes object
"""
if not len(path):
raise ValueError("Path must not be empty")
path_contents = []
for step in path:
step_data = []
type_byte = 0
if "account" in step.keys()... | [
"def",
"path_as_bytes",
"(",
"path",
")",
":",
"if",
"not",
"len",
"(",
"path",
")",
":",
"raise",
"ValueError",
"(",
"\"Path must not be empty\"",
")",
"path_contents",
"=",
"[",
"]",
"for",
"step",
"in",
"path",
":",
"step_data",
"=",
"[",
"]",
"type_b... | [
307,
0
] | [
331,
34
] | python | en | ['en', 'error', 'th'] | False |
tx_type_to_bytes | (txtype) |
TransactionType field is a special case that is written in JSON
as a string name but in binary as a UInt16.
|
TransactionType field is a special case that is written in JSON
as a string name but in binary as a UInt16.
| def tx_type_to_bytes(txtype):
"""
TransactionType field is a special case that is written in JSON
as a string name but in binary as a UInt16.
"""
type_uint = DEFINITIONS["TRANSACTION_TYPES"][txtype]
return uint16_to_bytes(type_uint) | [
"def",
"tx_type_to_bytes",
"(",
"txtype",
")",
":",
"type_uint",
"=",
"DEFINITIONS",
"[",
"\"TRANSACTION_TYPES\"",
"]",
"[",
"txtype",
"]",
"return",
"uint16_to_bytes",
"(",
"type_uint",
")"
] | [
333,
0
] | [
339,
37
] | python | en | ['en', 'error', 'th'] | False |
field_to_bytes | (field_name, field_val) |
Returns a bytes object containing the serialized version of a field
including its field ID prefix.
|
Returns a bytes object containing the serialized version of a field
including its field ID prefix.
| def field_to_bytes(field_name, field_val):
"""
Returns a bytes object containing the serialized version of a field
including its field ID prefix.
"""
field_type = DEFINITIONS["FIELDS"][field_name]["type"]
logger.debug("Serializing field {f} of type {t}".format(f=field_name, t=field_type))
i... | [
"def",
"field_to_bytes",
"(",
"field_name",
",",
"field_val",
")",
":",
"field_type",
"=",
"DEFINITIONS",
"[",
"\"FIELDS\"",
"]",
"[",
"field_name",
"]",
"[",
"\"type\"",
"]",
"logger",
".",
"debug",
"(",
"\"Serializing field {f} of type {t}\"",
".",
"format",
"... | [
354,
0
] | [
385,
48
] | python | en | ['en', 'error', 'th'] | False |
serialize_tx | (tx, for_signing=False) |
Takes a transaction as decoded JSON and returns a bytes object representing
the transaction in binary format.
The input format should omit transaction metadata and the transaction
should be formatted with the transaction instructions at the top level.
("hash" can be included, but will be ignored)
... |
Takes a transaction as decoded JSON and returns a bytes object representing
the transaction in binary format. | def serialize_tx(tx, for_signing=False):
"""
Takes a transaction as decoded JSON and returns a bytes object representing
the transaction in binary format.
The input format should omit transaction metadata and the transaction
should be formatted with the transaction instructions at the top level.
... | [
"def",
"serialize_tx",
"(",
"tx",
",",
"for_signing",
"=",
"False",
")",
":",
"field_order",
"=",
"sorted",
"(",
"tx",
".",
"keys",
"(",
")",
",",
"key",
"=",
"field_sort_key",
")",
"logger",
".",
"debug",
"(",
"\"Canonical field order: %s\"",
"%",
"field_... | [
387,
0
] | [
434,
21
] | python | en | ['en', 'error', 'th'] | False |
async_setup | (hass) | Set up the Z-Wave config API. | Set up the Z-Wave config API. | async def async_setup(hass):
"""Set up the Z-Wave config API."""
hass.http.register_view(
EditKeyBasedConfigView(
"zwave",
"device_config",
CONFIG_PATH,
cv.entity_id,
DEVICE_CONFIG_SCHEMA_ENTRY,
)
)
hass.http.register_view(ZWave... | [
"async",
"def",
"async_setup",
"(",
"hass",
")",
":",
"hass",
".",
"http",
".",
"register_view",
"(",
"EditKeyBasedConfigView",
"(",
"\"zwave\"",
",",
"\"device_config\"",
",",
"CONFIG_PATH",
",",
"cv",
".",
"entity_id",
",",
"DEVICE_CONFIG_SCHEMA_ENTRY",
",",
"... | [
19,
0
] | [
38,
15
] | python | en | ['en', 'pt', 'en'] | True |
ZWaveLogView.get | (self, request) | Retrieve the lines from ZWave log. | Retrieve the lines from ZWave log. | async def get(self, request):
"""Retrieve the lines from ZWave log."""
try:
lines = int(request.query.get("lines", 0))
except ValueError:
return Response(text="Invalid datetime", status=HTTP_BAD_REQUEST)
hass = request.app["hass"]
response = await hass.as... | [
"async",
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"lines",
"=",
"int",
"(",
"request",
".",
"query",
".",
"get",
"(",
"\"lines\"",
",",
"0",
")",
")",
"except",
"ValueError",
":",
"return",
"Response",
"(",
"text",
"=",
"\"I... | [
48,
4
] | [
58,
49
] | python | en | ['en', 'en', 'en'] | True |
ZWaveLogView._get_log | (self, hass, lines) | Retrieve the logfile content. | Retrieve the logfile content. | def _get_log(self, hass, lines):
"""Retrieve the logfile content."""
logfilepath = hass.config.path(OZW_LOG_FILENAME)
with open(logfilepath) as logfile:
data = (line.rstrip() for line in logfile)
if lines == 0:
loglines = list(data)
else:
... | [
"def",
"_get_log",
"(",
"self",
",",
"hass",
",",
"lines",
")",
":",
"logfilepath",
"=",
"hass",
".",
"config",
".",
"path",
"(",
"OZW_LOG_FILENAME",
")",
"with",
"open",
"(",
"logfilepath",
")",
"as",
"logfile",
":",
"data",
"=",
"(",
"line",
".",
"... | [
60,
4
] | [
69,
23
] | python | en | ['en', 'en', 'en'] | True |
ZWaveConfigWriteView.post | (self, request) | Save cache configuration to zwcfg_xxxxx.xml. | Save cache configuration to zwcfg_xxxxx.xml. | def post(self, request):
"""Save cache configuration to zwcfg_xxxxx.xml."""
hass = request.app["hass"]
network = hass.data.get(const.DATA_NETWORK)
if network is None:
return self.json_message("No Z-Wave network data found", HTTP_NOT_FOUND)
_LOGGER.info("Z-Wave configu... | [
"def",
"post",
"(",
"self",
",",
"request",
")",
":",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"network",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"const",
".",
"DATA_NETWORK",
")",
"if",
"network",
"is",
"None",
":",
"return",
"... | [
79,
4
] | [
87,
79
] | python | en | ['en', 'de', 'en'] | True |
ZWaveNodeValueView.get | (self, request, node_id) | Retrieve groups of node. | Retrieve groups of node. | def get(self, request, node_id):
"""Retrieve groups of node."""
nodeid = int(node_id)
hass = request.app["hass"]
values_list = hass.data[const.DATA_ENTITY_VALUES]
values_data = {}
# Return a list of values for this node that are used as a
# primary value for an e... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"node_id",
")",
":",
"nodeid",
"=",
"int",
"(",
"node_id",
")",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"values_list",
"=",
"hass",
".",
"data",
"[",
"const",
".",
"DATA_ENTITY_VALUES",
... | [
97,
4
] | [
116,
37
] | python | en | ['en', 'pt', 'en'] | True |
ZWaveNodeGroupView.get | (self, request, node_id) | Retrieve groups of node. | Retrieve groups of node. | def get(self, request, node_id):
"""Retrieve groups of node."""
nodeid = int(node_id)
hass = request.app["hass"]
network = hass.data.get(const.DATA_NETWORK)
node = network.nodes.get(nodeid)
if node is None:
return self.json_message("Node not found", HTTP_NOT_F... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"node_id",
")",
":",
"nodeid",
"=",
"int",
"(",
"node_id",
")",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"network",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"const",
".",
"DATA_NETW... | [
126,
4
] | [
143,
32
] | python | en | ['en', 'pt', 'en'] | True |
ZWaveNodeConfigView.get | (self, request, node_id) | Retrieve configurations of node. | Retrieve configurations of node. | def get(self, request, node_id):
"""Retrieve configurations of node."""
nodeid = int(node_id)
hass = request.app["hass"]
network = hass.data.get(const.DATA_NETWORK)
node = network.nodes.get(nodeid)
if node is None:
return self.json_message("Node not found", HT... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"node_id",
")",
":",
"nodeid",
"=",
"int",
"(",
"node_id",
")",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"network",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"const",
".",
"DATA_NETW... | [
153,
4
] | [
174,
32
] | python | en | ['en', 'pt', 'en'] | True |
ZWaveUserCodeView.get | (self, request, node_id) | Retrieve usercodes of node. | Retrieve usercodes of node. | def get(self, request, node_id):
"""Retrieve usercodes of node."""
nodeid = int(node_id)
hass = request.app["hass"]
network = hass.data.get(const.DATA_NETWORK)
node = network.nodes.get(nodeid)
if node is None:
return self.json_message("Node not found", HTTP_NO... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"node_id",
")",
":",
"nodeid",
"=",
"int",
"(",
"node_id",
")",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"network",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"const",
".",
"DATA_NETW... | [
184,
4
] | [
203,
35
] | python | en | ['en', 'sr', 'en'] | True |
ZWaveProtectionView.get | (self, request, node_id) | Retrieve the protection commandclass options of node. | Retrieve the protection commandclass options of node. | async def get(self, request, node_id):
"""Retrieve the protection commandclass options of node."""
nodeid = int(node_id)
hass = request.app["hass"]
network = hass.data.get(const.DATA_NETWORK)
def _fetch_protection():
"""Get protection data."""
node = netw... | [
"async",
"def",
"get",
"(",
"self",
",",
"request",
",",
"node_id",
")",
":",
"nodeid",
"=",
"int",
"(",
"node_id",
")",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"network",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"const",
".",
... | [
212,
4
] | [
234,
67
] | python | en | ['en', 'pt', 'en'] | True |
ZWaveProtectionView.post | (self, request, node_id) | Change the selected option in protection commandclass. | Change the selected option in protection commandclass. | async def post(self, request, node_id):
"""Change the selected option in protection commandclass."""
nodeid = int(node_id)
hass = request.app["hass"]
network = hass.data.get(const.DATA_NETWORK)
protection_data = await request.json()
def _set_protection():
"""... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
",",
"node_id",
")",
":",
"nodeid",
"=",
"int",
"(",
"node_id",
")",
"hass",
"=",
"request",
".",
"app",
"[",
"\"hass\"",
"]",
"network",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"const",
".",
... | [
236,
4
] | [
261,
65
] | python | en | ['en', 'en', 'en'] | True |
spider_fixture | () | Patch libraries. | Patch libraries. | def spider_fixture() -> Mock:
"""Patch libraries."""
with patch("homeassistant.components.spider.config_flow.SpiderApi") as spider:
yield spider | [
"def",
"spider_fixture",
"(",
")",
"->",
"Mock",
":",
"with",
"patch",
"(",
"\"homeassistant.components.spider.config_flow.SpiderApi\"",
")",
"as",
"spider",
":",
"yield",
"spider"
] | [
20,
0
] | [
23,
20
] | python | en | ['en', 'en', 'en'] | False |
test_user | (hass, spider) | Test user config. | Test user config. | async def test_user(hass, spider):
"""Test user config."""
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_user",
"(",
"hass",
",",
"spider",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
... | [
26,
0
] | [
53,
48
] | python | en | ['en', 'da', 'en'] | True |
test_import | (hass, spider) | Test import step. | Test import step. | async def test_import(hass, spider):
"""Test import step."""
await setup.async_setup_component(hass, "persistent_notification", {})
with patch(
"homeassistant.components.spider.async_setup",
return_value=True,
) as mock_setup, patch(
"homeassistant.components.spider.async_setup_e... | [
"async",
"def",
"test_import",
"(",
"hass",
",",
"spider",
")",
":",
"await",
"setup",
".",
"async_setup_component",
"(",
"hass",
",",
"\"persistent_notification\"",
",",
"{",
"}",
")",
"with",
"patch",
"(",
"\"homeassistant.components.spider.async_setup\"",
",",
... | [
56,
0
] | [
80,
48
] | python | de | ['de', 'sd', 'en'] | False |
test_abort_if_already_setup | (hass, spider) | Test we abort if Spider is already setup. | Test we abort if Spider is already setup. | async def test_abort_if_already_setup(hass, spider):
"""Test we abort if Spider is already setup."""
MockConfigEntry(domain=DOMAIN, data=SPIDER_USER_DATA).add_to_hass(hass)
# Should fail, config exist (import)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config... | [
"async",
"def",
"test_abort_if_already_setup",
"(",
"hass",
",",
"spider",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"SPIDER_USER_DATA",
")",
".",
"add_to_hass",
"(",
"hass",
")",
"# Should fail, config exist (import)",
"result",
... | [
83,
0
] | [
101,
56
] | python | en | ['en', 'de', 'en'] | True |
test_get_entity | (hass, hass_client) | Test getting entity. | Test getting entity. | async def test_get_entity(hass, hass_client):
"""Test getting entity."""
with patch.object(config, "SECTIONS", ["customize"]):
await async_setup_component(hass, "config", {})
client = await hass_client()
def mock_read(path):
"""Mock reading data."""
return {"hello.beer": {"free... | [
"async",
"def",
"test_get_entity",
"(",
"hass",
",",
"hass_client",
")",
":",
"with",
"patch",
".",
"object",
"(",
"config",
",",
"\"SECTIONS\"",
",",
"[",
"\"customize\"",
"]",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"config\"",
",",... | [
10,
0
] | [
28,
76
] | python | cy | ['nl', 'cy', 'en'] | False |
test_update_entity | (hass, hass_client) | Test updating entity. | Test updating entity. | async def test_update_entity(hass, hass_client):
"""Test updating entity."""
with patch.object(config, "SECTIONS", ["customize"]):
await async_setup_component(hass, "config", {})
client = await hass_client()
orig_data = {
"hello.beer": {"ignored": True},
"other.entity": {"polli... | [
"async",
"def",
"test_update_entity",
"(",
"hass",
",",
"hass_client",
")",
":",
"with",
"patch",
".",
"object",
"(",
"config",
",",
"\"SECTIONS\"",
",",
"[",
"\"customize\"",
"]",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"config\"",
"... | [
31,
0
] | [
83,
34
] | python | en | ['en', 'en', 'en'] | True |
test_update_entity_invalid_key | (hass, hass_client) | Test updating entity. | Test updating entity. | async def test_update_entity_invalid_key(hass, hass_client):
"""Test updating entity."""
with patch.object(config, "SECTIONS", ["customize"]):
await async_setup_component(hass, "config", {})
client = await hass_client()
resp = await client.post(
"/api/config/customize/config/not_entity... | [
"async",
"def",
"test_update_entity_invalid_key",
"(",
"hass",
",",
"hass_client",
")",
":",
"with",
"patch",
".",
"object",
"(",
"config",
",",
"\"SECTIONS\"",
",",
"[",
"\"customize\"",
"]",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"co... | [
86,
0
] | [
97,
29
] | python | en | ['en', 'en', 'en'] | True |
test_update_entity_invalid_json | (hass, hass_client) | Test updating entity. | Test updating entity. | async def test_update_entity_invalid_json(hass, hass_client):
"""Test updating entity."""
with patch.object(config, "SECTIONS", ["customize"]):
await async_setup_component(hass, "config", {})
client = await hass_client()
resp = await client.post("/api/config/customize/config/hello.beer", data=... | [
"async",
"def",
"test_update_entity_invalid_json",
"(",
"hass",
",",
"hass_client",
")",
":",
"with",
"patch",
".",
"object",
"(",
"config",
",",
"\"SECTIONS\"",
",",
"[",
"\"customize\"",
"]",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"c... | [
100,
0
] | [
109,
29
] | python | en | ['en', 'en', 'en'] | True |
test_sensor_availability | (
hass, caplog, legacy_patchable_time, pvpc_aioclient_mock: AiohttpClientMocker
) | Test sensor availability and handling of cloud access. | Test sensor availability and handling of cloud access. | async def test_sensor_availability(
hass, caplog, legacy_patchable_time, pvpc_aioclient_mock: AiohttpClientMocker
):
"""Test sensor availability and handling of cloud access."""
hass.config.time_zone = timezone("Europe/Madrid")
config = {DOMAIN: [{CONF_NAME: "test_dst", ATTR_TARIFF: "discrimination"}]}
... | [
"async",
"def",
"test_sensor_availability",
"(",
"hass",
",",
"caplog",
",",
"legacy_patchable_time",
",",
"pvpc_aioclient_mock",
":",
"AiohttpClientMocker",
")",
":",
"hass",
".",
"config",
".",
"time_zone",
"=",
"timezone",
"(",
"\"Europe/Madrid\"",
")",
"config",... | [
30,
0
] | [
87,
63
] | python | en | ['en', 'en', 'en'] | True |
DeploymentValidator.validate_and_fill_dict | (template_dict: dict, actual_dict: dict, optional_key_to_value: dict) | Validate incoming actual_dict with template_dict, and fill optional keys to the template.
We use deepDiff to find missing keys in the actual_dict, see
https://deepdiff.readthedocs.io/en/latest/diff.html#deepdiff-reference for reference.
Args:
template_dict (dict): template dict, we... | Validate incoming actual_dict with template_dict, and fill optional keys to the template. | def validate_and_fill_dict(template_dict: dict, actual_dict: dict, optional_key_to_value: dict) -> None:
"""Validate incoming actual_dict with template_dict, and fill optional keys to the template.
We use deepDiff to find missing keys in the actual_dict, see
https://deepdiff.readthedocs.io/en/l... | [
"def",
"validate_and_fill_dict",
"(",
"template_dict",
":",
"dict",
",",
"actual_dict",
":",
"dict",
",",
"optional_key_to_value",
":",
"dict",
")",
"->",
"None",
":",
"deep_diff",
"=",
"DeepDiff",
"(",
"template_dict",
",",
"actual_dict",
")",
".",
"to_dict",
... | [
14,
4
] | [
39,
17
] | python | en | ['en', 'en', 'en'] | True |
DeploymentValidator._set_value | (original_dict: dict, key_list: list, value) | Set the value to the original dict based on the key_list.
Args:
original_dict (dict): original dict that needs to be modified.
key_list (list): the parent to child path of keys, which describes that position of the value.
value: the value needs to be set.
Returns:
... | Set the value to the original dict based on the key_list. | def _set_value(original_dict: dict, key_list: list, value) -> None:
"""Set the value to the original dict based on the key_list.
Args:
original_dict (dict): original dict that needs to be modified.
key_list (list): the parent to child path of keys, which describes that position ... | [
"def",
"_set_value",
"(",
"original_dict",
":",
"dict",
",",
"key_list",
":",
"list",
",",
"value",
")",
"->",
"None",
":",
"DeploymentValidator",
".",
"_get_sub_structure_of_dict",
"(",
"original_dict",
",",
"key_list",
"[",
":",
"-",
"1",
"]",
")",
"[",
... | [
42,
4
] | [
53,
106
] | python | en | ['en', 'en', 'en'] | True |
DeploymentValidator._get_parent_to_child_key_list | (deep_diff_str: str) | Get parent to child key list by parsing the deep_diff_str.
Args:
deep_diff_str (str): a specially defined string that indicate the position of the key.
e.g. "root['a']['b']" -> {"a": {"b": value}}.
Returns:
list: the parent to child path of keys.
| Get parent to child key list by parsing the deep_diff_str. | def _get_parent_to_child_key_list(deep_diff_str: str) -> list:
"""Get parent to child key list by parsing the deep_diff_str.
Args:
deep_diff_str (str): a specially defined string that indicate the position of the key.
e.g. "root['a']['b']" -> {"a": {"b": value}}.
Re... | [
"def",
"_get_parent_to_child_key_list",
"(",
"deep_diff_str",
":",
"str",
")",
"->",
"list",
":",
"deep_diff_str",
"=",
"deep_diff_str",
".",
"strip",
"(",
"\"root['\"",
")",
"deep_diff_str",
"=",
"deep_diff_str",
".",
"strip",
"(",
"\"']\"",
")",
"return",
"dee... | [
56,
4
] | [
69,
42
] | python | en | ['en', 'en', 'en'] | True |
DeploymentValidator._get_sub_structure_of_dict | (original_dict: dict, key_list: list) | Get sub structure of dict from original_dict and key_list using reduce.
Args:
original_dict (dict): original dict that needs to be modified.
key_list (list): the parent to child path of keys, which describes that position of the value.
Returns:
dict: sub structure o... | Get sub structure of dict from original_dict and key_list using reduce. | def _get_sub_structure_of_dict(original_dict: dict, key_list: list) -> dict:
"""Get sub structure of dict from original_dict and key_list using reduce.
Args:
original_dict (dict): original dict that needs to be modified.
key_list (list): the parent to child path of keys, which d... | [
"def",
"_get_sub_structure_of_dict",
"(",
"original_dict",
":",
"dict",
",",
"key_list",
":",
"list",
")",
"->",
"dict",
":",
"return",
"reduce",
"(",
"operator",
".",
"getitem",
",",
"key_list",
",",
"original_dict",
")"
] | [
72,
4
] | [
83,
64
] | python | en | ['en', 'en', 'en'] | True |
setup | (hass, config) | Set up for the Asterisk Voicemail box. | Set up for the Asterisk Voicemail box. | def setup(hass, config):
"""Set up for the Asterisk Voicemail box."""
conf = config.get(DOMAIN)
host = conf[CONF_HOST]
port = conf[CONF_PORT]
password = conf[CONF_PASSWORD]
hass.data[DOMAIN] = AsteriskData(hass, host, port, password, config)
return True | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"host",
"=",
"conf",
"[",
"CONF_HOST",
"]",
"port",
"=",
"conf",
"[",
"CONF_PORT",
"]",
"password",
"=",
"conf",
"[",
"CONF_PASSWORD",
"]",
... | [
41,
0
] | [
51,
15
] | python | en | ['en', 'en', 'en'] | True |
AsteriskData.__init__ | (self, hass, host, port, password, config) | Init the Asterisk data object. | Init the Asterisk data object. | def __init__(self, hass, host, port, password, config):
"""Init the Asterisk data object."""
self.hass = hass
self.config = config
self.messages = None
self.cdr = None
dispatcher_connect(self.hass, SIGNAL_MESSAGE_REQUEST, self._request_messages)
dispatcher_conne... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"host",
",",
"port",
",",
"password",
",",
"config",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"config",
"=",
"config",
"self",
".",
"messages",
"=",
"None",
"self",
".",
"cdr",
"=",
... | [
57,
4
] | [
69,
76
] | python | en | ['en', 'en', 'en'] | True |
AsteriskData.handle_data | (self, command, msg) | Handle changes to the mailbox. | Handle changes to the mailbox. | def handle_data(self, command, msg):
"""Handle changes to the mailbox."""
if command == CMD_MESSAGE_LIST:
_LOGGER.debug("AsteriskVM sent updated message list: Len %d", len(msg))
old_messages = self.messages
self.messages = sorted(
msg, key=lambda item... | [
"def",
"handle_data",
"(",
"self",
",",
"command",
",",
"msg",
")",
":",
"if",
"command",
"==",
"CMD_MESSAGE_LIST",
":",
"_LOGGER",
".",
"debug",
"(",
"\"AsteriskVM sent updated message list: Len %d\"",
",",
"len",
"(",
"msg",
")",
")",
"old_messages",
"=",
"s... | [
81,
4
] | [
110,
13
] | python | en | ['en', 'en', 'en'] | True |
AsteriskData._request_messages | (self) | Handle changes to the mailbox. | Handle changes to the mailbox. | def _request_messages(self):
"""Handle changes to the mailbox."""
_LOGGER.debug("Requesting message list")
self.client.messages() | [
"def",
"_request_messages",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Requesting message list\"",
")",
"self",
".",
"client",
".",
"messages",
"(",
")"
] | [
113,
4
] | [
116,
30
] | python | en | ['en', 'en', 'en'] | True |
AsteriskData._request_cdr | (self) | Handle changes to the CDR. | Handle changes to the CDR. | def _request_cdr(self):
"""Handle changes to the CDR."""
_LOGGER.debug("Requesting CDR list")
self.client.get_cdr() | [
"def",
"_request_cdr",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Requesting CDR list\"",
")",
"self",
".",
"client",
".",
"get_cdr",
"(",
")"
] | [
119,
4
] | [
122,
29
] | python | en | ['en', 'en', 'en'] | True |
is_on | (hass, entity_id) | Return if the vacuum is on based on the statemachine. | Return if the vacuum is on based on the statemachine. | def is_on(hass, entity_id):
"""Return if the vacuum is on based on the statemachine."""
return hass.states.is_state(entity_id, STATE_ON) | [
"def",
"is_on",
"(",
"hass",
",",
"entity_id",
")",
":",
"return",
"hass",
".",
"states",
".",
"is_state",
"(",
"entity_id",
",",
"STATE_ON",
")"
] | [
79,
0
] | [
81,
52
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the vacuum component. | Set up the vacuum component. | async def async_setup(hass, config):
"""Set up the vacuum component."""
component = hass.data[DOMAIN] = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
)
await component.async_setup(config)
component.async_register_entity_service(SERVICE_TURN_ON, {}, "async_turn_on")
component.as... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"component",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"EntityComponent",
"(",
"_LOGGER",
",",
"DOMAIN",
",",
"hass",
",",
"SCAN_INTERVAL",
")",
"await",
"component",
".",
"asy... | [
84,
0
] | [
120,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry) | Set up a config entry. | Set up a config entry. | async def async_setup_entry(hass, entry):
"""Set up a config entry."""
return await hass.data[DOMAIN].async_setup_entry(entry) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"return",
"await",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"async_setup_entry",
"(",
"entry",
")"
] | [
123,
0
] | [
125,
59
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, entry):
"""Unload a config entry."""
return await hass.data[DOMAIN].async_unload_entry(entry) | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"return",
"await",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"async_unload_entry",
"(",
"entry",
")"
] | [
128,
0
] | [
130,
60
] | python | en | ['en', 'es', 'en'] | True |
_BaseVacuum.supported_features | (self) | Flag vacuum cleaner features that are supported. | Flag vacuum cleaner features that are supported. | def supported_features(self):
"""Flag vacuum cleaner features that are supported."""
raise NotImplementedError() | [
"def",
"supported_features",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
140,
4
] | [
142,
35
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.battery_level | (self) | Return the battery level of the vacuum cleaner. | Return the battery level of the vacuum cleaner. | def battery_level(self):
"""Return the battery level of the vacuum cleaner."""
return None | [
"def",
"battery_level",
"(",
"self",
")",
":",
"return",
"None"
] | [
145,
4
] | [
147,
19
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.battery_icon | (self) | Return the battery icon for the vacuum cleaner. | Return the battery icon for the vacuum cleaner. | def battery_icon(self):
"""Return the battery icon for the vacuum cleaner."""
raise NotImplementedError() | [
"def",
"battery_icon",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
150,
4
] | [
152,
35
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.fan_speed | (self) | Return the fan speed of the vacuum cleaner. | Return the fan speed of the vacuum cleaner. | def fan_speed(self):
"""Return the fan speed of the vacuum cleaner."""
return None | [
"def",
"fan_speed",
"(",
"self",
")",
":",
"return",
"None"
] | [
155,
4
] | [
157,
19
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.fan_speed_list | (self) | Get the list of available fan speed steps of the vacuum cleaner. | Get the list of available fan speed steps of the vacuum cleaner. | def fan_speed_list(self):
"""Get the list of available fan speed steps of the vacuum cleaner."""
raise NotImplementedError() | [
"def",
"fan_speed_list",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
160,
4
] | [
162,
35
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.capability_attributes | (self) | Return capability attributes. | Return capability attributes. | def capability_attributes(self):
"""Return capability attributes."""
if self.supported_features & SUPPORT_FAN_SPEED:
return {ATTR_FAN_SPEED_LIST: self.fan_speed_list} | [
"def",
"capability_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_FAN_SPEED",
":",
"return",
"{",
"ATTR_FAN_SPEED_LIST",
":",
"self",
".",
"fan_speed_list",
"}"
] | [
165,
4
] | [
168,
61
] | python | en | ['en', 'la', 'en'] | True |
_BaseVacuum.state_attributes | (self) | Return the state attributes of the vacuum cleaner. | Return the state attributes of the vacuum cleaner. | def state_attributes(self):
"""Return the state attributes of the vacuum cleaner."""
data = {}
if self.supported_features & SUPPORT_BATTERY:
data[ATTR_BATTERY_LEVEL] = self.battery_level
data[ATTR_BATTERY_ICON] = self.battery_icon
if self.supported_features & SU... | [
"def",
"state_attributes",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_BATTERY",
":",
"data",
"[",
"ATTR_BATTERY_LEVEL",
"]",
"=",
"self",
".",
"battery_level",
"data",
"[",
"ATTR_BATTERY_ICON",
"]",
"... | [
171,
4
] | [
182,
19
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.stop | (self, **kwargs) | Stop the vacuum cleaner. | Stop the vacuum cleaner. | def stop(self, **kwargs):
"""Stop the vacuum cleaner."""
raise NotImplementedError() | [
"def",
"stop",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
184,
4
] | [
186,
35
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.async_stop | (self, **kwargs) | Stop the vacuum cleaner.
This method must be run in the event loop.
| Stop the vacuum cleaner. | async def async_stop(self, **kwargs):
"""Stop the vacuum cleaner.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(partial(self.stop, **kwargs)) | [
"async",
"def",
"async_stop",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"stop",
",",
"*",
"*",
"kwargs",
")",
")"
] | [
188,
4
] | [
193,
76
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.return_to_base | (self, **kwargs) | Set the vacuum cleaner to return to the dock. | Set the vacuum cleaner to return to the dock. | def return_to_base(self, **kwargs):
"""Set the vacuum cleaner to return to the dock."""
raise NotImplementedError() | [
"def",
"return_to_base",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
195,
4
] | [
197,
35
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.async_return_to_base | (self, **kwargs) | Set the vacuum cleaner to return to the dock.
This method must be run in the event loop.
| Set the vacuum cleaner to return to the dock. | async def async_return_to_base(self, **kwargs):
"""Set the vacuum cleaner to return to the dock.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(partial(self.return_to_base, **kwargs)) | [
"async",
"def",
"async_return_to_base",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"return_to_base",
",",
"*",
"*",
"kwargs",
")",
")"
] | [
199,
4
] | [
204,
86
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.clean_spot | (self, **kwargs) | Perform a spot clean-up. | Perform a spot clean-up. | def clean_spot(self, **kwargs):
"""Perform a spot clean-up."""
raise NotImplementedError() | [
"def",
"clean_spot",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
206,
4
] | [
208,
35
] | python | en | ['pt', 'en', 'en'] | True |
_BaseVacuum.async_clean_spot | (self, **kwargs) | Perform a spot clean-up.
This method must be run in the event loop.
| Perform a spot clean-up. | async def async_clean_spot(self, **kwargs):
"""Perform a spot clean-up.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(partial(self.clean_spot, **kwargs)) | [
"async",
"def",
"async_clean_spot",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"clean_spot",
",",
"*",
"*",
"kwargs",
")",
")"
] | [
210,
4
] | [
215,
82
] | python | en | ['pt', 'en', 'en'] | True |
_BaseVacuum.locate | (self, **kwargs) | Locate the vacuum cleaner. | Locate the vacuum cleaner. | def locate(self, **kwargs):
"""Locate the vacuum cleaner."""
raise NotImplementedError() | [
"def",
"locate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
217,
4
] | [
219,
35
] | python | en | ['en', 'la', 'en'] | True |
_BaseVacuum.async_locate | (self, **kwargs) | Locate the vacuum cleaner.
This method must be run in the event loop.
| Locate the vacuum cleaner. | async def async_locate(self, **kwargs):
"""Locate the vacuum cleaner.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(partial(self.locate, **kwargs)) | [
"async",
"def",
"async_locate",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"locate",
",",
"*",
"*",
"kwargs",
")",
")"
] | [
221,
4
] | [
226,
78
] | python | en | ['en', 'la', 'en'] | True |
_BaseVacuum.set_fan_speed | (self, fan_speed, **kwargs) | Set fan speed. | Set fan speed. | def set_fan_speed(self, fan_speed, **kwargs):
"""Set fan speed."""
raise NotImplementedError() | [
"def",
"set_fan_speed",
"(",
"self",
",",
"fan_speed",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
228,
4
] | [
230,
35
] | python | fy | ['sv', 'fy', 'ur'] | False |
_BaseVacuum.async_set_fan_speed | (self, fan_speed, **kwargs) | Set fan speed.
This method must be run in the event loop.
| Set fan speed. | async def async_set_fan_speed(self, fan_speed, **kwargs):
"""Set fan speed.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(
partial(self.set_fan_speed, fan_speed, **kwargs)
) | [
"async",
"def",
"async_set_fan_speed",
"(",
"self",
",",
"fan_speed",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"set_fan_speed",
",",
"fan_speed",
",",
"*",
"*",
"kwarg... | [
232,
4
] | [
239,
9
] | python | fy | ['sv', 'fy', 'ur'] | False |
_BaseVacuum.send_command | (self, command, params=None, **kwargs) | Send a command to a vacuum cleaner. | Send a command to a vacuum cleaner. | def send_command(self, command, params=None, **kwargs):
"""Send a command to a vacuum cleaner."""
raise NotImplementedError() | [
"def",
"send_command",
"(",
"self",
",",
"command",
",",
"params",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
241,
4
] | [
243,
35
] | python | en | ['en', 'en', 'en'] | True |
_BaseVacuum.async_send_command | (self, command, params=None, **kwargs) | Send a command to a vacuum cleaner.
This method must be run in the event loop.
| Send a command to a vacuum cleaner. | async def async_send_command(self, command, params=None, **kwargs):
"""Send a command to a vacuum cleaner.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(
partial(self.send_command, command, params=params, **kwargs)
) | [
"async",
"def",
"async_send_command",
"(",
"self",
",",
"command",
",",
"params",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"send_command",
",",
"command",... | [
245,
4
] | [
252,
9
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.status | (self) | Return the status of the vacuum cleaner. | Return the status of the vacuum cleaner. | def status(self):
"""Return the status of the vacuum cleaner."""
return None | [
"def",
"status",
"(",
"self",
")",
":",
"return",
"None"
] | [
259,
4
] | [
261,
19
] | python | en | ['en', 'la', 'en'] | True |
VacuumEntity.battery_icon | (self) | Return the battery icon for the vacuum cleaner. | Return the battery icon for the vacuum cleaner. | def battery_icon(self):
"""Return the battery icon for the vacuum cleaner."""
charging = False
if self.status is not None:
charging = "charg" in self.status.lower()
return icon_for_battery_level(
battery_level=self.battery_level, charging=charging
) | [
"def",
"battery_icon",
"(",
"self",
")",
":",
"charging",
"=",
"False",
"if",
"self",
".",
"status",
"is",
"not",
"None",
":",
"charging",
"=",
"\"charg\"",
"in",
"self",
".",
"status",
".",
"lower",
"(",
")",
"return",
"icon_for_battery_level",
"(",
"ba... | [
264,
4
] | [
271,
9
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.state_attributes | (self) | Return the state attributes of the vacuum cleaner. | Return the state attributes of the vacuum cleaner. | def state_attributes(self):
"""Return the state attributes of the vacuum cleaner."""
data = super().state_attributes
if self.supported_features & SUPPORT_STATUS:
data[ATTR_STATUS] = self.status
return data | [
"def",
"state_attributes",
"(",
"self",
")",
":",
"data",
"=",
"super",
"(",
")",
".",
"state_attributes",
"if",
"self",
".",
"supported_features",
"&",
"SUPPORT_STATUS",
":",
"data",
"[",
"ATTR_STATUS",
"]",
"=",
"self",
".",
"status",
"return",
"data"
] | [
274,
4
] | [
281,
19
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.turn_on | (self, **kwargs) | Turn the vacuum on and start cleaning. | Turn the vacuum on and start cleaning. | def turn_on(self, **kwargs):
"""Turn the vacuum on and start cleaning."""
raise NotImplementedError() | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
283,
4
] | [
285,
35
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.async_turn_on | (self, **kwargs) | Turn the vacuum on and start cleaning.
This method must be run in the event loop.
| Turn the vacuum on and start cleaning. | async def async_turn_on(self, **kwargs):
"""Turn the vacuum on and start cleaning.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(partial(self.turn_on, **kwargs)) | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"turn_on",
",",
"*",
"*",
"kwargs",
")",
")"
] | [
287,
4
] | [
292,
79
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.turn_off | (self, **kwargs) | Turn the vacuum off stopping the cleaning and returning home. | Turn the vacuum off stopping the cleaning and returning home. | def turn_off(self, **kwargs):
"""Turn the vacuum off stopping the cleaning and returning home."""
raise NotImplementedError() | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
294,
4
] | [
296,
35
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.async_turn_off | (self, **kwargs) | Turn the vacuum off stopping the cleaning and returning home.
This method must be run in the event loop.
| Turn the vacuum off stopping the cleaning and returning home. | async def async_turn_off(self, **kwargs):
"""Turn the vacuum off stopping the cleaning and returning home.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(partial(self.turn_off, **kwargs)) | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"turn_off",
",",
"*",
"*",
"kwargs",
")",
")"
] | [
298,
4
] | [
303,
80
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.start_pause | (self, **kwargs) | Start, pause or resume the cleaning task. | Start, pause or resume the cleaning task. | def start_pause(self, **kwargs):
"""Start, pause or resume the cleaning task."""
raise NotImplementedError() | [
"def",
"start_pause",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
305,
4
] | [
307,
35
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.async_start_pause | (self, **kwargs) | Start, pause or resume the cleaning task.
This method must be run in the event loop.
| Start, pause or resume the cleaning task. | async def async_start_pause(self, **kwargs):
"""Start, pause or resume the cleaning task.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(partial(self.start_pause, **kwargs)) | [
"async",
"def",
"async_start_pause",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"partial",
"(",
"self",
".",
"start_pause",
",",
"*",
"*",
"kwargs",
")",
")"
] | [
309,
4
] | [
314,
83
] | python | en | ['en', 'en', 'en'] | True |
VacuumEntity.async_pause | (self) | Not supported. | Not supported. | async def async_pause(self):
"""Not supported.""" | [
"async",
"def",
"async_pause",
"(",
"self",
")",
":"
] | [
316,
4
] | [
317,
28
] | python | en | ['de', 'en', 'en'] | False |
VacuumEntity.async_start | (self) | Not supported. | Not supported. | async def async_start(self):
"""Not supported.""" | [
"async",
"def",
"async_start",
"(",
"self",
")",
":"
] | [
319,
4
] | [
320,
28
] | python | en | ['de', 'en', 'en'] | False |
VacuumDevice.__init_subclass__ | (cls, **kwargs) | Print deprecation warning. | Print deprecation warning. | def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"VacuumDevice is deprecated, modify %s to extend VacuumEntity", cls.__name__
) | [
"def",
"__init_subclass__",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init_subclass__",
"(",
"*",
"*",
"kwargs",
")",
"_LOGGER",
".",
"warning",
"(",
"\"VacuumDevice is deprecated, modify %s to extend VacuumEntity\"",
",",
"cls",
... | [
326,
4
] | [
331,
9
] | python | de | ['de', 'sv', 'en'] | False |
StateVacuumEntity.state | (self) | Return the state of the vacuum cleaner. | Return the state of the vacuum cleaner. | def state(self):
"""Return the state of the vacuum cleaner."""
return None | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"None"
] | [
338,
4
] | [
340,
19
] | python | en | ['en', 'en', 'en'] | True |
StateVacuumEntity.battery_icon | (self) | Return the battery icon for the vacuum cleaner. | Return the battery icon for the vacuum cleaner. | def battery_icon(self):
"""Return the battery icon for the vacuum cleaner."""
charging = bool(self.state == STATE_DOCKED)
return icon_for_battery_level(
battery_level=self.battery_level, charging=charging
) | [
"def",
"battery_icon",
"(",
"self",
")",
":",
"charging",
"=",
"bool",
"(",
"self",
".",
"state",
"==",
"STATE_DOCKED",
")",
"return",
"icon_for_battery_level",
"(",
"battery_level",
"=",
"self",
".",
"battery_level",
",",
"charging",
"=",
"charging",
")"
] | [
343,
4
] | [
349,
9
] | python | en | ['en', 'en', 'en'] | True |
StateVacuumEntity.start | (self) | Start or resume the cleaning task. | Start or resume the cleaning task. | def start(self):
"""Start or resume the cleaning task."""
raise NotImplementedError() | [
"def",
"start",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
351,
4
] | [
353,
35
] | python | en | ['en', 'en', 'en'] | True |
StateVacuumEntity.async_start | (self) | Start or resume the cleaning task.
This method must be run in the event loop.
| Start or resume the cleaning task. | async def async_start(self):
"""Start or resume the cleaning task.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(self.start) | [
"async",
"def",
"async_start",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"start",
")"
] | [
355,
4
] | [
360,
58
] | python | en | ['en', 'en', 'en'] | True |
StateVacuumEntity.pause | (self) | Pause the cleaning task. | Pause the cleaning task. | def pause(self):
"""Pause the cleaning task."""
raise NotImplementedError() | [
"def",
"pause",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
362,
4
] | [
364,
35
] | python | en | ['en', 'en', 'en'] | True |
StateVacuumEntity.async_pause | (self) | Pause the cleaning task.
This method must be run in the event loop.
| Pause the cleaning task. | async def async_pause(self):
"""Pause the cleaning task.
This method must be run in the event loop.
"""
await self.hass.async_add_executor_job(self.pause) | [
"async",
"def",
"async_pause",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"pause",
")"
] | [
366,
4
] | [
371,
58
] | python | en | ['en', 'en', 'en'] | True |
StateVacuumEntity.async_turn_on | (self, **kwargs) | Not supported. | Not supported. | async def async_turn_on(self, **kwargs):
"""Not supported.""" | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":"
] | [
373,
4
] | [
374,
28
] | python | en | ['de', 'en', 'en'] | False |
StateVacuumEntity.async_turn_off | (self, **kwargs) | Not supported. | Not supported. | async def async_turn_off(self, **kwargs):
"""Not supported.""" | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":"
] | [
376,
4
] | [
377,
28
] | python | en | ['de', 'en', 'en'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.