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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
GeniusIssue.async_update | (self) | Process the sensor's state data. | Process the sensor's state data. | async def async_update(self) -> None:
"""Process the sensor's state data."""
self._issues = [
i["description"] for i in self._hub.issues if i["level"] == self._level
] | [
"async",
"def",
"async_update",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_issues",
"=",
"[",
"i",
"[",
"\"description\"",
"]",
"for",
"i",
"in",
"self",
".",
"_hub",
".",
"issues",
"if",
"i",
"[",
"\"level\"",
"]",
"==",
"self",
".",
"_le... | [
112,
4
] | [
116,
9
] | python | en | ['en', 'en', 'en'] | True |
clone | (obj: any) | Clone an object with pickle dumps and loads.
Args:
obj (any): The object to clone.
Returns:
any: The clone of the object.
| Clone an object with pickle dumps and loads. | def clone(obj: any) -> any:
"""Clone an object with pickle dumps and loads.
Args:
obj (any): The object to clone.
Returns:
any: The clone of the object.
"""
return loads(dumps(obj)) | [
"def",
"clone",
"(",
"obj",
":",
"any",
")",
"->",
"any",
":",
"return",
"loads",
"(",
"dumps",
"(",
"obj",
")",
")"
] | [
21,
0
] | [
30,
28
] | python | en | ['en', 'en', 'en'] | True |
convert_dottable | (natural_dict: dict) | Convert a dictionary to DottableDict.
Args:
natural_dict (dict): Dictionary to convert to DottableDict.
Returns:
DottableDict: Dottable object.
| Convert a dictionary to DottableDict. | def convert_dottable(natural_dict: dict) -> DottableDict:
"""Convert a dictionary to DottableDict.
Args:
natural_dict (dict): Dictionary to convert to DottableDict.
Returns:
DottableDict: Dottable object.
"""
dottable_dict = DottableDict(natural_dict)
for k, v in natural_dict.i... | [
"def",
"convert_dottable",
"(",
"natural_dict",
":",
"dict",
")",
"->",
"DottableDict",
":",
"dottable_dict",
"=",
"DottableDict",
"(",
"natural_dict",
")",
"for",
"k",
",",
"v",
"in",
"natural_dict",
".",
"items",
"(",
")",
":",
"if",
"type",
"(",
"v",
... | [
41,
0
] | [
55,
24
] | python | en | ['en', 'en', 'it'] | True |
set_seeds | (seed) | Set the seeds of ``Torch``, ``np.random`` and ``random``.
Args:
seed : Value of the seed.
| Set the seeds of ``Torch``, ``np.random`` and ``random``. | def set_seeds(seed):
"""Set the seeds of ``Torch``, ``np.random`` and ``random``.
Args:
seed : Value of the seed.
"""
try:
import torch
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(seed)
except Exception:
warn... | [
"def",
"set_seeds",
"(",
"seed",
")",
":",
"try",
":",
"import",
"torch",
"torch",
".",
"manual_seed",
"(",
"seed",
")",
"if",
"torch",
".",
"cuda",
".",
"is_available",
"(",
")",
":",
"torch",
".",
"cuda",
".",
"manual_seed_all",
"(",
"seed",
")",
"... | [
58,
0
] | [
75,
21
] | python | en | ['en', 'en', 'en'] | True |
deploy | (hide_info: bool = True) | Deploy the meta files, and lib files of MARO to `~/.maro`.
Args:
hide_info (bool): (optional) If True, will not display any information,\n
else info and error logs will be shown.
| Deploy the meta files, and lib files of MARO to `~/.maro`. | def deploy(hide_info: bool = True):
"""Deploy the meta files, and lib files of MARO to `~/.maro`.
Args:
hide_info (bool): (optional) If True, will not display any information,\n
else info and error logs will be shown.
"""
info_list = []
error_list = []
try:
_clean_de... | [
"def",
"deploy",
"(",
"hide_info",
":",
"bool",
"=",
"True",
")",
":",
"info_list",
"=",
"[",
"]",
"error_list",
"=",
"[",
"]",
"try",
":",
"_clean_deployment_folder",
"(",
")",
"# Deployment started.",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",... | [
114,
0
] | [
162,
39
] | python | en | ['en', 'en', 'en'] | True |
check_deployment_status | () | Check if re-deployment is needed.
Returns:
bool: If need to re-deploy then True, else False.
| Check if re-deployment is needed. | def check_deployment_status() -> bool:
"""Check if re-deployment is needed.
Returns:
bool: If need to re-deploy then True, else False.
"""
ret = False
skip_deployment = os.environ.get("SKIP_DEPLOYMENT", "FALSE")
if skip_deployment == "TRUE":
ret = True
elif os.path.exists(ve... | [
"def",
"check_deployment_status",
"(",
")",
"->",
"bool",
":",
"ret",
"=",
"False",
"skip_deployment",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"SKIP_DEPLOYMENT\"",
",",
"\"FALSE\"",
")",
"if",
"skip_deployment",
"==",
"\"TRUE\"",
":",
"ret",
"=",
"True... | [
165,
0
] | [
185,
14
] | python | en | ['en', 'en', 'en'] | True |
FixedProductTuner.__init__ | (self, product) |
:param product: the constant provided, should be 2 in EfficientNet-B1
|
:param product: the constant provided, should be 2 in EfficientNet-B1
| def __init__(self, product):
"""
:param product: the constant provided, should be 2 in EfficientNet-B1
"""
super().__init__()
self.product = product | [
"def",
"__init__",
"(",
"self",
",",
"product",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"product",
"=",
"product"
] | [
9,
4
] | [
14,
30
] | python | en | ['en', 'error', 'th'] | False |
FixedProductTuner._expand_parameters | (self, para) |
Filter out all qualified parameters
|
Filter out all qualified parameters
| def _expand_parameters(self, para):
"""
Filter out all qualified parameters
"""
para = super()._expand_parameters(para)
if all([key in para[0] for key in ["alpha", "beta", "gamma"]]): # if this is an interested set
ret_para = []
for p in para:
... | [
"def",
"_expand_parameters",
"(",
"self",
",",
"para",
")",
":",
"para",
"=",
"super",
"(",
")",
".",
"_expand_parameters",
"(",
"para",
")",
"if",
"all",
"(",
"[",
"key",
"in",
"para",
"[",
"0",
"]",
"for",
"key",
"in",
"[",
"\"alpha\"",
",",
"\"b... | [
16,
4
] | [
28,
19
] | python | en | ['en', 'error', 'th'] | False |
filter_html | (html, mode="html", **kwargs) |
Turn multicode comments into a div (after markdown inside is parsed). You
can use this div for styling even in PDF format. Doesn't apply to Markdown
since most parsers won't parse markdown inside HTML blocks.
|
Turn multicode comments into a div (after markdown inside is parsed). You
can use this div for styling even in PDF format. Doesn't apply to Markdown
since most parsers won't parse markdown inside HTML blocks.
| def filter_html(html, mode="html", **kwargs):
"""
Turn multicode comments into a div (after markdown inside is parsed). You
can use this div for styling even in PDF format. Doesn't apply to Markdown
since most parsers won't parse markdown inside HTML blocks.
"""
if mode == "md":
return ... | [
"def",
"filter_html",
"(",
"html",
",",
"mode",
"=",
"\"html\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mode",
"==",
"\"md\"",
":",
"return",
"html",
"html",
"=",
"re",
".",
"sub",
"(",
"START_REGEX",
",",
"START_REPL",
",",
"html",
",",
"count",
... | [
16,
0
] | [
32,
15
] | python | en | ['en', 'error', 'th'] | False |
async_setup | (hass, config) | Set up the Hue platform. | Set up the Hue platform. | async def async_setup(hass, config):
"""Set up the Hue platform."""
async def hue_activate_scene(call, skip_reload=True):
"""Handle activation of Hue scene."""
# Get parameters
group_name = call.data[ATTR_GROUP_NAME]
scene_name = call.data[ATTR_SCENE_NAME]
# Call the se... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"async",
"def",
"hue_activate_scene",
"(",
"call",
",",
"skip_reload",
"=",
"True",
")",
":",
"\"\"\"Handle activation of Hue scene.\"\"\"",
"# Get parameters",
"group_name",
"=",
"call",
".",
"d... | [
28,
0
] | [
65,
15
] | python | en | ['en', 'da', 'en'] | True |
async_setup_entry | (
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
) | Set up a bridge from a config entry. | Set up a bridge from a config entry. | async def async_setup_entry(
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
):
"""Set up a bridge from a config entry."""
# Migrate allow_unreachable from config entry data to config entry options
if (
CONF_ALLOW_UNREACHABLE not in entry.options
and CONF_ALLOW_UNREACHABLE i... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
":",
"# Migrate allow_unreachable from config entry data to config entry options",
"if",
"(",
"CONF_ALLOW_UNREACHABLE",
"not",
... | [
68,
0
] | [
168,
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."""
bridge = hass.data[DOMAIN].pop(entry.entry_id)
hass.services.async_remove(DOMAIN, SERVICE_HUE_SCENE)
return await bridge.async_reset() | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"bridge",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"pop",
"(",
"entry",
".",
"entry_id",
")",
"hass",
".",
"services",
".",
"async_remove",
"(",
"DOMAIN",
",",
"SERVIC... | [
171,
0
] | [
175,
37
] | python | en | ['en', 'es', 'en'] | True |
entropy | (p, unlogit=False) | Compute the entropy of a probability distribution | Compute the entropy of a probability distribution | def entropy(p, unlogit=False):
""" Compute the entropy of a probability distribution """
exponent = 2
if unlogit:
p = torch.pow(p, exponent)
plogp = p * torch.log(p)
plogp[p == 0] = 0
return -plogp.sum(dim=-1) | [
"def",
"entropy",
"(",
"p",
",",
"unlogit",
"=",
"False",
")",
":",
"exponent",
"=",
"2",
"if",
"unlogit",
":",
"p",
"=",
"torch",
".",
"pow",
"(",
"p",
",",
"exponent",
")",
"plogp",
"=",
"p",
"*",
"torch",
".",
"log",
"(",
"p",
")",
"plogp",
... | [
37,
0
] | [
44,
29
] | python | en | ['en', 'en', 'en'] | True |
print_2d_tensor | (tensor) | Print a 2D tensor | Print a 2D tensor | def print_2d_tensor(tensor):
""" Print a 2D tensor """
logger.info("lv, h >\t" + "\t".join(f"{x + 1}" for x in range(len(tensor))))
for row in range(len(tensor)):
if tensor.dtype != torch.long:
logger.info(f"layer {row + 1}:\t" + "\t".join(f"{x:.5f}" for x in tensor[row].cpu().data))
... | [
"def",
"print_2d_tensor",
"(",
"tensor",
")",
":",
"logger",
".",
"info",
"(",
"\"lv, h >\\t\"",
"+",
"\"\\t\"",
".",
"join",
"(",
"f\"{x + 1}\"",
"for",
"x",
"in",
"range",
"(",
"len",
"(",
"tensor",
")",
")",
")",
")",
"for",
"row",
"in",
"range",
... | [
47,
0
] | [
54,
100
] | python | ca | ['en', 'ca', 'hi'] | False |
compute_heads_importance | (
args, model, eval_dataloader, compute_entropy=True, compute_importance=True, head_mask=None, actually_pruned=False
) | This method shows how to compute:
- head attention entropy
- head importance scores according to http://arxiv.org/abs/1905.10650
| This method shows how to compute:
- head attention entropy
- head importance scores according to http://arxiv.org/abs/1905.10650
| def compute_heads_importance(
args, model, eval_dataloader, compute_entropy=True, compute_importance=True, head_mask=None, actually_pruned=False
):
"""This method shows how to compute:
- head attention entropy
- head importance scores according to http://arxiv.org/abs/1905.10650
"""
# Prepare ou... | [
"def",
"compute_heads_importance",
"(",
"args",
",",
"model",
",",
"eval_dataloader",
",",
"compute_entropy",
"=",
"True",
",",
"compute_importance",
"=",
"True",
",",
"head_mask",
"=",
"None",
",",
"actually_pruned",
"=",
"False",
")",
":",
"# Prepare our tensors... | [
57,
0
] | [
128,
52
] | python | en | ['en', 'en', 'en'] | True |
mask_heads | (args, model, eval_dataloader) | This method shows how to mask head (set some heads to zero), to test the effect on the network,
based on the head importance scores, as described in Michel et al. (http://arxiv.org/abs/1905.10650)
| This method shows how to mask head (set some heads to zero), to test the effect on the network,
based on the head importance scores, as described in Michel et al. (http://arxiv.org/abs/1905.10650)
| def mask_heads(args, model, eval_dataloader):
"""This method shows how to mask head (set some heads to zero), to test the effect on the network,
based on the head importance scores, as described in Michel et al. (http://arxiv.org/abs/1905.10650)
"""
_, head_importance, loss = compute_heads_importance(ar... | [
"def",
"mask_heads",
"(",
"args",
",",
"model",
",",
"eval_dataloader",
")",
":",
"_",
",",
"head_importance",
",",
"loss",
"=",
"compute_heads_importance",
"(",
"args",
",",
"model",
",",
"eval_dataloader",
",",
"compute_entropy",
"=",
"False",
")",
"original... | [
131,
0
] | [
178,
20
] | python | en | ['en', 'en', 'en'] | True |
prune_heads | (args, model, eval_dataloader, head_mask) | This method shows how to prune head (remove heads weights) based on
the head importance scores as described in Michel et al. (http://arxiv.org/abs/1905.10650)
| This method shows how to prune head (remove heads weights) based on
the head importance scores as described in Michel et al. (http://arxiv.org/abs/1905.10650)
| def prune_heads(args, model, eval_dataloader, head_mask):
"""This method shows how to prune head (remove heads weights) based on
the head importance scores as described in Michel et al. (http://arxiv.org/abs/1905.10650)
"""
# Try pruning and test time speedup
# Pruning is like masking but we actuall... | [
"def",
"prune_heads",
"(",
"args",
",",
"model",
",",
"eval_dataloader",
",",
"head_mask",
")",
":",
"# Try pruning and test time speedup",
"# Pruning is like masking but we actually remove the masked weights",
"before_time",
"=",
"datetime",
".",
"now",
"(",
")",
"_",
",... | [
181,
0
] | [
231,
38
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_via_mqtt_message | (hass, mqtt_mock) | Test the setting of the value via MQTT. | Test the setting of the value via MQTT. | async def test_setting_sensor_value_via_mqtt_message(hass, mqtt_mock):
"""Test the setting of the value via MQTT."""
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
... | [
"async",
"def",
"test_setting_sensor_value_via_mqtt_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqt... | [
52,
0
] | [
72,
68
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_expires_availability_topic | (hass, mqtt_mock, caplog) | Test the expiration of the value. | Test the expiration of the value. | async def test_setting_sensor_value_expires_availability_topic(hass, mqtt_mock, caplog):
"""Test the expiration of the value."""
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
... | [
"async",
"def",
"test_setting_sensor_value_expires_availability_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"sensor",
".",
"DOMAIN",
":",
"{",
"\... | [
75,
0
] | [
102,
49
] | python | en | ['en', 'en', 'en'] | True |
test_setting_sensor_value_expires | (hass, mqtt_mock, caplog) | Test the expiration of the value. | Test the expiration of the value. | async def test_setting_sensor_value_expires(hass, mqtt_mock, caplog):
"""Test the expiration of the value."""
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state... | [
"async",
"def",
"test_setting_sensor_value_expires",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":"... | [
105,
0
] | [
127,
49
] | python | en | ['en', 'en', 'en'] | True |
expires_helper | (hass, mqtt_mock, caplog) | Run the basic expiry code. | Run the basic expiry code. | async def expires_helper(hass, mqtt_mock, caplog):
"""Run the basic expiry code."""
realnow = dt_util.utcnow()
now = datetime(realnow.year + 1, 1, 1, 1, tzinfo=dt_util.UTC)
with patch(("homeassistant.helpers.event.dt_util.utcnow"), return_value=now):
async_fire_time_changed(hass, now)
as... | [
"async",
"def",
"expires_helper",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"realnow",
"=",
"dt_util",
".",
"utcnow",
"(",
")",
"now",
"=",
"datetime",
"(",
"realnow",
".",
"year",
"+",
"1",
",",
"1",
",",
"1",
",",
"1",
",",
"tzinfo"... | [
130,
0
] | [
178,
43
] | python | en | ['en', 'sn', 'en'] | True |
test_setting_sensor_value_via_mqtt_json_message | (hass, mqtt_mock) | Test the setting of the value via MQTT with JSON payload. | Test the setting of the value via MQTT with JSON payload. | async def test_setting_sensor_value_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of the value via MQTT with JSON payload."""
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
sensor.DOMAIN: {
"platform": "mqtt",
"name": ... | [
"async",
"def",
"test_setting_sensor_value_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"... | [
181,
0
] | [
201,
31
] | python | en | ['en', 'en', 'en'] | True |
test_force_update_disabled | (hass, mqtt_mock) | Test force update option. | Test force update option. | async def test_force_update_disabled(hass, mqtt_mock):
"""Test force update option."""
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "test-topic",
... | [
"async",
"def",
"test_force_update_disabled",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"... | [
204,
0
] | [
234,
27
] | python | en | ['en', 'en', 'en'] | True |
test_force_update_enabled | (hass, mqtt_mock) | Test force update option. | Test force update option. | async def test_force_update_enabled(hass, mqtt_mock):
"""Test force update option."""
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topic": "test-topic",
... | [
"async",
"def",
"test_force_update_enabled",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\... | [
237,
0
] | [
268,
27
] | python | en | ['en', 'en', 'en'] | True |
test_availability_when_connection_lost | (hass, mqtt_mock) | Test availability after MQTT disconnection. | Test availability after MQTT disconnection. | async def test_availability_when_connection_lost(hass, mqtt_mock):
"""Test availability after MQTT disconnection."""
await help_test_availability_when_connection_lost(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
271,
0
] | [
275,
5
] | python | en | ['en', 'en', 'en'] | True |
test_availability_without_topic | (hass, mqtt_mock) | Test availability without defined availability topic. | Test availability without defined availability topic. | async def test_availability_without_topic(hass, mqtt_mock):
"""Test availability without defined availability topic."""
await help_test_availability_without_topic(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
278,
0
] | [
282,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_availability_payload | (hass, mqtt_mock) | Test availability by default payload with defined topic. | Test availability by default payload with defined topic. | async def test_default_availability_payload(hass, mqtt_mock):
"""Test availability by default payload with defined topic."""
await help_test_default_availability_payload(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
285,
0
] | [
289,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_availability_list_payload | (hass, mqtt_mock) | Test availability by default payload with defined topic. | Test availability by default payload with defined topic. | async def test_default_availability_list_payload(hass, mqtt_mock):
"""Test availability by default payload with defined topic."""
await help_test_default_availability_list_payload(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_default_availability_list_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_default_availability_list_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
292,
0
] | [
296,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_availability_list_single | (hass, mqtt_mock, caplog) | Test availability list and availability_topic are mutually exclusive. | Test availability list and availability_topic are mutually exclusive. | async def test_default_availability_list_single(hass, mqtt_mock, caplog):
"""Test availability list and availability_topic are mutually exclusive."""
await help_test_default_availability_list_single(
hass, mqtt_mock, caplog, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_default_availability_list_single",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_default_availability_list_single",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
... | [
299,
0
] | [
303,
5
] | python | en | ['en', 'en', 'en'] | True |
test_custom_availability_payload | (hass, mqtt_mock) | Test availability by custom payload with defined topic. | Test availability by custom payload with defined topic. | async def test_custom_availability_payload(hass, mqtt_mock):
"""Test availability by custom payload with defined topic."""
await help_test_custom_availability_payload(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
306,
0
] | [
310,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_availability | (hass, mqtt_mock) | Test availability discovery update. | Test availability discovery update. | async def test_discovery_update_availability(hass, mqtt_mock):
"""Test availability discovery update."""
await help_test_discovery_update_availability(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_discovery_update_availability",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_discovery_update_availability",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
313,
0
] | [
317,
5
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_device_class | (hass, mqtt_mock) | Test device_class option with invalid value. | Test device_class option with invalid value. | async def test_invalid_device_class(hass, mqtt_mock):
"""Test device_class option with invalid value."""
assert await async_setup_component(
hass,
sensor.DOMAIN,
{
sensor.DOMAIN: {
"platform": "mqtt",
"name": "test",
"state_topi... | [
"async",
"def",
"test_invalid_device_class",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"sensor",
".",
"DOMAIN",
",",
"{",
"sensor",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\... | [
320,
0
] | [
337,
24
] | python | en | ['en', 'en', 'en'] | True |
test_valid_device_class | (hass, mqtt_mock) | Test device_class option with valid values. | Test device_class option with valid values. | async def test_valid_device_class(hass, mqtt_mock):
"""Test device_class option with valid values."""
assert await async_setup_component(
hass,
"sensor",
{
"sensor": [
{
"platform": "mqtt",
"name": "Test 1",
... | [
"async",
"def",
"test_valid_device_class",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"sensor\"",
",",
"{",
"\"sensor\"",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Tes... | [
340,
0
] | [
362,
49
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_via_mqtt_json_message | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_via_mqtt_json_message(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
365,
0
] | [
369,
5
] | python | en | ['en', 'en', 'en'] | True |
test_setting_attribute_with_template | (hass, mqtt_mock) | Test the setting of attribute via MQTT with JSON payload. | Test the setting of attribute via MQTT with JSON payload. | async def test_setting_attribute_with_template(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload."""
await help_test_setting_attribute_with_template(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
372,
0
] | [
376,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_not_dict | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_not_dict(
hass, mqtt_mock, caplog, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_not_dict",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
"... | [
379,
0
] | [
383,
5
] | python | en | ['en', 'en', 'en'] | True |
test_update_with_json_attrs_bad_JSON | (hass, mqtt_mock, caplog) | Test attributes get extracted from a JSON result. | Test attributes get extracted from a JSON result. | async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result."""
await help_test_update_with_json_attrs_bad_JSON(
hass, mqtt_mock, caplog, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_update_with_json_attrs_bad_JSON",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
"... | [
386,
0
] | [
390,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_attr | (hass, mqtt_mock, caplog) | Test update of discovered MQTTAttributes. | Test update of discovered MQTTAttributes. | async def test_discovery_update_attr(hass, mqtt_mock, caplog):
"""Test update of discovered MQTTAttributes."""
await help_test_discovery_update_attr(
hass, mqtt_mock, caplog, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
393,
0
] | [
397,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass, mqtt_mock) | Test unique id option only creates one sensor per unique_id. | Test unique id option only creates one sensor per unique_id. | async def test_unique_id(hass, mqtt_mock):
"""Test unique id option only creates one sensor per unique_id."""
config = {
sensor.DOMAIN: [
{
"platform": "mqtt",
"name": "Test 1",
"state_topic": "test-topic",
"unique_id": "TOTALLY... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"sensor",
".",
"DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 1\"",
",",
"\"state_topic\"",
":",
"\"test-topic\"",
",",
... | [
400,
0
] | [
418,
69
] | python | en | ['en', 'fr', 'en'] | True |
test_discovery_removal_sensor | (hass, mqtt_mock, caplog) | Test removal of discovered sensor. | Test removal of discovered sensor. | async def test_discovery_removal_sensor(hass, mqtt_mock, caplog):
"""Test removal of discovered sensor."""
data = '{ "name": "test", "state_topic": "test_topic" }'
await help_test_discovery_removal(hass, mqtt_mock, caplog, sensor.DOMAIN, data) | [
"async",
"def",
"test_discovery_removal_sensor",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"'{ \"name\": \"test\", \"state_topic\": \"test_topic\" }'",
"await",
"help_test_discovery_removal",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
... | [
421,
0
] | [
424,
83
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_sensor_topic_template | (hass, mqtt_mock, caplog) | Test update of discovered sensor. | Test update of discovered sensor. | async def test_discovery_update_sensor_topic_template(hass, mqtt_mock, caplog):
"""Test update of discovered sensor."""
config = {"name": "test", "state_topic": "test_topic"}
config1 = copy.deepcopy(config)
config2 = copy.deepcopy(config)
config1["name"] = "Beer"
config2["name"] = "Milk"
con... | [
"async",
"def",
"test_discovery_update_sensor_topic_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config",
"=",
"{",
"\"name\"",
":",
"\"test\"",
",",
"\"state_topic\"",
":",
"\"test_topic\"",
"}",
"config1",
"=",
"copy",
".",
"deepcopy",
"... | [
427,
0
] | [
459,
5
] | python | en | ['en', 'da', 'en'] | True |
test_discovery_update_sensor_template | (hass, mqtt_mock, caplog) | Test update of discovered sensor. | Test update of discovered sensor. | async def test_discovery_update_sensor_template(hass, mqtt_mock, caplog):
"""Test update of discovered sensor."""
config = {"name": "test", "state_topic": "test_topic"}
config1 = copy.deepcopy(config)
config2 = copy.deepcopy(config)
config1["name"] = "Beer"
config2["name"] = "Milk"
config1["... | [
"async",
"def",
"test_discovery_update_sensor_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"config",
"=",
"{",
"\"name\"",
":",
"\"test\"",
",",
"\"state_topic\"",
":",
"\"test_topic\"",
"}",
"config1",
"=",
"copy",
".",
"deepcopy",
"(",
... | [
462,
0
] | [
492,
5
] | python | en | ['en', 'da', 'en'] | True |
test_discovery_update_unchanged_sensor | (hass, mqtt_mock, caplog) | Test update of discovered sensor. | Test update of discovered sensor. | async def test_discovery_update_unchanged_sensor(hass, mqtt_mock, caplog):
"""Test update of discovered sensor."""
data1 = '{ "name": "Beer", "state_topic": "test_topic" }'
with patch(
"homeassistant.components.mqtt.sensor.MqttSensor.discovery_update"
) as discovery_update:
await help_te... | [
"async",
"def",
"test_discovery_update_unchanged_sensor",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\", \"state_topic\": \"test_topic\" }'",
"with",
"patch",
"(",
"\"homeassistant.components.mqtt.sensor.MqttSensor.discovery_update\"",... | [
495,
0
] | [
503,
9
] | python | en | ['en', 'da', 'en'] | True |
test_discovery_broken | (hass, mqtt_mock, caplog) | Test handling of bad discovery message. | Test handling of bad discovery message. | async def test_discovery_broken(hass, mqtt_mock, caplog):
"""Test handling of bad discovery message."""
data1 = '{ "name": "Beer", "state_topic": "test_topic#" }'
data2 = '{ "name": "Milk", "state_topic": "test_topic" }'
await help_test_discovery_broken(
hass, mqtt_mock, caplog, sensor.DOMAIN, d... | [
"async",
"def",
"test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\", \"state_topic\": \"test_topic#\" }'",
"data2",
"=",
"'{ \"name\": \"Milk\", \"state_topic\": \"test_topic\" }'",
"await",
"help_test_discovery_br... | [
507,
0
] | [
513,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT sensor device registry integration. | Test MQTT sensor device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT sensor device registry integration."""
await help_test_entity_device_info_with_connection(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
516,
0
] | [
520,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT sensor device registry integration. | Test MQTT sensor device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT sensor device registry integration."""
await help_test_entity_device_info_with_identifier(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
523,
0
] | [
527,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_update | (hass, mqtt_mock) | Test device registry update. | Test device registry update. | async def test_entity_device_info_update(hass, mqtt_mock):
"""Test device registry update."""
await help_test_entity_device_info_update(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
530,
0
] | [
534,
5
] | python | en | ['fr', 'fy', 'en'] | False |
test_entity_device_info_remove | (hass, mqtt_mock) | Test device registry remove. | Test device registry remove. | async def test_entity_device_info_remove(hass, mqtt_mock):
"""Test device registry remove."""
await help_test_entity_device_info_remove(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
537,
0
] | [
541,
5
] | python | en | ['fr', 'en', 'en'] | True |
test_entity_id_update_subscriptions | (hass, mqtt_mock) | Test MQTT subscriptions are managed when entity_id is updated. | Test MQTT subscriptions are managed when entity_id is updated. | async def test_entity_id_update_subscriptions(hass, mqtt_mock):
"""Test MQTT subscriptions are managed when entity_id is updated."""
await help_test_entity_id_update_subscriptions(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
544,
0
] | [
548,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_id_update_discovery_update | (hass, mqtt_mock) | Test MQTT discovery update when entity_id is updated. | Test MQTT discovery update when entity_id is updated. | async def test_entity_id_update_discovery_update(hass, mqtt_mock):
"""Test MQTT discovery update when entity_id is updated."""
await help_test_entity_id_update_discovery_update(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
551,
0
] | [
555,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_hub | (hass, mqtt_mock) | Test MQTT sensor device registry integration. | Test MQTT sensor device registry integration. | async def test_entity_device_info_with_hub(hass, mqtt_mock):
"""Test MQTT sensor device registry integration."""
registry = await hass.helpers.device_registry.async_get_registry()
hub = registry.async_get_or_create(
config_entry_id="123",
connections=set(),
identifiers={("mqtt", "hub... | [
"async",
"def",
"test_entity_device_info_with_hub",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"device_registry",
".",
"async_get_registry",
"(",
")",
"hub",
"=",
"registry",
".",
"async_get_or_create",
"(",
"... | [
558,
0
] | [
583,
41
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_debug_info | (hass, mqtt_mock) | Test MQTT sensor debug info. | Test MQTT sensor debug info. | async def test_entity_debug_info(hass, mqtt_mock):
"""Test MQTT sensor debug info."""
await help_test_entity_debug_info(hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG) | [
"async",
"def",
"test_entity_debug_info",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
586,
0
] | [
588,
85
] | python | es | ['es', 'mt', 'nl'] | False |
test_entity_debug_info_max_messages | (hass, mqtt_mock) | Test MQTT sensor debug info. | Test MQTT sensor debug info. | async def test_entity_debug_info_max_messages(hass, mqtt_mock):
"""Test MQTT sensor debug info."""
await help_test_entity_debug_info_max_messages(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_debug_info_max_messages",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_max_messages",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
591,
0
] | [
595,
5
] | python | es | ['es', 'mt', 'nl'] | False |
test_entity_debug_info_message | (hass, mqtt_mock) | Test MQTT debug info. | Test MQTT debug info. | async def test_entity_debug_info_message(hass, mqtt_mock):
"""Test MQTT debug info."""
await help_test_entity_debug_info_message(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
598,
0
] | [
602,
5
] | python | es | ['es', 'mt', 'it'] | False |
test_entity_debug_info_remove | (hass, mqtt_mock) | Test MQTT sensor debug info. | Test MQTT sensor debug info. | async def test_entity_debug_info_remove(hass, mqtt_mock):
"""Test MQTT sensor debug info."""
await help_test_entity_debug_info_remove(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_debug_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
605,
0
] | [
609,
5
] | python | es | ['es', 'mt', 'nl'] | False |
test_entity_debug_info_update_entity_id | (hass, mqtt_mock) | Test MQTT sensor debug info. | Test MQTT sensor debug info. | async def test_entity_debug_info_update_entity_id(hass, mqtt_mock):
"""Test MQTT sensor debug info."""
await help_test_entity_debug_info_update_entity_id(
hass, mqtt_mock, sensor.DOMAIN, DEFAULT_CONFIG
) | [
"async",
"def",
"test_entity_debug_info_update_entity_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_debug_info_update_entity_id",
"(",
"hass",
",",
"mqtt_mock",
",",
"sensor",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG",
")"
] | [
612,
0
] | [
616,
5
] | python | es | ['es', 'mt', 'nl'] | False |
async_setup_entry | (hass, entry, async_add_entities) | Set up SimpliSafe freeze sensors based on a config entry. | Set up SimpliSafe freeze sensors based on a config entry. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up SimpliSafe freeze sensors based on a config entry."""
simplisafe = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
sensors = []
for system in simplisafe.systems.values():
if system.version == 2:
LOGGER.info("Skip... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"simplisafe",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"DATA_CLIENT",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"sensors",
"=",
"[",
"]",
"for",... | [
10,
0
] | [
24,
31
] | python | en | ['en', 'da', 'en'] | True |
SimplisafeFreezeSensor.__init__ | (self, simplisafe, system, sensor) | Initialize. | Initialize. | def __init__(self, simplisafe, system, sensor):
"""Initialize."""
super().__init__(simplisafe, system, sensor)
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"simplisafe",
",",
"system",
",",
"sensor",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"simplisafe",
",",
"system",
",",
"sensor",
")",
"self",
".",
"_state",
"=",
"None"
] | [
30,
4
] | [
33,
26
] | python | en | ['en', 'en', 'it'] | False |
SimplisafeFreezeSensor.device_class | (self) | Return type of sensor. | Return type of sensor. | def device_class(self):
"""Return type of sensor."""
return DEVICE_CLASS_TEMPERATURE | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_TEMPERATURE"
] | [
36,
4
] | [
38,
39
] | python | en | ['en', 'id', 'en'] | True |
SimplisafeFreezeSensor.unique_id | (self) | Return unique ID of sensor. | Return unique ID of sensor. | def unique_id(self):
"""Return unique ID of sensor."""
return self._sensor.serial | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sensor",
".",
"serial"
] | [
41,
4
] | [
43,
34
] | python | en | ['en', 'la', 'en'] | True |
SimplisafeFreezeSensor.unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def unit_of_measurement(self):
"""Return the unit of measurement."""
return TEMP_FAHRENHEIT | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"TEMP_FAHRENHEIT"
] | [
46,
4
] | [
48,
30
] | python | en | ['en', 'la', 'en'] | True |
SimplisafeFreezeSensor.state | (self) | Return the sensor state. | Return the sensor state. | def state(self):
"""Return the sensor state."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
51,
4
] | [
53,
26
] | python | en | ['en', 'bs', 'en'] | True |
SimplisafeFreezeSensor.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."""
self._state = self._sensor.temperature | [
"def",
"async_update_from_rest_api",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"_sensor",
".",
"temperature"
] | [
56,
4
] | [
58,
46
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistantType, config: ConfigType) | Set up the HomematicIP Cloud component. | Set up the HomematicIP Cloud component. | async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up the HomematicIP Cloud component."""
hass.data[DOMAIN] = {}
accesspoints = config.get(DOMAIN, [])
for conf in accesspoints:
if conf[CONF_ACCESSPOINT] not in {
entry.data[HMIPC_HAPID]
fo... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"=",
"{",
"}",
"accesspoints",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
",",
"[",
... | [
46,
0
] | [
69,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Set up an access point from a config entry. | Set up an access point from a config entry. | async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up an access point from a config entry."""
# 0.104 introduced config entry unique id, this makes upgrading possible
if entry.unique_id is None:
new_data = dict(entry.data)
hass.config_entries.async_upd... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"# 0.104 introduced config entry unique id, this makes upgrading possible",
"if",
"entry",
".",
"unique_id",
"is",
"None",
":",
"new_dat... | [
72,
0
] | [
110,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass: HomeAssistantType, entry: ConfigEntry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
hap = hass.data[DOMAIN].pop(entry.unique_id)
hap.reset_connection_listener()
await async_unload_services(hass)
return await hap.async_reset() | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"hap",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"pop",
"(",
"entry",
".",
"unique_id",
")",
"hap",
".",
"re... | [
113,
0
] | [
120,
34
] | python | en | ['en', 'es', 'en'] | True |
async_remove_obsolete_entities | (
hass: HomeAssistantType, entry: ConfigEntry, hap: HomematicipHAP
) | Remove obsolete entities from entity registry. | Remove obsolete entities from entity registry. | async def async_remove_obsolete_entities(
hass: HomeAssistantType, entry: ConfigEntry, hap: HomematicipHAP
):
"""Remove obsolete entities from entity registry."""
if hap.home.currentAPVersion < "2.2.12":
return
entity_registry = await er.async_get_registry(hass)
er_entries = async_entries_... | [
"async",
"def",
"async_remove_obsolete_entities",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"hap",
":",
"HomematicipHAP",
")",
":",
"if",
"hap",
".",
"home",
".",
"currentAPVersion",
"<",
"\"2.2.12\"",
":",
"return",
"entity_r... | [
123,
0
] | [
140,
64
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up TP-Link LTE component. | Set up TP-Link LTE component. | async def async_setup(hass, config):
"""Set up TP-Link LTE component."""
if DATA_KEY not in hass.data:
websession = async_create_clientsession(
hass, cookie_jar=aiohttp.CookieJar(unsafe=True)
)
hass.data[DATA_KEY] = LTEData(websession)
domain_config = config.get(DOMAIN, ... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"if",
"DATA_KEY",
"not",
"in",
"hass",
".",
"data",
":",
"websession",
"=",
"async_create_clientsession",
"(",
"hass",
",",
"cookie_jar",
"=",
"aiohttp",
".",
"CookieJar",
"(",
"unsafe",
... | [
82,
0
] | [
104,
15
] | python | en | ['en', 'da', 'en'] | True |
_setup_lte | (hass, lte_config, delay=0) | Set up a TP-Link LTE modem. | Set up a TP-Link LTE modem. | async def _setup_lte(hass, lte_config, delay=0):
"""Set up a TP-Link LTE modem."""
host = lte_config[CONF_HOST]
password = lte_config[CONF_PASSWORD]
websession = hass.data[DATA_KEY].websession
modem = tp_connected.Modem(hostname=host, websession=websession)
modem_data = ModemData(host, modem)... | [
"async",
"def",
"_setup_lte",
"(",
"hass",
",",
"lte_config",
",",
"delay",
"=",
"0",
")",
":",
"host",
"=",
"lte_config",
"[",
"CONF_HOST",
"]",
"password",
"=",
"lte_config",
"[",
"CONF_PASSWORD",
"]",
"websession",
"=",
"hass",
".",
"data",
"[",
"DATA... | [
107,
0
] | [
129,
75
] | python | en | ['en', 'da', 'en'] | True |
_login | (hass, modem_data, password) | Log in and complete setup. | Log in and complete setup. | async def _login(hass, modem_data, password):
"""Log in and complete setup."""
await modem_data.modem.login(password=password)
modem_data.connected = True
hass.data[DATA_KEY].modem_data[modem_data.host] = modem_data
async def cleanup(event):
"""Clean up resources."""
await modem_dat... | [
"async",
"def",
"_login",
"(",
"hass",
",",
"modem_data",
",",
"password",
")",
":",
"await",
"modem_data",
".",
"modem",
".",
"login",
"(",
"password",
"=",
"password",
")",
"modem_data",
".",
"connected",
"=",
"True",
"hass",
".",
"data",
"[",
"DATA_KE... | [
132,
0
] | [
142,
65
] | python | en | ['en', 'en', 'en'] | True |
_retry_login | (hass, modem_data, password) | Sleep and retry setup. | Sleep and retry setup. | async def _retry_login(hass, modem_data, password):
"""Sleep and retry setup."""
_LOGGER.warning("Could not connect to %s. Will keep trying", modem_data.host)
modem_data.connected = False
delay = 15
while not modem_data.connected:
await asyncio.sleep(delay)
try:
await... | [
"async",
"def",
"_retry_login",
"(",
"hass",
",",
"modem_data",
",",
"password",
")",
":",
"_LOGGER",
".",
"warning",
"(",
"\"Could not connect to %s. Will keep trying\"",
",",
"modem_data",
".",
"host",
")",
"modem_data",
".",
"connected",
"=",
"False",
"delay",
... | [
145,
0
] | [
160,
39
] | python | en | ['en', 'ceb', 'en'] | True |
test_climate_async_setup_entry | (hass, aioclient_mock) | Test climate setup. | Test climate setup. | async def test_climate_async_setup_entry(hass, aioclient_mock):
"""Test climate setup."""
aioclient_mock.get(
TEST_SYSTEM_URL,
text=TEST_SYSTEM_DATA,
)
aioclient_mock.get(
TEST_SET_URL,
text=TEST_SET_RESPONSE,
)
await add_mock_config(hass)
registry = await h... | [
"async",
"def",
"test_climate_async_setup_entry",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"TEST_SYSTEM_URL",
",",
"text",
"=",
"TEST_SYSTEM_DATA",
",",
")",
"aioclient_mock",
".",
"get",
"(",
"TEST_SET_URL",
",",
"text",
... | [
34,
0
] | [
169,
68
] | python | en | ['en', 'haw', 'en'] | True |
test_climate_async_failed_update | (hass, aioclient_mock) | Test climate change failure. | Test climate change failure. | async def test_climate_async_failed_update(hass, aioclient_mock):
"""Test climate change failure."""
aioclient_mock.get(
TEST_SYSTEM_URL,
text=TEST_SYSTEM_DATA,
)
aioclient_mock.get(
TEST_SET_URL,
exc=SyntaxError,
)
await add_mock_config(hass)
assert len(aio... | [
"async",
"def",
"test_climate_async_failed_update",
"(",
"hass",
",",
"aioclient_mock",
")",
":",
"aioclient_mock",
".",
"get",
"(",
"TEST_SYSTEM_URL",
",",
"text",
"=",
"TEST_SYSTEM_DATA",
",",
")",
"aioclient_mock",
".",
"get",
"(",
"TEST_SET_URL",
",",
"exc",
... | [
172,
0
] | [
195,
64
] | python | fr | ['fr', 'fr', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the WHOIS sensor. | Set up the WHOIS sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the WHOIS sensor."""
domain = config.get(CONF_DOMAIN)
name = config.get(CONF_NAME)
try:
if "expiration_date" in whois.whois(domain):
add_entities([WhoisSensor(name, domain)], True)
else:
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"domain",
"=",
"config",
".",
"get",
"(",
"CONF_DOMAIN",
")",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"try",
":",
... | [
33,
0
] | [
48,
14
] | python | en | ['en', 'haw', 'en'] | True |
WhoisSensor.__init__ | (self, name, domain) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, domain):
"""Initialize the sensor."""
self.whois = whois.whois
self._name = name
self._domain = domain
self._state = None
self._attributes = None | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"domain",
")",
":",
"self",
".",
"whois",
"=",
"whois",
".",
"whois",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_domain",
"=",
"domain",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_att... | [
54,
4
] | [
62,
31
] | python | en | ['en', 'en', 'en'] | True |
WhoisSensor.name | (self) | Return the name of the sensor. | Return the name of the sensor. | def name(self):
"""Return the name of the sensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
65,
4
] | [
67,
25
] | python | en | ['en', 'mi', 'en'] | True |
WhoisSensor.icon | (self) | Return the icon to represent this sensor. | Return the icon to represent this sensor. | def icon(self):
"""Return the icon to represent this sensor."""
return "mdi:calendar-clock" | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"\"mdi:calendar-clock\""
] | [
70,
4
] | [
72,
35
] | python | en | ['en', 'en', 'en'] | True |
WhoisSensor.unit_of_measurement | (self) | Return the unit of measurement to present the value in. | Return the unit of measurement to present the value in. | def unit_of_measurement(self):
"""Return the unit of measurement to present the value in."""
return TIME_DAYS | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"TIME_DAYS"
] | [
75,
4
] | [
77,
24
] | python | en | ['en', 'en', 'en'] | True |
WhoisSensor.state | (self) | Return the expiration days for hostname. | Return the expiration days for hostname. | def state(self):
"""Return the expiration days for hostname."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
80,
4
] | [
82,
26
] | python | en | ['en', 'no', 'en'] | True |
WhoisSensor.device_state_attributes | (self) | Get the more info attributes. | Get the more info attributes. | def device_state_attributes(self):
"""Get the more info attributes."""
return self._attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attributes"
] | [
85,
4
] | [
87,
31
] | python | en | ['en', 'en', 'en'] | True |
WhoisSensor._empty_state_and_attributes | (self) | Empty the state and attributes on an error. | Empty the state and attributes on an error. | def _empty_state_and_attributes(self):
"""Empty the state and attributes on an error."""
self._state = None
self._attributes = None | [
"def",
"_empty_state_and_attributes",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_attributes",
"=",
"None"
] | [
89,
4
] | [
92,
31
] | python | en | ['en', 'en', 'en'] | True |
WhoisSensor.update | (self) | Get the current WHOIS data for the domain. | Get the current WHOIS data for the domain. | def update(self):
"""Get the current WHOIS data for the domain."""
try:
response = self.whois(self._domain)
except whois.BaseException as ex: # pylint: disable=broad-except
_LOGGER.error("Exception %s occurred during WHOIS lookup", ex)
self._empty_state_and_a... | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"response",
"=",
"self",
".",
"whois",
"(",
"self",
".",
"_domain",
")",
"except",
"whois",
".",
"BaseException",
"as",
"ex",
":",
"# pylint: disable=broad-except",
"_LOGGER",
".",
"error",
"(",
"\"Except... | [
94,
4
] | [
142,
41
] | python | en | ['en', 'en', 'en'] | True |
setup | (hass, config) | Set up AquaLogic platform. | Set up AquaLogic platform. | def setup(hass, config):
"""Set up AquaLogic platform."""
host = config[DOMAIN][CONF_HOST]
port = config[DOMAIN][CONF_PORT]
processor = AquaLogicProcessor(hass, host, port)
hass.data[DOMAIN] = processor
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, processor.start_listen)
hass.bus.listen_o... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"host",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_HOST",
"]",
"port",
"=",
"config",
"[",
"DOMAIN",
"]",
"[",
"CONF_PORT",
"]",
"processor",
"=",
"AquaLogicProcessor",
"(",
"hass",
",",
"host",
... | [
34,
0
] | [
43,
15
] | python | en | ['en', 'ru', 'en'] | True |
AquaLogicProcessor.__init__ | (self, hass, host, port) | Initialize the data object. | Initialize the data object. | def __init__(self, hass, host, port):
"""Initialize the data object."""
super().__init__(daemon=True)
self._hass = hass
self._host = host
self._port = port
self._shutdown = False
self._panel = None | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"host",
",",
"port",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"daemon",
"=",
"True",
")",
"self",
".",
"_hass",
"=",
"hass",
"self",
".",
"_host",
"=",
"host",
"self",
".",
"_port",
"=",... | [
49,
4
] | [
56,
26
] | python | en | ['en', 'en', 'en'] | True |
AquaLogicProcessor.start_listen | (self, event) | Start event-processing thread. | Start event-processing thread. | def start_listen(self, event):
"""Start event-processing thread."""
_LOGGER.debug("Event processing thread started")
self.start() | [
"def",
"start_listen",
"(",
"self",
",",
"event",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Event processing thread started\"",
")",
"self",
".",
"start",
"(",
")"
] | [
58,
4
] | [
61,
20
] | python | en | ['en', 'en', 'en'] | True |
AquaLogicProcessor.shutdown | (self, event) | Signal shutdown of processing event. | Signal shutdown of processing event. | def shutdown(self, event):
"""Signal shutdown of processing event."""
_LOGGER.debug("Event processing signaled exit")
self._shutdown = True | [
"def",
"shutdown",
"(",
"self",
",",
"event",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Event processing signaled exit\"",
")",
"self",
".",
"_shutdown",
"=",
"True"
] | [
63,
4
] | [
66,
29
] | python | en | ['en', 'en', 'en'] | True |
AquaLogicProcessor.data_changed | (self, panel) | Aqualogic data changed callback. | Aqualogic data changed callback. | def data_changed(self, panel):
"""Aqualogic data changed callback."""
self._hass.helpers.dispatcher.dispatcher_send(UPDATE_TOPIC) | [
"def",
"data_changed",
"(",
"self",
",",
"panel",
")",
":",
"self",
".",
"_hass",
".",
"helpers",
".",
"dispatcher",
".",
"dispatcher_send",
"(",
"UPDATE_TOPIC",
")"
] | [
68,
4
] | [
70,
67
] | python | en | ['en', 'zu', 'en'] | True |
AquaLogicProcessor.run | (self) | Event thread. | Event thread. | def run(self):
"""Event thread."""
while True:
self._panel = AquaLogic()
self._panel.connect(self._host, self._port)
self._panel.process(self.data_changed)
if self._shutdown:
return
_LOGGER.error("Connection to %s:%d lost", s... | [
"def",
"run",
"(",
"self",
")",
":",
"while",
"True",
":",
"self",
".",
"_panel",
"=",
"AquaLogic",
"(",
")",
"self",
".",
"_panel",
".",
"connect",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
")",
"self",
".",
"_panel",
".",
"process",
... | [
72,
4
] | [
84,
50
] | python | en | ['en', 'ja', 'en'] | False |
AquaLogicProcessor.panel | (self) | Retrieve the AquaLogic object. | Retrieve the AquaLogic object. | def panel(self):
"""Retrieve the AquaLogic object."""
return self._panel | [
"def",
"panel",
"(",
"self",
")",
":",
"return",
"self",
".",
"_panel"
] | [
87,
4
] | [
89,
26
] | python | en | ['en', 'haw', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Wink climate devices. | Set up the Wink climate devices. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Wink climate devices."""
for climate in pywink.get_thermostats():
_id = climate.object_id() + climate.name()
if _id not in hass.data[DOMAIN]["unique_ids"]:
add_entities([WinkThermostat(climate, hass)])... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"for",
"climate",
"in",
"pywink",
".",
"get_thermostats",
"(",
")",
":",
"_id",
"=",
"climate",
".",
"object_id",
"(",
")",
"+",
"clim... | [
70,
0
] | [
79,
49
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.supported_features | (self) | Return the list of supported features. | Return the list of supported features. | def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS_THERMOSTAT | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_FLAGS_THERMOSTAT"
] | [
86,
4
] | [
88,
39
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self.hass.data[DOMAIN]["entities"]["climate"].append(self) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"entities\"",
"]",
"[",
"\"climate\"",
"]",
".",
"append",
"(",
"self",
")"
] | [
90,
4
] | [
92,
66
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self):
"""Return the unit of measurement."""
# The Wink API always returns temp in Celsius
return TEMP_CELSIUS | [
"def",
"temperature_unit",
"(",
"self",
")",
":",
"# The Wink API always returns temp in Celsius",
"return",
"TEMP_CELSIUS"
] | [
95,
4
] | [
98,
27
] | python | en | ['en', 'la', 'en'] | True |
WinkThermostat.device_state_attributes | (self) | Return the optional device state attributes. | Return the optional device state attributes. | def device_state_attributes(self):
"""Return the optional device state attributes."""
data = {}
if self.external_temperature is not None:
data[ATTR_EXTERNAL_TEMPERATURE] = show_temp(
self.hass,
self.external_temperature,
self.temperatur... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"if",
"self",
".",
"external_temperature",
"is",
"not",
"None",
":",
"data",
"[",
"ATTR_EXTERNAL_TEMPERATURE",
"]",
"=",
"show_temp",
"(",
"self",
".",
"hass",
",",
"self",
"."... | [
101,
4
] | [
121,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self):
"""Return the current temperature."""
return self.wink.current_temperature() | [
"def",
"current_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"current_temperature",
"(",
")"
] | [
124,
4
] | [
126,
46
] | python | en | ['en', 'la', 'en'] | True |
WinkThermostat.current_humidity | (self) | Return the current humidity. | Return the current humidity. | def current_humidity(self):
"""Return the current humidity."""
if self.wink.current_humidity() is not None:
# The API states humidity will be a float 0-1
# the only example API response with humidity listed show an int
# This will address both possibilities
... | [
"def",
"current_humidity",
"(",
"self",
")",
":",
"if",
"self",
".",
"wink",
".",
"current_humidity",
"(",
")",
"is",
"not",
"None",
":",
"# The API states humidity will be a float 0-1",
"# the only example API response with humidity listed show an int",
"# This will address ... | [
129,
4
] | [
138,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.external_temperature | (self) | Return the current external temperature. | Return the current external temperature. | def external_temperature(self):
"""Return the current external temperature."""
return self.wink.current_external_temperature() | [
"def",
"external_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"current_external_temperature",
"(",
")"
] | [
141,
4
] | [
143,
55
] | python | en | ['en', 'ca', 'en'] | True |
WinkThermostat.smart_temperature | (self) | Return the current average temp of all remote sensor. | Return the current average temp of all remote sensor. | def smart_temperature(self):
"""Return the current average temp of all remote sensor."""
return self.wink.current_smart_temperature() | [
"def",
"smart_temperature",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"current_smart_temperature",
"(",
")"
] | [
146,
4
] | [
148,
52
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.eco_target | (self) | Return status of eco target (Is the thermostat in eco mode). | Return status of eco target (Is the thermostat in eco mode). | def eco_target(self):
"""Return status of eco target (Is the thermostat in eco mode)."""
return self.wink.eco_target() | [
"def",
"eco_target",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"eco_target",
"(",
")"
] | [
151,
4
] | [
153,
37
] | python | en | ['en', 'en', 'en'] | True |
WinkThermostat.occupied | (self) | Return status of if the thermostat has detected occupancy. | Return status of if the thermostat has detected occupancy. | def occupied(self):
"""Return status of if the thermostat has detected occupancy."""
return self.wink.occupied() | [
"def",
"occupied",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"occupied",
"(",
")"
] | [
156,
4
] | [
158,
35
] | 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.