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_arm_away_failure | (hass) | Test arm away method failure. | Test arm away method failure. | async def test_arm_away_failure(hass):
"""Test arm away method failure."""
responses = [RESPONSE_DISARMED, RESPONSE_ARM_FAILURE, RESPONSE_DISARMED]
with patch(
"homeassistant.components.totalconnect.TotalConnectClient.TotalConnectClient.request",
side_effect=responses,
):
await s... | [
"async",
"def",
"test_arm_away_failure",
"(",
"hass",
")",
":",
"responses",
"=",
"[",
"RESPONSE_DISARMED",
",",
"RESPONSE_ARM_FAILURE",
",",
"RESPONSE_DISARMED",
"]",
"with",
"patch",
"(",
"\"homeassistant.components.totalconnect.TotalConnectClient.TotalConnectClient.request\"... | [
100,
0
] | [
116,
71
] | python | en | ['en', 'ga', 'en'] | True |
test_disarm_success | (hass) | Test disarm method success. | Test disarm method success. | async def test_disarm_success(hass):
"""Test disarm method success."""
responses = [RESPONSE_ARMED_AWAY, RESPONSE_DISARM_SUCCESS, RESPONSE_DISARMED]
with patch(
"homeassistant.components.totalconnect.TotalConnectClient.TotalConnectClient.request",
side_effect=responses,
):
await ... | [
"async",
"def",
"test_disarm_success",
"(",
"hass",
")",
":",
"responses",
"=",
"[",
"RESPONSE_ARMED_AWAY",
",",
"RESPONSE_DISARM_SUCCESS",
",",
"RESPONSE_DISARMED",
"]",
"with",
"patch",
"(",
"\"homeassistant.components.totalconnect.TotalConnectClient.TotalConnectClient.reques... | [
119,
0
] | [
133,
71
] | python | en | ['fr', 'et', 'en'] | False |
test_disarm_failure | (hass) | Test disarm method failure. | Test disarm method failure. | async def test_disarm_failure(hass):
"""Test disarm method failure."""
responses = [RESPONSE_ARMED_AWAY, RESPONSE_DISARM_FAILURE, RESPONSE_ARMED_AWAY]
with patch(
"homeassistant.components.totalconnect.TotalConnectClient.TotalConnectClient.request",
side_effect=responses,
):
awai... | [
"async",
"def",
"test_disarm_failure",
"(",
"hass",
")",
":",
"responses",
"=",
"[",
"RESPONSE_ARMED_AWAY",
",",
"RESPONSE_DISARM_FAILURE",
",",
"RESPONSE_ARMED_AWAY",
"]",
"with",
"patch",
"(",
"\"homeassistant.components.totalconnect.TotalConnectClient.TotalConnectClient.requ... | [
136,
0
] | [
152,
73
] | python | en | ['en', 'et', 'en'] | True |
Tester.__init__ | (self) |
init redis
|
init redis
| def __init__(self):
"""
init redis
"""
self.redis = RedisClient()
self.loop = asyncio.get_event_loop() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"redis",
"=",
"RedisClient",
"(",
")",
"self",
".",
"loop",
"=",
"asyncio",
".",
"get_event_loop",
"(",
")"
] | [
25,
4
] | [
30,
44
] | python | en | ['en', 'error', 'th'] | False |
Tester.test | (self, proxy: Proxy) |
test single proxy
:param proxy: Proxy object
:return:
|
test single proxy
:param proxy: Proxy object
:return:
| async def test(self, proxy: Proxy):
"""
test single proxy
:param proxy: Proxy object
:return:
"""
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
try:
logger.debug(f'testing {proxy.string()}')
... | [
"async",
"def",
"test",
"(",
"self",
",",
"proxy",
":",
"Proxy",
")",
":",
"async",
"with",
"aiohttp",
".",
"ClientSession",
"(",
"connector",
"=",
"aiohttp",
".",
"TCPConnector",
"(",
"ssl",
"=",
"False",
")",
")",
"as",
"session",
":",
"try",
":",
... | [
32,
4
] | [
51,
82
] | python | en | ['en', 'error', 'th'] | False |
Tester.run | (self) |
test main method
:return:
|
test main method
:return:
| def run(self):
"""
test main method
:return:
"""
# event loop of aiohttp
logger.info('stating tester...')
count = self.redis.count()
logger.debug(f'{count} proxies to test')
for i in range(0, count, TEST_BATCH):
# start end end offset
... | [
"def",
"run",
"(",
"self",
")",
":",
"# event loop of aiohttp",
"logger",
".",
"info",
"(",
"'stating tester...'",
")",
"count",
"=",
"self",
".",
"redis",
".",
"count",
"(",
")",
"logger",
".",
"debug",
"(",
"f'{count} proxies to test'",
")",
"for",
"i",
... | [
54,
4
] | [
70,
61
] | python | en | ['en', 'error', 'th'] | False |
log_messages | (hass: HomeAssistantType, entity_id: str) | Wrap an MQTT message callback to support message logging. | Wrap an MQTT message callback to support message logging. | def log_messages(hass: HomeAssistantType, entity_id: str) -> MessageCallbackType:
"""Wrap an MQTT message callback to support message logging."""
def _log_message(msg):
"""Log message."""
debug_info = hass.data[DATA_MQTT_DEBUG_INFO]
messages = debug_info["entities"][entity_id]["subscrip... | [
"def",
"log_messages",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entity_id",
":",
"str",
")",
"->",
"MessageCallbackType",
":",
"def",
"_log_message",
"(",
"msg",
")",
":",
"\"\"\"Log message.\"\"\"",
"debug_info",
"=",
"hass",
".",
"data",
"[",
"DATA_MQTT_DE... | [
17,
0
] | [
39,
21
] | python | en | ['en', 'en', 'en'] | True |
add_subscription | (hass, message_callback, subscription) | Prepare debug data for subscription. | Prepare debug data for subscription. | def add_subscription(hass, message_callback, subscription):
"""Prepare debug data for subscription."""
entity_id = getattr(message_callback, "__entity_id", None)
if entity_id:
debug_info = hass.data.setdefault(
DATA_MQTT_DEBUG_INFO, {"entities": {}, "triggers": {}}
)
enti... | [
"def",
"add_subscription",
"(",
"hass",
",",
"message_callback",
",",
"subscription",
")",
":",
"entity_id",
"=",
"getattr",
"(",
"message_callback",
",",
"\"__entity_id\"",
",",
"None",
")",
"if",
"entity_id",
":",
"debug_info",
"=",
"hass",
".",
"data",
".",... | [
42,
0
] | [
57,
64
] | python | it | ['it', 'it', 'en'] | True |
remove_subscription | (hass, message_callback, subscription) | Remove debug data for subscription if it exists. | Remove debug data for subscription if it exists. | def remove_subscription(hass, message_callback, subscription):
"""Remove debug data for subscription if it exists."""
entity_id = getattr(message_callback, "__entity_id", None)
if entity_id and entity_id in hass.data[DATA_MQTT_DEBUG_INFO]["entities"]:
hass.data[DATA_MQTT_DEBUG_INFO]["entities"][enti... | [
"def",
"remove_subscription",
"(",
"hass",
",",
"message_callback",
",",
"subscription",
")",
":",
"entity_id",
"=",
"getattr",
"(",
"message_callback",
",",
"\"__entity_id\"",
",",
"None",
")",
"if",
"entity_id",
"and",
"entity_id",
"in",
"hass",
".",
"data",
... | [
60,
0
] | [
72,
13
] | python | en | ['en', 'en', 'en'] | True |
add_entity_discovery_data | (hass, discovery_data, entity_id) | Add discovery data. | Add discovery data. | def add_entity_discovery_data(hass, discovery_data, entity_id):
"""Add discovery data."""
debug_info = hass.data.setdefault(
DATA_MQTT_DEBUG_INFO, {"entities": {}, "triggers": {}}
)
entity_info = debug_info["entities"].setdefault(
entity_id, {"subscriptions": {}, "discovery_data": {}}
... | [
"def",
"add_entity_discovery_data",
"(",
"hass",
",",
"discovery_data",
",",
"entity_id",
")",
":",
"debug_info",
"=",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DATA_MQTT_DEBUG_INFO",
",",
"{",
"\"entities\"",
":",
"{",
"}",
",",
"\"triggers\"",
":",
"{",
... | [
75,
0
] | [
83,
50
] | python | en | ['en', 'en', 'en'] | True |
update_entity_discovery_data | (hass, discovery_payload, entity_id) | Update discovery data. | Update discovery data. | def update_entity_discovery_data(hass, discovery_payload, entity_id):
"""Update discovery data."""
entity_info = hass.data[DATA_MQTT_DEBUG_INFO]["entities"][entity_id]
entity_info["discovery_data"][ATTR_DISCOVERY_PAYLOAD] = discovery_payload | [
"def",
"update_entity_discovery_data",
"(",
"hass",
",",
"discovery_payload",
",",
"entity_id",
")",
":",
"entity_info",
"=",
"hass",
".",
"data",
"[",
"DATA_MQTT_DEBUG_INFO",
"]",
"[",
"\"entities\"",
"]",
"[",
"entity_id",
"]",
"entity_info",
"[",
"\"discovery_d... | [
86,
0
] | [
89,
77
] | python | en | ['it', 'en', 'en'] | True |
remove_entity_data | (hass, entity_id) | Remove discovery data. | Remove discovery data. | def remove_entity_data(hass, entity_id):
"""Remove discovery data."""
hass.data[DATA_MQTT_DEBUG_INFO]["entities"].pop(entity_id) | [
"def",
"remove_entity_data",
"(",
"hass",
",",
"entity_id",
")",
":",
"hass",
".",
"data",
"[",
"DATA_MQTT_DEBUG_INFO",
"]",
"[",
"\"entities\"",
"]",
".",
"pop",
"(",
"entity_id",
")"
] | [
92,
0
] | [
94,
62
] | python | en | ['it', 'en', 'en'] | True |
add_trigger_discovery_data | (hass, discovery_hash, discovery_data, device_id) | Add discovery data. | Add discovery data. | def add_trigger_discovery_data(hass, discovery_hash, discovery_data, device_id):
"""Add discovery data."""
debug_info = hass.data.setdefault(
DATA_MQTT_DEBUG_INFO, {"entities": {}, "triggers": {}}
)
debug_info["triggers"][discovery_hash] = {
"device_id": device_id,
"discovery_dat... | [
"def",
"add_trigger_discovery_data",
"(",
"hass",
",",
"discovery_hash",
",",
"discovery_data",
",",
"device_id",
")",
":",
"debug_info",
"=",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DATA_MQTT_DEBUG_INFO",
",",
"{",
"\"entities\"",
":",
"{",
"}",
",",
"\... | [
97,
0
] | [
105,
5
] | python | en | ['en', 'en', 'en'] | True |
update_trigger_discovery_data | (hass, discovery_hash, discovery_payload) | Update discovery data. | Update discovery data. | def update_trigger_discovery_data(hass, discovery_hash, discovery_payload):
"""Update discovery data."""
trigger_info = hass.data[DATA_MQTT_DEBUG_INFO]["triggers"][discovery_hash]
trigger_info["discovery_data"][ATTR_DISCOVERY_PAYLOAD] = discovery_payload | [
"def",
"update_trigger_discovery_data",
"(",
"hass",
",",
"discovery_hash",
",",
"discovery_payload",
")",
":",
"trigger_info",
"=",
"hass",
".",
"data",
"[",
"DATA_MQTT_DEBUG_INFO",
"]",
"[",
"\"triggers\"",
"]",
"[",
"discovery_hash",
"]",
"trigger_info",
"[",
"... | [
108,
0
] | [
111,
78
] | python | en | ['it', 'en', 'en'] | True |
remove_trigger_discovery_data | (hass, discovery_hash) | Remove discovery data. | Remove discovery data. | def remove_trigger_discovery_data(hass, discovery_hash):
"""Remove discovery data."""
hass.data[DATA_MQTT_DEBUG_INFO]["triggers"][discovery_hash]["discovery_data"] = None | [
"def",
"remove_trigger_discovery_data",
"(",
"hass",
",",
"discovery_hash",
")",
":",
"hass",
".",
"data",
"[",
"DATA_MQTT_DEBUG_INFO",
"]",
"[",
"\"triggers\"",
"]",
"[",
"discovery_hash",
"]",
"[",
"\"discovery_data\"",
"]",
"=",
"None"
] | [
114,
0
] | [
116,
88
] | python | en | ['it', 'en', 'en'] | True |
info_for_device | (hass, device_id) | Get debug info for a device. | Get debug info for a device. | async def info_for_device(hass, device_id):
"""Get debug info for a device."""
mqtt_info = {"entities": [], "triggers": []}
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entries = hass.helpers.entity_registry.async_entries_for_device(
entity_registry, device_id
)... | [
"async",
"def",
"info_for_device",
"(",
"hass",
",",
"device_id",
")",
":",
"mqtt_info",
"=",
"{",
"\"entities\"",
":",
"[",
"]",
",",
"\"triggers\"",
":",
"[",
"]",
"}",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",... | [
119,
0
] | [
173,
20
] | python | en | ['fr', 'en', 'en'] | True |
Preprocessor.__init__ | (self, corpus, target=None, **kwargs) |
The corpus is the `SqliteCorpusReader` to preprocess and pickle.
The target is the directory on disk to output the pickled corpus to.
|
The corpus is the `SqliteCorpusReader` to preprocess and pickle.
The target is the directory on disk to output the pickled corpus to.
| def __init__(self, corpus, target=None, **kwargs):
"""
The corpus is the `SqliteCorpusReader` to preprocess and pickle.
The target is the directory on disk to output the pickled corpus to.
"""
self.tasks = mp.cpu_count()
self.corpus = corpus
self.target = target | [
"def",
"__init__",
"(",
"self",
",",
"corpus",
",",
"target",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"tasks",
"=",
"mp",
".",
"cpu_count",
"(",
")",
"self",
".",
"corpus",
"=",
"corpus",
"self",
".",
"target",
"=",
"target"
] | [
18,
4
] | [
25,
28
] | python | en | ['en', 'error', 'th'] | False |
Preprocessor.abspath | (self, name) |
Returns the absolute path to the target fileid from the corpus fileid.
|
Returns the absolute path to the target fileid from the corpus fileid.
| def abspath(self, name):
"""
Returns the absolute path to the target fileid from the corpus fileid.
"""
# Create the pickle file extension
fname = str(name) + '.pickle'
# Return the path to the file relative to the target.
return os.path.normpath(os.path.join(se... | [
"def",
"abspath",
"(",
"self",
",",
"name",
")",
":",
"# Create the pickle file extension",
"fname",
"=",
"str",
"(",
"name",
")",
"+",
"'.pickle'",
"# Return the path to the file relative to the target.",
"return",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
"... | [
47,
4
] | [
55,
65
] | python | en | ['en', 'error', 'th'] | False |
Preprocessor.tokenize | (self, text) |
Segments, tokenizes, and tags a document in the corpus. Returns a
generator of paragraphs, which are lists of sentences, which in turn
are lists of part of speech tagged words.
|
Segments, tokenizes, and tags a document in the corpus. Returns a
generator of paragraphs, which are lists of sentences, which in turn
are lists of part of speech tagged words.
| def tokenize(self, text):
"""
Segments, tokenizes, and tags a document in the corpus. Returns a
generator of paragraphs, which are lists of sentences, which in turn
are lists of part of speech tagged words.
"""
yield [
nltk.pos_tag(nltk.wordpunct_tokenize(sent... | [
"def",
"tokenize",
"(",
"self",
",",
"text",
")",
":",
"yield",
"[",
"nltk",
".",
"pos_tag",
"(",
"nltk",
".",
"wordpunct_tokenize",
"(",
"sent",
")",
")",
"for",
"sent",
"in",
"nltk",
".",
"sent_tokenize",
"(",
"text",
")",
"]"
] | [
57,
4
] | [
66,
9
] | python | en | ['en', 'error', 'th'] | False |
Preprocessor.process | (self, score_album_artist_text) |
For a single file does the following preprocessing work:
1. Checks the location on disk to make sure no errors occur.
2. Gets all paragraphs for the given text.
3. Segments the paragraphs with the sent_tokenizer
4. Tokenizes the sentences with the wordpunct_token... |
For a single file does the following preprocessing work:
1. Checks the location on disk to make sure no errors occur.
2. Gets all paragraphs for the given text.
3. Segments the paragraphs with the sent_tokenizer
4. Tokenizes the sentences with the wordpunct_token... | def process(self, score_album_artist_text):
"""
For a single file does the following preprocessing work:
1. Checks the location on disk to make sure no errors occur.
2. Gets all paragraphs for the given text.
3. Segments the paragraphs with the sent_tokenizer
... | [
"def",
"process",
"(",
"self",
",",
"score_album_artist_text",
")",
":",
"score",
",",
"album",
",",
"artist",
",",
"text",
"=",
"score_album_artist_text",
"# Compute the outpath to write the file to.",
"if",
"album",
":",
"name",
"=",
"album",
"+",
"'-'",
"+",
... | [
68,
4
] | [
111,
21
] | python | en | ['en', 'error', 'th'] | False |
Preprocessor.transform | (self) |
Transform the wrapped corpus, writing out the segmented, tokenized,
and part of speech tagged corpus as a pickle to the target directory.
This method will also directly copy files that are in the corpus.root
directory that are not matched by the corpus.fileids().
|
Transform the wrapped corpus, writing out the segmented, tokenized,
and part of speech tagged corpus as a pickle to the target directory.
This method will also directly copy files that are in the corpus.root
directory that are not matched by the corpus.fileids().
| def transform(self):
"""
Transform the wrapped corpus, writing out the segmented, tokenized,
and part of speech tagged corpus as a pickle to the target directory.
This method will also directly copy files that are in the corpus.root
directory that are not matched by the corpus.fi... | [
"def",
"transform",
"(",
"self",
")",
":",
"# Make the target directory if it doesn't already exist",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"target",
")",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"target",
")",
"for",
"score_a... | [
113,
4
] | [
125,
55
] | python | en | ['en', 'error', 'th'] | False |
ParallelPreprocessor.__init__ | (self, *args, **kwargs) |
Get parallel-specific arguments and then call super.
|
Get parallel-specific arguments and then call super.
| def __init__(self, *args, **kwargs):
"""
Get parallel-specific arguments and then call super.
"""
self.tasks = mp.cpu_count()
super(ParallelPreprocessor, self).__init__(*args, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"tasks",
"=",
"mp",
".",
"cpu_count",
"(",
")",
"super",
"(",
"ParallelPreprocessor",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
... | [
133,
4
] | [
138,
67
] | python | en | ['en', 'error', 'th'] | False |
ParallelPreprocessor.on_result | (self, result) |
Appends the results to the master results list.
|
Appends the results to the master results list.
| def on_result(self, result):
"""
Appends the results to the master results list.
"""
self.results.append(result) | [
"def",
"on_result",
"(",
"self",
",",
"result",
")",
":",
"self",
".",
"results",
".",
"append",
"(",
"result",
")"
] | [
140,
4
] | [
144,
35
] | python | en | ['en', 'error', 'th'] | False |
ParallelPreprocessor.transform | (self) |
Create a pool using the multiprocessing library, passing in
the number of cores available to set the desired number of
processes.
|
Create a pool using the multiprocessing library, passing in
the number of cores available to set the desired number of
processes.
| def transform(self):
"""
Create a pool using the multiprocessing library, passing in
the number of cores available to set the desired number of
processes.
"""
# Make the target directory if it doesn't already exist
if not os.path.exists(self.target):
o... | [
"def",
"transform",
"(",
"self",
")",
":",
"# Make the target directory if it doesn't already exist",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"target",
")",
":",
"os",
".",
"makedirs",
"(",
"self",
".",
"target",
")",
"# Reset the resu... | [
146,
4
] | [
170,
27
] | python | en | ['en', 'error', 'th'] | False |
setup | (hass, config) | Set up integration. | Set up integration. | def setup(hass, config):
"""Set up integration."""
conf = config.get(DOMAIN, LIFE360_SCHEMA({}))
hass.data[DOMAIN] = {"config": conf, "apis": {}}
discovery.load_platform(hass, DEVICE_TRACKER, DOMAIN, None, config)
if CONF_ACCOUNTS not in conf:
return True
# Check existing config entrie... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
",",
"LIFE360_SCHEMA",
"(",
"{",
"}",
")",
")",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"\"config\"",
":",
"conf",
",",
"\"apis\"",
... | [
149,
0
] | [
192,
15
] | python | en | ['en', 'da', 'en'] | True |
async_setup_entry | (hass, entry) | Set up config entry. | Set up config entry. | async def async_setup_entry(hass, entry):
"""Set up config entry."""
hass.data[DOMAIN]["apis"][entry.data[CONF_USERNAME]] = get_api(
entry.data[CONF_AUTHORIZATION]
)
return True | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"apis\"",
"]",
"[",
"entry",
".",
"data",
"[",
"CONF_USERNAME",
"]",
"]",
"=",
"get_api",
"(",
"entry",
".",
"data",
"[",
"CONF_... | [
195,
0
] | [
200,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, entry) | Unload config entry. | Unload config entry. | async def async_unload_entry(hass, entry):
"""Unload config entry."""
try:
hass.data[DOMAIN]["apis"].pop(entry.data[CONF_USERNAME])
return True
except KeyError:
return False | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"try",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"apis\"",
"]",
".",
"pop",
"(",
"entry",
".",
"data",
"[",
"CONF_USERNAME",
"]",
")",
"return",
"True",
"except",
"... | [
203,
0
] | [
209,
20
] | python | da | ['da', 'es', 'en'] | False |
async_get_pin_from_discovery_hostname | (hostname) | Get the device's 4-digit PIN from its zeroconf-discovered hostname. | Get the device's 4-digit PIN from its zeroconf-discovered hostname. | def async_get_pin_from_discovery_hostname(hostname):
"""Get the device's 4-digit PIN from its zeroconf-discovered hostname."""
return hostname.split(".")[0].split("-")[1] | [
"def",
"async_get_pin_from_discovery_hostname",
"(",
"hostname",
")",
":",
"return",
"hostname",
".",
"split",
"(",
"\".\"",
")",
"[",
"0",
"]",
".",
"split",
"(",
"\"-\"",
")",
"[",
"1",
"]"
] | [
19,
0
] | [
21,
47
] | python | en | ['en', 'en', 'en'] | True |
async_get_pin_from_uid | (uid) | Get the device's 4-digit PIN from its UID. | Get the device's 4-digit PIN from its UID. | def async_get_pin_from_uid(uid):
"""Get the device's 4-digit PIN from its UID."""
return uid[-4:] | [
"def",
"async_get_pin_from_uid",
"(",
"uid",
")",
":",
"return",
"uid",
"[",
"-",
"4",
":",
"]"
] | [
25,
0
] | [
27,
19
] | python | en | ['en', 'en', 'en'] | True |
validate_input | (hass: core.HomeAssistant, data) | Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
| Validate the user input allows us to connect. | async def validate_input(hass: core.HomeAssistant, data):
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
"""
async with Client(data[CONF_IP_ADDRESS]) as client:
ping_data = await client.system.ping()
return {
CO... | [
"async",
"def",
"validate_input",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"data",
")",
":",
"async",
"with",
"Client",
"(",
"data",
"[",
"CONF_IP_ADDRESS",
"]",
")",
"as",
"client",
":",
"ping_data",
"=",
"await",
"client",
".",
"system",
".... | [
30,
0
] | [
40,
5
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.__init__ | (self) | Initialize. | Initialize. | def __init__(self):
"""Initialize."""
self.discovery_info = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"discovery_info",
"=",
"{",
"}"
] | [
49,
4
] | [
51,
32
] | python | en | ['en', 'en', 'it'] | False |
ConfigFlow._async_set_unique_id | (self, pin) | Set the config entry's unique ID (based on the device's 4-digit PIN). | Set the config entry's unique ID (based on the device's 4-digit PIN). | async def _async_set_unique_id(self, pin):
"""Set the config entry's unique ID (based on the device's 4-digit PIN)."""
await self.async_set_unique_id(UNIQUE_ID.format(pin))
self._abort_if_unique_id_configured() | [
"async",
"def",
"_async_set_unique_id",
"(",
"self",
",",
"pin",
")",
":",
"await",
"self",
".",
"async_set_unique_id",
"(",
"UNIQUE_ID",
".",
"format",
"(",
"pin",
")",
")",
"self",
".",
"_abort_if_unique_id_configured",
"(",
")"
] | [
53,
4
] | [
56,
45
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_user | (self, user_input=None) | Handle configuration via the UI. | Handle configuration via the UI. | async def async_step_user(self, user_input=None):
"""Handle configuration via the UI."""
if user_input is None:
return self.async_show_form(
step_id="user", data_schema=DATA_SCHEMA, errors={}
)
try:
info = await validate_input(self.hass, user_... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"None",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"user\"",
",",
"data_schema",
"=",
"DATA_SCHEMA",
",",
"errors",... | [
58,
4
] | [
80,
9
] | python | en | ['en', 'haw', 'en'] | True |
ConfigFlow.async_step_zeroconf | (self, discovery_info) | Handle the configuration via zeroconf. | Handle the configuration via zeroconf. | async def async_step_zeroconf(self, discovery_info):
"""Handle the configuration via zeroconf."""
if discovery_info is None:
return self.async_abort(reason="cannot_connect")
pin = async_get_pin_from_discovery_hostname(discovery_info["hostname"])
await self._async_set_unique_... | [
"async",
"def",
"async_step_zeroconf",
"(",
"self",
",",
"discovery_info",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"cannot_connect\"",
")",
"pin",
"=",
"async_get_pin_from_discovery_hostname",
... | [
82,
4
] | [
104,
55
] | python | en | ['en', 'es', 'en'] | True |
ConfigFlow.async_step_zeroconf_confirm | (self, user_input=None) | Finish the configuration via zeroconf. | Finish the configuration via zeroconf. | async def async_step_zeroconf_confirm(self, user_input=None):
"""Finish the configuration via zeroconf."""
if user_input is None:
return self.async_show_form(step_id="zeroconf_confirm")
return await self.async_step_user(self.discovery_info) | [
"async",
"def",
"async_step_zeroconf_confirm",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"None",
":",
"return",
"self",
".",
"async_show_form",
"(",
"step_id",
"=",
"\"zeroconf_confirm\"",
")",
"return",
"await",
"self",
... | [
106,
4
] | [
110,
62
] | python | en | ['en', 'it', 'en'] | True |
async_setup_platform | (
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
) | Set up MQTT switch through configuration.yaml. | Set up MQTT switch through configuration.yaml. | async def async_setup_platform(
hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None
):
"""Set up MQTT switch through configuration.yaml."""
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
await _async_setup_entity(hass, config, async_add_entities, discovery_inf... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"await",
"async_setup_reload_service",
"(",
"hass",
",",
"DOMAIN",
",",
"PLATF... | [
70,
0
] | [
75,
79
] | python | en | ['en', 'ny', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up MQTT switch dynamically through MQTT discovery. | Set up MQTT switch dynamically through MQTT discovery. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up MQTT switch dynamically through MQTT discovery."""
async def async_discover(discovery_payload):
"""Discover and add a MQTT switch."""
discovery_data = discovery_payload.discovery_data
try:
config ... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"async",
"def",
"async_discover",
"(",
"discovery_payload",
")",
":",
"\"\"\"Discover and add a MQTT switch.\"\"\"",
"discovery_data",
"=",
"discovery_payload",
"."... | [
78,
0
] | [
95,
5
] | python | en | ['en', 'en', 'en'] | True |
_async_setup_entity | (
hass, config, async_add_entities, config_entry=None, discovery_data=None
) | Set up the MQTT switch. | Set up the MQTT switch. | async def _async_setup_entity(
hass, config, async_add_entities, config_entry=None, discovery_data=None
):
"""Set up the MQTT switch."""
async_add_entities([MqttSwitch(hass, config, config_entry, discovery_data)]) | [
"async",
"def",
"_async_setup_entity",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"config_entry",
"=",
"None",
",",
"discovery_data",
"=",
"None",
")",
":",
"async_add_entities",
"(",
"[",
"MqttSwitch",
"(",
"hass",
",",
"config",
",",
"config... | [
98,
0
] | [
102,
80
] | python | en | ['en', 'en', 'en'] | True |
MqttSwitch.__init__ | (self, hass, config, config_entry, discovery_data) | Initialize the MQTT switch. | Initialize the MQTT switch. | def __init__(self, hass, config, config_entry, discovery_data):
"""Initialize the MQTT switch."""
self.hass = hass
self._state = False
self._sub_state = None
self._state_on = None
self._state_off = None
self._optimistic = None
self._unique_id = config.get... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"config",
",",
"config_entry",
",",
"discovery_data",
")",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"_sub_state",
"=",
"None",
"self",
".",
"_state_on",
"... | [
115,
4
] | [
134,
72
] | python | en | ['en', 'co', 'en'] | True |
MqttSwitch.async_added_to_hass | (self) | Subscribe to MQTT events. | Subscribe to MQTT events. | async def async_added_to_hass(self):
"""Subscribe to MQTT events."""
await super().async_added_to_hass()
await self._subscribe_topics() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"await",
"self",
".",
"_subscribe_topics",
"(",
")"
] | [
136,
4
] | [
139,
38
] | python | en | ['en', 'en', 'en'] | True |
MqttSwitch.discovery_update | (self, discovery_payload) | Handle updated discovery message. | Handle updated discovery message. | async def discovery_update(self, discovery_payload):
"""Handle updated discovery message."""
config = PLATFORM_SCHEMA(discovery_payload)
self._setup_from_config(config)
await self.attributes_discovery_update(config)
await self.availability_discovery_update(config)
await s... | [
"async",
"def",
"discovery_update",
"(",
"self",
",",
"discovery_payload",
")",
":",
"config",
"=",
"PLATFORM_SCHEMA",
"(",
"discovery_payload",
")",
"self",
".",
"_setup_from_config",
"(",
"config",
")",
"await",
"self",
".",
"attributes_discovery_update",
"(",
"... | [
141,
4
] | [
149,
35
] | python | en | ['en', 'en', 'en'] | True |
MqttSwitch._setup_from_config | (self, config) | (Re)Setup the entity. | (Re)Setup the entity. | def _setup_from_config(self, config):
"""(Re)Setup the entity."""
self._config = config
state_on = config.get(CONF_STATE_ON)
self._state_on = state_on if state_on else config[CONF_PAYLOAD_ON]
state_off = config.get(CONF_STATE_OFF)
self._state_off = state_off if state_of... | [
"def",
"_setup_from_config",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"_config",
"=",
"config",
"state_on",
"=",
"config",
".",
"get",
"(",
"CONF_STATE_ON",
")",
"self",
".",
"_state_on",
"=",
"state_on",
"if",
"state_on",
"else",
"config",
"[",
... | [
151,
4
] | [
165,
37
] | python | en | ['en', 'haw', 'en'] | True |
MqttSwitch._subscribe_topics | (self) | (Re)Subscribe to topics. | (Re)Subscribe to topics. | async def _subscribe_topics(self):
"""(Re)Subscribe to topics."""
@callback
@log_messages(self.hass, self.entity_id)
def state_message_received(msg):
"""Handle new MQTT state messages."""
payload = msg.payload
template = self._config.get(CONF_VALUE_TE... | [
"async",
"def",
"_subscribe_topics",
"(",
"self",
")",
":",
"@",
"callback",
"@",
"log_messages",
"(",
"self",
".",
"hass",
",",
"self",
".",
"entity_id",
")",
"def",
"state_message_received",
"(",
"msg",
")",
":",
"\"\"\"Handle new MQTT state messages.\"\"\"",
... | [
167,
4
] | [
204,
58
] | python | en | ['en', 'en', 'en'] | True |
MqttSwitch.async_will_remove_from_hass | (self) | Unsubscribe when removed. | Unsubscribe when removed. | async def async_will_remove_from_hass(self):
"""Unsubscribe when removed."""
self._sub_state = await subscription.async_unsubscribe_topics(
self.hass, self._sub_state
)
await MqttAttributes.async_will_remove_from_hass(self)
await MqttAvailability.async_will_remove_fro... | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"self",
".",
"_sub_state",
"=",
"await",
"subscription",
".",
"async_unsubscribe_topics",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_sub_state",
")",
"await",
"MqttAttributes",
".",
"async_... | [
206,
4
] | [
213,
67
] | python | en | ['en', 'en', 'en'] | True |
MqttSwitch.should_poll | (self) | Return the polling state. | Return the polling state. | def should_poll(self):
"""Return the polling state."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
216,
4
] | [
218,
20
] | python | en | ['en', 'en', 'en'] | True |
MqttSwitch.name | (self) | Return the name of the switch. | Return the name of the switch. | def name(self):
"""Return the name of the switch."""
return self._config[CONF_NAME] | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
"[",
"CONF_NAME",
"]"
] | [
221,
4
] | [
223,
38
] | python | en | ['en', 'en', 'en'] | True |
MqttSwitch.is_on | (self) | Return true if device is on. | Return true if device is on. | def is_on(self):
"""Return true if device is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
226,
4
] | [
228,
26
] | python | en | ['en', 'fy', 'en'] | True |
MqttSwitch.assumed_state | (self) | Return true if we do optimistic updates. | Return true if we do optimistic updates. | def assumed_state(self):
"""Return true if we do optimistic updates."""
return self._optimistic | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_optimistic"
] | [
231,
4
] | [
233,
31
] | python | en | ['pt', 'la', 'en'] | False |
MqttSwitch.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self):
"""Return a unique ID."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unique_id"
] | [
236,
4
] | [
238,
30
] | python | ca | ['fr', 'ca', 'en'] | False |
MqttSwitch.icon | (self) | Return the icon. | Return the icon. | def icon(self):
"""Return the icon."""
return self._config.get(CONF_ICON) | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_config",
".",
"get",
"(",
"CONF_ICON",
")"
] | [
241,
4
] | [
243,
42
] | python | en | ['en', 'sr', 'en'] | True |
MqttSwitch.async_turn_on | (self, **kwargs) | Turn the device on.
This method is a coroutine.
| Turn the device on. | async def async_turn_on(self, **kwargs):
"""Turn the device on.
This method is a coroutine.
"""
mqtt.async_publish(
self.hass,
self._config[CONF_COMMAND_TOPIC],
self._config[CONF_PAYLOAD_ON],
self._config[CONF_QOS],
self._confi... | [
"async",
"def",
"async_turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_config",
"[",
"CONF_COMMAND_TOPIC",
"]",
",",
"self",
".",
"_config",
"[",
"CONF_PAYLOAD_ON",
"]"... | [
245,
4
] | [
260,
39
] | python | en | ['en', 'en', 'en'] | True |
MqttSwitch.async_turn_off | (self, **kwargs) | Turn the device off.
This method is a coroutine.
| Turn the device off. | async def async_turn_off(self, **kwargs):
"""Turn the device off.
This method is a coroutine.
"""
mqtt.async_publish(
self.hass,
self._config[CONF_COMMAND_TOPIC],
self._config[CONF_PAYLOAD_OFF],
self._config[CONF_QOS],
self._co... | [
"async",
"def",
"async_turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"mqtt",
".",
"async_publish",
"(",
"self",
".",
"hass",
",",
"self",
".",
"_config",
"[",
"CONF_COMMAND_TOPIC",
"]",
",",
"self",
".",
"_config",
"[",
"CONF_PAYLOAD_OFF",
"... | [
262,
4
] | [
277,
39
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up a SimpliSafe alarm control panel based on a config entry. | Set up a SimpliSafe alarm control panel based on a config entry. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up a SimpliSafe alarm control panel based on a config entry."""
simplisafe = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
async_add_entities(
[SimpliSafeAlarm(simplisafe, system) for system in simplisafe.systems.values()],
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"simplisafe",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_CLIENT",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"async_add_entities",
"(",
"[",
"S... | [
63,
0
] | [
69,
5
] | python | en | ['en', 'en', 'en'] | True |
SimpliSafeAlarm.__init__ | (self, simplisafe, system) | Initialize the SimpliSafe alarm. | Initialize the SimpliSafe alarm. | def __init__(self, simplisafe, system):
"""Initialize the SimpliSafe alarm."""
super().__init__(simplisafe, system, "Alarm Control Panel")
self._changed_by = None
self._last_event = None
if system.alarm_going_off:
self._state = STATE_ALARM_TRIGGERED
elif syst... | [
"def",
"__init__",
"(",
"self",
",",
"simplisafe",
",",
"system",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"simplisafe",
",",
"system",
",",
"\"Alarm Control Panel\"",
")",
"self",
".",
"_changed_by",
"=",
"None",
"self",
".",
"_last_event",
"=",... | [
75,
4
] | [
111,
66
] | python | en | ['en', 'ro', 'en'] | True |
SimpliSafeAlarm.changed_by | (self) | Return info about who changed the alarm last. | Return info about who changed the alarm last. | def changed_by(self):
"""Return info about who changed the alarm last."""
return self._changed_by | [
"def",
"changed_by",
"(",
"self",
")",
":",
"return",
"self",
".",
"_changed_by"
] | [
114,
4
] | [
116,
31
] | python | en | ['en', 'en', 'en'] | True |
SimpliSafeAlarm.code_format | (self) | Return one or more digits/characters. | Return one or more digits/characters. | def code_format(self):
"""Return one or more digits/characters."""
if not self._simplisafe.config_entry.options.get(CONF_CODE):
return None
if isinstance(
self._simplisafe.config_entry.options[CONF_CODE], str
) and re.search("^\\d+$", self._simplisafe.config_entry... | [
"def",
"code_format",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_simplisafe",
".",
"config_entry",
".",
"options",
".",
"get",
"(",
"CONF_CODE",
")",
":",
"return",
"None",
"if",
"isinstance",
"(",
"self",
".",
"_simplisafe",
".",
"config_entry",
... | [
119,
4
] | [
127,
26
] | python | en | ['en', 'en', 'en'] | True |
SimpliSafeAlarm.state | (self) | Return the state of the entity. | Return the state of the entity. | def state(self):
"""Return the state of the entity."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
130,
4
] | [
132,
26
] | python | en | ['en', 'en', 'en'] | True |
SimpliSafeAlarm.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self) -> int:
"""Return the list of supported features."""
return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | [
"def",
"supported_features",
"(",
"self",
")",
"->",
"int",
":",
"return",
"SUPPORT_ALARM_ARM_HOME",
"|",
"SUPPORT_ALARM_ARM_AWAY"
] | [
135,
4
] | [
137,
62
] | python | en | ['en', 'en', 'en'] | True |
SimpliSafeAlarm._is_code_valid | (self, code, state) | Validate that a code matches the required one. | Validate that a code matches the required one. | def _is_code_valid(self, code, state):
"""Validate that a code matches the required one."""
if not self._simplisafe.config_entry.options.get(CONF_CODE):
return True
if not code or code != self._simplisafe.config_entry.options[CONF_CODE]:
LOGGER.warning(
"... | [
"def",
"_is_code_valid",
"(",
"self",
",",
"code",
",",
"state",
")",
":",
"if",
"not",
"self",
".",
"_simplisafe",
".",
"config_entry",
".",
"options",
".",
"get",
"(",
"CONF_CODE",
")",
":",
"return",
"True",
"if",
"not",
"code",
"or",
"code",
"!=",
... | [
140,
4
] | [
151,
19
] | python | en | ['en', 'en', 'en'] | True |
SimpliSafeAlarm.async_alarm_disarm | (self, code=None) | Send disarm command. | Send disarm command. | async def async_alarm_disarm(self, code=None):
"""Send disarm command."""
if not self._is_code_valid(code, STATE_ALARM_DISARMED):
return
try:
await self._system.set_off()
except SimplipyError as err:
LOGGER.error('Error while disarming "%s": %s', self... | [
"async",
"def",
"async_alarm_disarm",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_is_code_valid",
"(",
"code",
",",
"STATE_ALARM_DISARMED",
")",
":",
"return",
"try",
":",
"await",
"self",
".",
"_system",
".",
"set_off",
... | [
153,
4
] | [
164,
42
] | python | en | ['en', 'pt', 'en'] | True |
SimpliSafeAlarm.async_alarm_arm_home | (self, code=None) | Send arm home command. | Send arm home command. | async def async_alarm_arm_home(self, code=None):
"""Send arm home command."""
if not self._is_code_valid(code, STATE_ALARM_ARMED_HOME):
return
try:
await self._system.set_home()
except SimplipyError as err:
LOGGER.error(
'Error while a... | [
"async",
"def",
"async_alarm_arm_home",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_is_code_valid",
"(",
"code",
",",
"STATE_ALARM_ARMED_HOME",
")",
":",
"return",
"try",
":",
"await",
"self",
".",
"_system",
".",
"set_home... | [
166,
4
] | [
179,
44
] | python | en | ['en', 'pt', 'en'] | True |
SimpliSafeAlarm.async_alarm_arm_away | (self, code=None) | Send arm away command. | Send arm away command. | async def async_alarm_arm_away(self, code=None):
"""Send arm away command."""
if not self._is_code_valid(code, STATE_ALARM_ARMED_AWAY):
return
try:
await self._system.set_away()
except SimplipyError as err:
LOGGER.error(
'Error while a... | [
"async",
"def",
"async_alarm_arm_away",
"(",
"self",
",",
"code",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_is_code_valid",
"(",
"code",
",",
"STATE_ALARM_ARMED_AWAY",
")",
":",
"return",
"try",
":",
"await",
"self",
".",
"_system",
".",
"set_away... | [
181,
4
] | [
194,
40
] | python | en | ['en', 'en', 'en'] | True |
SimpliSafeAlarm.async_update_from_rest_api | (self) | Update the entity with the provided REST API data. | Update the entity with the provided REST API data. | def async_update_from_rest_api(self):
"""Update the entity with the provided REST API data."""
if self._system.version == 3:
self._attrs.update(
{
ATTR_ALARM_DURATION: self._system.alarm_duration,
ATTR_ALARM_VOLUME: VOLUME_STRING_MAP[se... | [
"def",
"async_update_from_rest_api",
"(",
"self",
")",
":",
"if",
"self",
".",
"_system",
".",
"version",
"==",
"3",
":",
"self",
".",
"_attrs",
".",
"update",
"(",
"{",
"ATTR_ALARM_DURATION",
":",
"self",
".",
"_system",
".",
"alarm_duration",
",",
"ATTR_... | [
197,
4
] | [
235,
30
] | python | en | ['en', 'en', 'en'] | True |
SimpliSafeAlarm.async_update_from_websocket_event | (self, event) | Update the entity with the provided websocket API event data. | Update the entity with the provided websocket API event data. | def async_update_from_websocket_event(self, event):
"""Update the entity with the provided websocket API event data."""
if event.event_type in (
EVENT_ALARM_CANCELED,
EVENT_DISARMED_BY_MASTER_PIN,
EVENT_DISARMED_BY_REMOTE,
):
self._state = STATE_AL... | [
"def",
"async_update_from_websocket_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"event_type",
"in",
"(",
"EVENT_ALARM_CANCELED",
",",
"EVENT_DISARMED_BY_MASTER_PIN",
",",
"EVENT_DISARMED_BY_REMOTE",
",",
")",
":",
"self",
".",
"_state",
"=",
"... | [
238,
4
] | [
265,
43
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the TP-Link component. | Set up the TP-Link component. | async def async_setup(hass, config):
"""Set up the TP-Link component."""
conf = config.get(DOMAIN)
hass.data[DOMAIN] = {}
hass.data[DOMAIN][ATTR_CONFIG] = conf
if conf is not None:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"so... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"ATTR_CONFIG",
"]",
... | [
53,
0
] | [
67,
15
] | python | en | ['en', 'da', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, config_entry: ConfigType) | Set up TPLink from a config entry. | Set up TPLink from a config entry. | async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigType):
"""Set up TPLink from a config entry."""
config_data = hass.data[DOMAIN].get(ATTR_CONFIG)
# These will contain the initialized devices
lights = hass.data[DOMAIN][CONF_LIGHT] = []
switches = hass.data[DOMAIN][CONF_SWITCH... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry",
":",
"ConfigType",
")",
":",
"config_data",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"get",
"(",
"ATTR_CONFIG",
")",
"# These will contain the initialized de... | [
70,
0
] | [
105,
15
] | 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."""
forward_unload = hass.config_entries.async_forward_entry_unload
remove_lights = remove_switches = False
if hass.data[DOMAIN][CONF_LIGHT]:
remove_lights = await forward_unload(entry, "light")
if hass.data[DOMAIN][CONF_SWI... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"forward_unload",
"=",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"remove_lights",
"=",
"remove_switches",
"=",
"False",
"if",
"hass",
".",
"data",
"[",
"DOMAIN",
"... | [
108,
0
] | [
123,
16
] | python | en | ['en', 'es', 'en'] | True |
async_setup | (hass, config) | Check connectivity and version of KEBA charging station. | Check connectivity and version of KEBA charging station. | async def async_setup(hass, config):
"""Check connectivity and version of KEBA charging station."""
host = config[DOMAIN][CONF_HOST]
rfid = config[DOMAIN][CONF_RFID]
refresh_interval = config[DOMAIN][CONF_FS_INTERVAL]
keba = KebaHandler(hass, host, rfid, refresh_interval)
hass.data[DOMAIN] = keb... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"host",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_HOST",
"]",
"rfid",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_RFID",
"]",
"refresh_interval",
"=",
"config",
"[",
"DOMAIN",
"... | [
55,
0
] | [
101,
15
] | python | en | ['en', 'en', 'en'] | True |
KebaHandler.__init__ | (self, hass, host, rfid, refresh_interval) | Initialize charging station connection. | Initialize charging station connection. | def __init__(self, hass, host, rfid, refresh_interval):
"""Initialize charging station connection."""
super().__init__(host, self.hass_callback)
self._update_listeners = []
self._hass = hass
self.rfid = rfid
self.device_name = "keba" # correct device name will be set in... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"host",
",",
"rfid",
",",
"refresh_interval",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"host",
",",
"self",
".",
"hass_callback",
")",
"self",
".",
"_update_listeners",
"=",
"[",
"]",
"self",
... | [
107,
4
] | [
120,
33
] | python | en | ['en', 'en', 'en'] | True |
KebaHandler.start_periodic_request | (self) | Start periodic data polling. | Start periodic data polling. | def start_periodic_request(self):
"""Start periodic data polling."""
self._polling_task = self._hass.loop.create_task(self._periodic_request()) | [
"def",
"start_periodic_request",
"(",
"self",
")",
":",
"self",
".",
"_polling_task",
"=",
"self",
".",
"_hass",
".",
"loop",
".",
"create_task",
"(",
"self",
".",
"_periodic_request",
"(",
")",
")"
] | [
122,
4
] | [
124,
82
] | python | en | ['en', 'jv', 'en'] | True |
KebaHandler._periodic_request | (self) | Send periodic update requests. | Send periodic update requests. | async def _periodic_request(self):
"""Send periodic update requests."""
await self.request_data()
if self._fast_polling_count < MAX_FAST_POLLING_COUNT:
self._fast_polling_count += 1
_LOGGER.debug("Periodic data request executed, now wait for 2 seconds")
awai... | [
"async",
"def",
"_periodic_request",
"(",
"self",
")",
":",
"await",
"self",
".",
"request_data",
"(",
")",
"if",
"self",
".",
"_fast_polling_count",
"<",
"MAX_FAST_POLLING_COUNT",
":",
"self",
".",
"_fast_polling_count",
"+=",
"1",
"_LOGGER",
".",
"debug",
"(... | [
126,
4
] | [
142,
82
] | python | en | ['en', 'co', 'en'] | True |
KebaHandler.setup | (self, loop=None) | Initialize KebaHandler object. | Initialize KebaHandler object. | async def setup(self, loop=None):
"""Initialize KebaHandler object."""
await super().setup(loop)
# Request initial values and extract serial number
await self.request_data()
if (
self.get_value("Serial") is not None
and self.get_value("Product") is not No... | [
"async",
"def",
"setup",
"(",
"self",
",",
"loop",
"=",
"None",
")",
":",
"await",
"super",
"(",
")",
".",
"setup",
"(",
"loop",
")",
"# Request initial values and extract serial number",
"await",
"self",
".",
"request_data",
"(",
")",
"if",
"(",
"self",
"... | [
144,
4
] | [
158,
20
] | python | sv | ['sv', 'zu', 'ur'] | False |
KebaHandler.hass_callback | (self, data) | Handle component notification via callback. | Handle component notification via callback. | def hass_callback(self, data):
"""Handle component notification via callback."""
# Inform entities about updated values
for listener in self._update_listeners:
listener()
_LOGGER.debug("Notifying %d listeners", len(self._update_listeners)) | [
"def",
"hass_callback",
"(",
"self",
",",
"data",
")",
":",
"# Inform entities about updated values",
"for",
"listener",
"in",
"self",
".",
"_update_listeners",
":",
"listener",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Notifying %d listeners\"",
",",
"len",
"(",... | [
160,
4
] | [
167,
76
] | python | ca | ['ro', 'ca', 'en'] | False |
KebaHandler.add_update_listener | (self, listener) | Add a listener for update notifications. | Add a listener for update notifications. | def add_update_listener(self, listener):
"""Add a listener for update notifications."""
self._update_listeners.append(listener)
# initial data is already loaded, thus update the component
listener() | [
"def",
"add_update_listener",
"(",
"self",
",",
"listener",
")",
":",
"self",
".",
"_update_listeners",
".",
"append",
"(",
"listener",
")",
"# initial data is already loaded, thus update the component",
"listener",
"(",
")"
] | [
175,
4
] | [
180,
18
] | python | en | ['en', 'en', 'en'] | True |
KebaHandler.async_request_data | (self, param) | Request new data in async way. | Request new data in async way. | async def async_request_data(self, param):
"""Request new data in async way."""
await self.request_data()
_LOGGER.debug("New data from KEBA wallbox requested") | [
"async",
"def",
"async_request_data",
"(",
"self",
",",
"param",
")",
":",
"await",
"self",
".",
"request_data",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"New data from KEBA wallbox requested\"",
")"
] | [
182,
4
] | [
185,
61
] | python | en | ['en', 'en', 'en'] | True |
KebaHandler.async_set_energy | (self, param) | Set energy target in async way. | Set energy target in async way. | async def async_set_energy(self, param):
"""Set energy target in async way."""
try:
energy = param["energy"]
await self.set_energy(float(energy))
self._set_fast_polling()
except (KeyError, ValueError) as ex:
_LOGGER.warning("Energy value is not cor... | [
"async",
"def",
"async_set_energy",
"(",
"self",
",",
"param",
")",
":",
"try",
":",
"energy",
"=",
"param",
"[",
"\"energy\"",
"]",
"await",
"self",
".",
"set_energy",
"(",
"float",
"(",
"energy",
")",
")",
"self",
".",
"_set_fast_polling",
"(",
")",
... | [
187,
4
] | [
194,
66
] | python | en | ['en', 'af', 'en'] | True |
KebaHandler.async_set_current | (self, param) | Set current maximum in async way. | Set current maximum in async way. | async def async_set_current(self, param):
"""Set current maximum in async way."""
try:
current = param["current"]
await self.set_current(float(current))
# No fast polling as this function might be called regularly
except (KeyError, ValueError) as ex:
... | [
"async",
"def",
"async_set_current",
"(",
"self",
",",
"param",
")",
":",
"try",
":",
"current",
"=",
"param",
"[",
"\"current\"",
"]",
"await",
"self",
".",
"set_current",
"(",
"float",
"(",
"current",
")",
")",
"# No fast polling as this function might be call... | [
196,
4
] | [
203,
67
] | python | en | ['en', 'la', 'en'] | True |
KebaHandler.async_start | (self, param=None) | Authorize EV in async way. | Authorize EV in async way. | async def async_start(self, param=None):
"""Authorize EV in async way."""
await self.start(self.rfid)
self._set_fast_polling() | [
"async",
"def",
"async_start",
"(",
"self",
",",
"param",
"=",
"None",
")",
":",
"await",
"self",
".",
"start",
"(",
"self",
".",
"rfid",
")",
"self",
".",
"_set_fast_polling",
"(",
")"
] | [
205,
4
] | [
208,
32
] | python | en | ['en', 'en', 'en'] | True |
KebaHandler.async_stop | (self, param=None) | De-authorize EV in async way. | De-authorize EV in async way. | async def async_stop(self, param=None):
"""De-authorize EV in async way."""
await self.stop(self.rfid)
self._set_fast_polling() | [
"async",
"def",
"async_stop",
"(",
"self",
",",
"param",
"=",
"None",
")",
":",
"await",
"self",
".",
"stop",
"(",
"self",
".",
"rfid",
")",
"self",
".",
"_set_fast_polling",
"(",
")"
] | [
210,
4
] | [
213,
32
] | python | en | ['en', 'es', 'it'] | False |
KebaHandler.async_enable_ev | (self, param=None) | Enable EV in async way. | Enable EV in async way. | async def async_enable_ev(self, param=None):
"""Enable EV in async way."""
await self.enable(True)
self._set_fast_polling() | [
"async",
"def",
"async_enable_ev",
"(",
"self",
",",
"param",
"=",
"None",
")",
":",
"await",
"self",
".",
"enable",
"(",
"True",
")",
"self",
".",
"_set_fast_polling",
"(",
")"
] | [
215,
4
] | [
218,
32
] | python | en | ['en', 'es', 'en'] | True |
KebaHandler.async_disable_ev | (self, param=None) | Disable EV in async way. | Disable EV in async way. | async def async_disable_ev(self, param=None):
"""Disable EV in async way."""
await self.enable(False)
self._set_fast_polling() | [
"async",
"def",
"async_disable_ev",
"(",
"self",
",",
"param",
"=",
"None",
")",
":",
"await",
"self",
".",
"enable",
"(",
"False",
")",
"self",
".",
"_set_fast_polling",
"(",
")"
] | [
220,
4
] | [
223,
32
] | python | en | ['en', 'es', 'en'] | True |
KebaHandler.async_set_failsafe | (self, param=None) | Set failsafe mode in async way. | Set failsafe mode in async way. | async def async_set_failsafe(self, param=None):
"""Set failsafe mode in async way."""
try:
timeout = param[CONF_FS_TIMEOUT]
fallback = param[CONF_FS_FALLBACK]
persist = param[CONF_FS_PERSIST]
await self.set_failsafe(int(timeout), float(fallback), bool(pers... | [
"async",
"def",
"async_set_failsafe",
"(",
"self",
",",
"param",
"=",
"None",
")",
":",
"try",
":",
"timeout",
"=",
"param",
"[",
"CONF_FS_TIMEOUT",
"]",
"fallback",
"=",
"param",
"[",
"CONF_FS_FALLBACK",
"]",
"persist",
"=",
"param",
"[",
"CONF_FS_PERSIST",... | [
225,
4
] | [
238,
13
] | python | en | ['en', 'en', 'en'] | True |
ROIAlign.__init__ | (self, output_size, spatial_scale, sampling_ratio=1) |
:param output_size: e.g. (3,3)
:param spatial_scale: e.g. 1.0/16
:param sampling_ratio: e.g. 1
|
:param output_size: e.g. (3,3)
:param spatial_scale: e.g. 1.0/16
:param sampling_ratio: e.g. 1
| def __init__(self, output_size, spatial_scale, sampling_ratio=1):
"""
:param output_size: e.g. (3,3)
:param spatial_scale: e.g. 1.0/16
:param sampling_ratio: e.g. 1
"""
super(ROIAlign, self).__init__()
self.output_size = output_size
self.spatial_scale = sp... | [
"def",
"__init__",
"(",
"self",
",",
"output_size",
",",
"spatial_scale",
",",
"sampling_ratio",
"=",
"1",
")",
":",
"super",
"(",
"ROIAlign",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"output_size",
"=",
"output_size",
"self",
".",
"spat... | [
50,
4
] | [
59,
44
] | python | en | ['en', 'error', 'th'] | False |
ROIAlign.forward | (self, input, rois) |
:param input: the input features [B C H W]
:param rois: [k, 5]: (im_index, x1, y1, x2, y2)
:return: pooled features [K C H W], K = k
|
:param input: the input features [B C H W]
:param rois: [k, 5]: (im_index, x1, y1, x2, y2)
:return: pooled features [K C H W], K = k
| def forward(self, input, rois):
"""
:param input: the input features [B C H W]
:param rois: [k, 5]: (im_index, x1, y1, x2, y2)
:return: pooled features [K C H W], K = k
"""
return roi_align(
input.float(), rois.float(), self.output_size, self.spatial_scale, se... | [
"def",
"forward",
"(",
"self",
",",
"input",
",",
"rois",
")",
":",
"return",
"roi_align",
"(",
"input",
".",
"float",
"(",
")",
",",
"rois",
".",
"float",
"(",
")",
",",
"self",
".",
"output_size",
",",
"self",
".",
"spatial_scale",
",",
"self",
"... | [
61,
4
] | [
69,
9
] | python | en | ['en', 'error', 'th'] | False |
_async_reproduce_state | (
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce a single state. | Reproduce a single state. | async def _async_reproduce_state(
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce a single state."""
cur_state = hass.states.get(state.entity_id)
if cur_state is None:
_LOGGE... | [
"async",
"def",
"_async_reproduce_state",
"(",
"hass",
":",
"HomeAssistantType",
",",
"state",
":",
"State",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reproduce_options",
":",
"Optional",
"[",
"Dict",
"[",
"str",
",... | [
22,
0
] | [
56,
5
] | python | en | ['en', 'en', 'en'] | True |
async_reproduce_states | (
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) | Reproduce Alert states. | Reproduce Alert states. | async def async_reproduce_states(
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce Alert states."""
# Reproduce states in parallel.
await asyncio.gather(
*(
... | [
"async",
"def",
"async_reproduce_states",
"(",
"hass",
":",
"HomeAssistantType",
",",
"states",
":",
"Iterable",
"[",
"State",
"]",
",",
"*",
",",
"context",
":",
"Optional",
"[",
"Context",
"]",
"=",
"None",
",",
"reproduce_options",
":",
"Optional",
"[",
... | [
59,
0
] | [
75,
5
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (hass: HomeAssistant, device_id: str) | List device triggers for Cover devices. | List device triggers for Cover devices. | async def async_get_triggers(hass: HomeAssistant, device_id: str) -> List[dict]:
"""List device triggers for Cover devices."""
registry = await entity_registry.async_get_registry(hass)
triggers = []
# Get all the integrations entities for this device
for entry in entity_registry.async_entries_for_d... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
":",
"HomeAssistant",
",",
"device_id",
":",
"str",
")",
"->",
"List",
"[",
"dict",
"]",
":",
"registry",
"=",
"await",
"entity_registry",
".",
"async_get_registry",
"(",
"hass",
")",
"triggers",
"=",
"[",
... | [
67,
0
] | [
143,
19
] | python | en | ['da', 'en', 'en'] | True |
async_get_trigger_capabilities | (hass: HomeAssistant, config: dict) | List trigger capabilities. | List trigger capabilities. | async def async_get_trigger_capabilities(hass: HomeAssistant, config: dict) -> dict:
"""List trigger capabilities."""
if config[CONF_TYPE] not in ["position", "tilt_position"]:
return {}
return {
"extra_fields": vol.Schema(
{
vol.Optional(CONF_ABOVE, default=0): ... | [
"async",
"def",
"async_get_trigger_capabilities",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"dict",
")",
"->",
"dict",
":",
"if",
"config",
"[",
"CONF_TYPE",
"]",
"not",
"in",
"[",
"\"position\"",
",",
"\"tilt_position\"",
"]",
":",
"return",
"{... | [
146,
0
] | [
162,
5
] | python | en | ['en', 'la', 'en'] | True |
async_attach_trigger | (
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) | Attach a trigger. | Attach a trigger. | async def async_attach_trigger(
hass: HomeAssistant,
config: ConfigType,
action: AutomationActionType,
automation_info: dict,
) -> CALLBACK_TYPE:
"""Attach a trigger."""
config = TRIGGER_SCHEMA(config)
if config[CONF_TYPE] in STATE_TRIGGER_TYPES:
if config[CONF_TYPE] == "opened":
... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
",",
"action",
":",
"AutomationActionType",
",",
"automation_info",
":",
"dict",
",",
")",
"->",
"CALLBACK_TYPE",
":",
"config",
"=",
"TRIGGER_SCHEMA",
"... | [
165,
0
] | [
212,
5
] | python | en | ['en', 'lb', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up Hive light devices. | Set up Hive light devices. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up Hive light devices."""
if discovery_info is None:
return
session = hass.data.get(DATA_HIVE)
devs = []
for dev in discovery_info:
devs.append(HiveDeviceLight(session, dev))
add_entities(devs) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"session",
"=",
"hass",
".",
"data",
".",
"get",
"(",
"DATA_HIVE",
")",
"devs",
"... | [
15,
0
] | [
24,
22
] | python | en | ['fr', 'en', 'en'] | True |
HiveDeviceLight.__init__ | (self, hive_session, hive_device) | Initialize the Light device. | Initialize the Light device. | def __init__(self, hive_session, hive_device):
"""Initialize the Light device."""
super().__init__(hive_session, hive_device)
self.light_device_type = hive_device["Hive_Light_DeviceType"] | [
"def",
"__init__",
"(",
"self",
",",
"hive_session",
",",
"hive_device",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"hive_session",
",",
"hive_device",
")",
"self",
".",
"light_device_type",
"=",
"hive_device",
"[",
"\"Hive_Light_DeviceType\"",
"]"
] | [
30,
4
] | [
33,
69
] | python | en | ['en', 'en', 'en'] | True |
HiveDeviceLight.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"
] | [
36,
4
] | [
38,
30
] | python | en | ['en', 'cy', 'en'] | True |
HiveDeviceLight.device_info | (self) | Return device information. | Return device information. | def device_info(self):
"""Return device information."""
return {"identifiers": {(DOMAIN, self.unique_id)}, "name": self.name} | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"unique_id",
")",
"}",
",",
"\"name\"",
":",
"self",
".",
"name",
"}"
] | [
41,
4
] | [
43,
77
] | python | da | ['es', 'da', 'en'] | False |
HiveDeviceLight.name | (self) | Return the display name of this light. | Return the display name of this light. | def name(self):
"""Return the display name of this light."""
return self.node_name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"node_name"
] | [
46,
4
] | [
48,
29
] | python | en | ['en', 'en', 'en'] | True |
HiveDeviceLight.device_state_attributes | (self) | Show Device Attributes. | Show Device Attributes. | def device_state_attributes(self):
"""Show Device Attributes."""
return self.attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"attributes"
] | [
51,
4
] | [
53,
30
] | python | en | ['en', 'en', 'en'] | True |
HiveDeviceLight.brightness | (self) | Brightness of the light (an integer in the range 1-255). | Brightness of the light (an integer in the range 1-255). | def brightness(self):
"""Brightness of the light (an integer in the range 1-255)."""
return self.session.light.get_brightness(self.node_id) | [
"def",
"brightness",
"(",
"self",
")",
":",
"return",
"self",
".",
"session",
".",
"light",
".",
"get_brightness",
"(",
"self",
".",
"node_id",
")"
] | [
56,
4
] | [
58,
62
] | python | en | ['en', 'no', 'en'] | True |
HiveDeviceLight.min_mireds | (self) | Return the coldest color_temp that this light supports. | Return the coldest color_temp that this light supports. | def min_mireds(self):
"""Return the coldest color_temp that this light supports."""
if (
self.light_device_type == "tuneablelight"
or self.light_device_type == "colourtuneablelight"
):
return self.session.light.get_min_color_temp(self.node_id) | [
"def",
"min_mireds",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"light_device_type",
"==",
"\"tuneablelight\"",
"or",
"self",
".",
"light_device_type",
"==",
"\"colourtuneablelight\"",
")",
":",
"return",
"self",
".",
"session",
".",
"light",
".",
"get_min... | [
61,
4
] | [
67,
70
] | python | en | ['en', 'en', 'en'] | True |
HiveDeviceLight.max_mireds | (self) | Return the warmest color_temp that this light supports. | Return the warmest color_temp that this light supports. | def max_mireds(self):
"""Return the warmest color_temp that this light supports."""
if (
self.light_device_type == "tuneablelight"
or self.light_device_type == "colourtuneablelight"
):
return self.session.light.get_max_color_temp(self.node_id) | [
"def",
"max_mireds",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"light_device_type",
"==",
"\"tuneablelight\"",
"or",
"self",
".",
"light_device_type",
"==",
"\"colourtuneablelight\"",
")",
":",
"return",
"self",
".",
"session",
".",
"light",
".",
"get_max... | [
70,
4
] | [
76,
70
] | python | en | ['en', 'en', 'en'] | True |
HiveDeviceLight.color_temp | (self) | Return the CT color value in mireds. | Return the CT color value in mireds. | def color_temp(self):
"""Return the CT color value in mireds."""
if (
self.light_device_type == "tuneablelight"
or self.light_device_type == "colourtuneablelight"
):
return self.session.light.get_color_temp(self.node_id) | [
"def",
"color_temp",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"light_device_type",
"==",
"\"tuneablelight\"",
"or",
"self",
".",
"light_device_type",
"==",
"\"colourtuneablelight\"",
")",
":",
"return",
"self",
".",
"session",
".",
"light",
".",
"get_col... | [
79,
4
] | [
85,
66
] | python | en | ['en', 'en', 'en'] | True |
HiveDeviceLight.hs_color | (self) | Return the hs color value. | Return the hs color value. | def hs_color(self) -> tuple:
"""Return the hs color value."""
if self.light_device_type == "colourtuneablelight":
rgb = self.session.light.get_color(self.node_id)
return color_util.color_RGB_to_hs(*rgb) | [
"def",
"hs_color",
"(",
"self",
")",
"->",
"tuple",
":",
"if",
"self",
".",
"light_device_type",
"==",
"\"colourtuneablelight\"",
":",
"rgb",
"=",
"self",
".",
"session",
".",
"light",
".",
"get_color",
"(",
"self",
".",
"node_id",
")",
"return",
"color_ut... | [
88,
4
] | [
92,
51
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.