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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
make_random | () | Make a list of 10 random integers between 1 and 100. | Make a list of 10 random integers between 1 and 100. | def make_random():
""" Make a list of 10 random integers between 1 and 100. """
numlis = []
for i in range(0,10):
numlis.append(random.randint(1,100))
return numlis | [
"def",
"make_random",
"(",
")",
":",
"numlis",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"10",
")",
":",
"numlis",
".",
"append",
"(",
"random",
".",
"randint",
"(",
"1",
",",
"100",
")",
")",
"return",
"numlis"
] | [
31,
0
] | [
36,
17
] | python | en | ['en', 'ca', 'en'] | True |
call_make_random | () | Uses make_random to get a list of random numbers | Uses make_random to get a list of random numbers | def call_make_random():
""" Uses make_random to get a list of random numbers """
random_integers = make_random()
print("The list of random numbers is",random_integers) | [
"def",
"call_make_random",
"(",
")",
":",
"random_integers",
"=",
"make_random",
"(",
")",
"print",
"(",
"\"The list of random numbers is\"",
",",
"random_integers",
")"
] | [
38,
0
] | [
41,
58
] | python | en | ['en', 'haw', 'en'] | True |
make_same_random | () | Make a list of 10 random integers that are the same each time | Make a list of 10 random integers that are the same each time | def make_same_random():
""" Make a list of 10 random integers that are the same each time """
numlis = []
random.seed(17) # set the seed from which random numbers are made
for i in range(0,10):
numlis.append(random.randint(1,100))
return numlis | [
"def",
"make_same_random",
"(",
")",
":",
"numlis",
"=",
"[",
"]",
"random",
".",
"seed",
"(",
"17",
")",
"# set the seed from which random numbers are made",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"10",
")",
":",
"numlis",
".",
"append",
"(",
"random",... | [
57,
0
] | [
63,
17
] | python | en | ['en', 'en', 'en'] | True |
call_make_random | () | Uses make_same_random to get a list of random numbers | Uses make_same_random to get a list of random numbers | def call_make_random():
""" Uses make_same_random to get a list of random numbers """
random_integers = make_same_random()
print(random_integers)
random_integers1 = make_same_random()
print(random_integers1) | [
"def",
"call_make_random",
"(",
")",
":",
"random_integers",
"=",
"make_same_random",
"(",
")",
"print",
"(",
"random_integers",
")",
"random_integers1",
"=",
"make_same_random",
"(",
")",
"print",
"(",
"random_integers1",
")"
] | [
65,
0
] | [
70,
27
] | python | en | ['en', 'haw', 'en'] | True |
temp_stat | (temps) | prints the average, median, std dev, and variance of temps | prints the average, median, std dev, and variance of temps | def temp_stat(temps):
""" prints the average, median, std dev, and variance of temps """
pass | [
"def",
"temp_stat",
"(",
"temps",
")",
":",
"pass"
] | [
383,
0
] | [
385,
8
] | python | en | ['en', 'en', 'en'] | True |
temp_stat | (temps) | computes the average, median, std dev, and variance of temps | computes the average, median, std dev, and variance of temps | def temp_stat(temps):
""" computes the average, median, std dev, and variance of temps """
pass | [
"def",
"temp_stat",
"(",
"temps",
")",
":",
"pass"
] | [
427,
0
] | [
429,
8
] | python | en | ['en', 'en', 'en'] | True |
menu_choice | () | Find out what the user wants to do next. | Find out what the user wants to do next. | def menu_choice():
""" Find out what the user wants to do next. """
print("Choose one of the following options?")
print(" s) Show")
print(" n) New")
print(" d) Delete")
print(" e) Edit")
print(" q) Quit")
choice = input("Choice: ")
if choice.lower() in ['n','d', 's','e'... | [
"def",
"menu_choice",
"(",
")",
":",
"print",
"(",
"\"Choose one of the following options?\"",
")",
"print",
"(",
"\" s) Show\"",
")",
"print",
"(",
"\" n) New\"",
")",
"print",
"(",
"\" d) Delete\"",
")",
"print",
"(",
"\" e) Edit\"",
")",
"print",
"(",
... | [
568,
0
] | [
581,
19
] | python | en | ['en', 'en', 'en'] | True |
menu_choice | () | Find out what the user wants to do next. | Find out what the user wants to do next. | def menu_choice():
""" Find out what the user wants to do next. """
print("Choose one of the following options?")
print(" s) Show")
print(" n) New")
print(" d) Delete")
print(" e) Edit")
print(" q) Quit")
choice = input("Choice: ")
if choice.lower() in ['n','d', 's','e'... | [
"def",
"menu_choice",
"(",
")",
":",
"print",
"(",
"\"Choose one of the following options?\"",
")",
"print",
"(",
"\" s) Show\"",
")",
"print",
"(",
"\" n) New\"",
")",
"print",
"(",
"\" d) Delete\"",
")",
"print",
"(",
"\" e) Edit\"",
")",
"print",
"(",
... | [
654,
0
] | [
667,
19
] | python | en | ['en', 'en', 'en'] | True |
menu_choice | () | Find out what the user wants to do next. | Find out what the user wants to do next. | def menu_choice():
""" Find out what the user wants to do next. """
print("Choose one of the following options?")
print(" s) Show")
print(" n) New")
print(" d) Delete")
print(" e) Edit")
print(" q) Quit")
choice = input("Choice: ")
if choice.lower() in ['n','d', 's','e'... | [
"def",
"menu_choice",
"(",
")",
":",
"print",
"(",
"\"Choose one of the following options?\"",
")",
"print",
"(",
"\" s) Show\"",
")",
"print",
"(",
"\" n) New\"",
")",
"print",
"(",
"\" d) Delete\"",
")",
"print",
"(",
"\" e) Edit\"",
")",
"print",
"(",
... | [
758,
0
] | [
771,
19
] | python | en | ['en', 'en', 'en'] | True |
menu_choice | () | Find out what the user wants to do next. | Find out what the user wants to do next. | def menu_choice():
""" Find out what the user wants to do next. """
print("Choose one of the following options?")
print(" s) Show")
print(" n) New")
print(" d) Delete")
print(" e) Edit")
print(" q) Quit")
choice = input("Choice: ")
if choice.lower() in ['n','d', 's','e'... | [
"def",
"menu_choice",
"(",
")",
":",
"print",
"(",
"\"Choose one of the following options?\"",
")",
"print",
"(",
"\" s) Show\"",
")",
"print",
"(",
"\" n) New\"",
")",
"print",
"(",
"\" d) Delete\"",
")",
"print",
"(",
"\" e) Edit\"",
")",
"print",
"(",
... | [
882,
0
] | [
895,
19
] | python | en | ['en', 'en', 'en'] | True |
menu_choice | () | Find out what the user wants to do next. | Find out what the user wants to do next. | def menu_choice():
""" Find out what the user wants to do next. """
print("Choose one of the following options?")
print(" s) Show")
print(" n) New")
print(" d) Delete")
print(" e) Edit")
print(" q) Quit")
choice = input("Choice: ")
if choice.lower() in ['n','d', 's','e'... | [
"def",
"menu_choice",
"(",
")",
":",
"print",
"(",
"\"Choose one of the following options?\"",
")",
"print",
"(",
"\" s) Show\"",
")",
"print",
"(",
"\" n) New\"",
")",
"print",
"(",
"\" d) Delete\"",
")",
"print",
"(",
"\" e) Edit\"",
")",
"print",
"(",
... | [
1014,
0
] | [
1027,
19
] | python | en | ['en', 'en', 'en'] | True |
menu_choice | () | Find out what the user wants to do next. | Find out what the user wants to do next. | def menu_choice():
""" Find out what the user wants to do next. """
print("Choose one of the following options?")
print(" s) Show")
print(" n) New")
print(" d) Delete")
print(" e) Edit")
print(" q) Quit")
choice = input("Choice: ")
if choice.lower() in ['n','d', 's','e'... | [
"def",
"menu_choice",
"(",
")",
":",
"print",
"(",
"\"Choose one of the following options?\"",
")",
"print",
"(",
"\" s) Show\"",
")",
"print",
"(",
"\" n) New\"",
")",
"print",
"(",
"\" d) Delete\"",
")",
"print",
"(",
"\" e) Edit\"",
")",
"print",
"(",
... | [
1156,
0
] | [
1170,
19
] | python | en | ['en', 'en', 'en'] | True |
host_valid | (host) | Return True if hostname or IP address is valid. | Return True if hostname or IP address is valid. | def host_valid(host):
"""Return True if hostname or IP address is valid."""
try:
if ipaddress.ip_address(host).version == (4 or 6):
return True
except ValueError:
disallowed = re.compile(r"[^a-zA-Z\d\-]")
return all(x and not disallowed.search(x) for x in host.split(".")) | [
"def",
"host_valid",
"(",
"host",
")",
":",
"try",
":",
"if",
"ipaddress",
".",
"ip_address",
"(",
"host",
")",
".",
"version",
"==",
"(",
"4",
"or",
"6",
")",
":",
"return",
"True",
"except",
"ValueError",
":",
"disallowed",
"=",
"re",
".",
"compile... | [
20,
0
] | [
27,
75
] | python | en | ['en', 'af', 'en'] | True |
BrotherConfigFlow.__init__ | (self) | Initialize. | Initialize. | def __init__(self):
"""Initialize."""
self.brother = None
self.host = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"brother",
"=",
"None",
"self",
".",
"host",
"=",
"None"
] | [
36,
4
] | [
39,
24
] | python | en | ['en', 'en', 'it'] | False |
BrotherConfigFlow.async_step_user | (self, user_input=None) | Handle the initial step. | Handle the initial step. | async def async_step_user(self, user_input=None):
"""Handle the initial step."""
errors = {}
if user_input is not None:
try:
if not host_valid(user_input[CONF_HOST]):
raise InvalidHost()
brother = Brother(user_input[CONF_HOST])
... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"try",
":",
"if",
"not",
"host_valid",
"(",
"user_input",
"[",
"CONF_HOST",
"]",
")",
":",
... | [
41,
4
] | [
70,
9
] | python | en | ['en', 'en', 'en'] | True |
BrotherConfigFlow.async_step_zeroconf | (self, discovery_info) | Handle zeroconf discovery. | Handle zeroconf discovery. | async def async_step_zeroconf(self, discovery_info):
"""Handle zeroconf discovery."""
if discovery_info is None:
return self.async_abort(reason="cannot_connect")
if not discovery_info.get("name") or not discovery_info["name"].startswith(
"Brother"
):
... | [
"async",
"def",
"async_step_zeroconf",
"(",
"self",
",",
"discovery_info",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"self",
".",
"async_abort",
"(",
"reason",
"=",
"\"cannot_connect\"",
")",
"if",
"not",
"discovery_info",
".",
"get",
"(",... | [
72,
4
] | [
104,
55
] | python | de | ['de', 'sr', 'en'] | False |
BrotherConfigFlow.async_step_zeroconf_confirm | (self, user_input=None) | Handle a flow initiated by zeroconf. | Handle a flow initiated by zeroconf. | async def async_step_zeroconf_confirm(self, user_input=None):
"""Handle a flow initiated by zeroconf."""
if user_input is not None:
title = f"{self.brother.model} {self.brother.serial}"
# pylint: disable=no-member # https://github.com/PyCQA/pylint/issues/3167
return s... | [
"async",
"def",
"async_step_zeroconf_confirm",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"title",
"=",
"f\"{self.brother.model} {self.brother.serial}\"",
"# pylint: disable=no-member # https://github.com/PyCQA/pylint/... | [
106,
4
] | [
124,
9
] | python | en | ['en', 'en', 'en'] | True |
test_setup_full | (hass) | Test valid configuration. | Test valid configuration. | async def test_setup_full(hass):
"""Test valid configuration."""
await async_setup_component(
hass,
"homematic",
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
)
with assert_setup_component(1) as handle_config:
assert await async_setup_component(
h... | [
"async",
"def",
"test_setup_full",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"homematic\"",
",",
"{",
"\"homematic\"",
":",
"{",
"\"hosts\"",
":",
"{",
"\"ccu2\"",
":",
"{",
"\"host\"",
":",
"\"127.0.0.1\"",
"}",
"}",
"}",
... | [
8,
0
] | [
31,
44
] | python | en | ['nl', 'et', 'en'] | False |
test_setup_without_optional | (hass) | Test valid configuration without optional. | Test valid configuration without optional. | async def test_setup_without_optional(hass):
"""Test valid configuration without optional."""
await async_setup_component(
hass,
"homematic",
{"homematic": {"hosts": {"ccu2": {"host": "127.0.0.1"}}}},
)
with assert_setup_component(1) as handle_config:
assert await async_s... | [
"async",
"def",
"test_setup_without_optional",
"(",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"homematic\"",
",",
"{",
"\"homematic\"",
":",
"{",
"\"hosts\"",
":",
"{",
"\"ccu2\"",
":",
"{",
"\"host\"",
":",
"\"127.0.0.1\"",
"}",
... | [
34,
0
] | [
56,
44
] | python | en | ['en', 'en', 'en'] | True |
test_bad_config | (hass) | Test invalid configuration. | Test invalid configuration. | async def test_bad_config(hass):
"""Test invalid configuration."""
config = {notify_comp.DOMAIN: {"name": "test", "platform": "homematic"}}
with assert_setup_component(0) as handle_config:
assert await async_setup_component(hass, notify_comp.DOMAIN, config)
assert not handle_config[notify_comp.D... | [
"async",
"def",
"test_bad_config",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"notify_comp",
".",
"DOMAIN",
":",
"{",
"\"name\"",
":",
"\"test\"",
",",
"\"platform\"",
":",
"\"homematic\"",
"}",
"}",
"with",
"assert_setup_component",
"(",
"0",
")",
"as",
"... | [
59,
0
] | [
64,
48
] | python | en | ['en', 'et', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the WorldTidesInfo sensor. | Set up the WorldTidesInfo sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the WorldTidesInfo sensor."""
name = config.get(CONF_NAME)
lat = config.get(CONF_LATITUDE, hass.config.latitude)
lon = config.get(CONF_LONGITUDE, hass.config.longitude)
key = config.get(CONF_API_KEY)
if None in (lat... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"lat",
"=",
"config",
".",
"get",
"(",
"CONF_LATITUDE",
",",
"hass",
".",
... | [
37,
0
] | [
54,
25
] | python | en | ['en', 'da', 'en'] | True |
WorldTidesInfoSensor.__init__ | (self, name, lat, lon, key) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, lat, lon, key):
"""Initialize the sensor."""
self._name = name
self._lat = lat
self._lon = lon
self._key = key
self.data = None | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"lat",
",",
"lon",
",",
"key",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_lat",
"=",
"lat",
"self",
".",
"_lon",
"=",
"lon",
"self",
".",
"_key",
"=",
"key",
"self",
".",
"data"... | [
60,
4
] | [
66,
24
] | python | en | ['en', 'en', 'en'] | True |
WorldTidesInfoSensor.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"
] | [
69,
4
] | [
71,
25
] | python | en | ['en', 'mi', 'en'] | True |
WorldTidesInfoSensor.device_state_attributes | (self) | Return the state attributes of this device. | Return the state attributes of this device. | def device_state_attributes(self):
"""Return the state attributes of this device."""
attr = {ATTR_ATTRIBUTION: ATTRIBUTION}
if "High" in str(self.data["extremes"][0]["type"]):
attr["high_tide_time_utc"] = self.data["extremes"][0]["date"]
attr["high_tide_height"] = self.d... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attr",
"=",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
"}",
"if",
"\"High\"",
"in",
"str",
"(",
"self",
".",
"data",
"[",
"\"extremes\"",
"]",
"[",
"0",
"]",
"[",
"\"type\"",
"]",
")",
":",
"a... | [
74,
4
] | [
88,
19
] | python | en | ['en', 'en', 'en'] | True |
WorldTidesInfoSensor.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
if self.data:
if "High" in str(self.data["extremes"][0]["type"]):
tidetime = time.strftime(
"%I:%M %p", time.localtime(self.data["extremes"][0]["dt"])
)
return f"High ti... | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"self",
".",
"data",
":",
"if",
"\"High\"",
"in",
"str",
"(",
"self",
".",
"data",
"[",
"\"extremes\"",
"]",
"[",
"0",
"]",
"[",
"\"type\"",
"]",
")",
":",
"tidetime",
"=",
"time",
".",
"strftime",
"("... | [
91,
4
] | [
105,
19
] | python | en | ['en', 'en', 'en'] | True |
WorldTidesInfoSensor.update | (self) | Get the latest data from WorldTidesInfo API. | Get the latest data from WorldTidesInfo API. | def update(self):
"""Get the latest data from WorldTidesInfo API."""
start = int(time.time())
resource = (
"https://www.worldtides.info/api?extremes&length=86400"
"&key={}&lat={}&lon={}&start={}"
).format(self._key, self._lat, self._lon, start)
try:
... | [
"def",
"update",
"(",
"self",
")",
":",
"start",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"resource",
"=",
"(",
"\"https://www.worldtides.info/api?extremes&length=86400\"",
"\"&key={}&lat={}&lon={}&start={}\"",
")",
".",
"format",
"(",
"self",
".",
"... | [
107,
4
] | [
121,
28
] | python | en | ['en', 'en', 'en'] | True |
async_remove_automations | (hass, device_id) | Remove automations for a Tasmota device. | Remove automations for a Tasmota device. | async def async_remove_automations(hass, device_id):
"""Remove automations for a Tasmota device."""
await device_trigger.async_remove_triggers(hass, device_id) | [
"async",
"def",
"async_remove_automations",
"(",
"hass",
",",
"device_id",
")",
":",
"await",
"device_trigger",
".",
"async_remove_triggers",
"(",
"hass",
",",
"device_id",
")"
] | [
12,
0
] | [
14,
63
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry) | Set up Tasmota device automation dynamically through discovery. | Set up Tasmota device automation dynamically through discovery. | async def async_setup_entry(hass, config_entry):
"""Set up Tasmota device automation dynamically through discovery."""
async def async_device_removed(event):
"""Handle the removal of a device."""
if event.data["action"] != "remove":
return
await async_remove_automations(hass... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"async",
"def",
"async_device_removed",
"(",
"event",
")",
":",
"\"\"\"Handle the removal of a device.\"\"\"",
"if",
"event",
".",
"data",
"[",
"\"action\"",
"]",
"!=",
"\"remove\"",
... | [
17,
0
] | [
42,
5
] | python | en | ['en', 'en', 'en'] | True |
test_default_supported_features | (hass, mqtt_mock) | Test that the correct supported features. | Test that the correct supported features. | async def test_default_supported_features(hass, mqtt_mock):
"""Test that the correct supported features."""
assert await async_setup_component(
hass, vacuum.DOMAIN, {vacuum.DOMAIN: DEFAULT_CONFIG}
)
await hass.async_block_till_done()
entity = hass.states.get("vacuum.mqtttest")
entity_fea... | [
"async",
"def",
"test_default_supported_features",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"vacuum",
".",
"DOMAIN",
",",
"{",
"vacuum",
".",
"DOMAIN",
":",
"DEFAULT_CONFIG",
"}",
")",
"await",
"has... | [
76,
0
] | [
94,
5
] | python | en | ['en', 'en', 'en'] | True |
test_all_commands | (hass, mqtt_mock) | Test simple commands to the vacuum. | Test simple commands to the vacuum. | async def test_all_commands(hass, mqtt_mock):
"""Test simple commands to the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAI... | [
"async",
"def",
"test_all_commands",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SERVICE_TO... | [
97,
0
] | [
173,
5
] | python | en | ['en', 'en', 'en'] | True |
test_commands_without_supported_features | (hass, mqtt_mock) | Test commands which are not supported by the vacuum. | Test commands which are not supported by the vacuum. | async def test_commands_without_supported_features(hass, mqtt_mock):
"""Test commands which are not supported by the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
services = mqttvacuum.STRING_TO_SERVICE["status"]
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
services, SERVICE_... | [
"async",
"def",
"test_commands_without_supported_features",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"services",
"=",
"mqttvacuum",
".",
"STRING_TO_SERVICE",
"[",
"\"status\"",
"]",
"config",
"[",
"mqttvacuum",
... | [
176,
0
] | [
221,
40
] | python | en | ['en', 'en', 'en'] | True |
test_attributes_without_supported_features | (hass, mqtt_mock) | Test attributes which are not supported by the vacuum. | Test attributes which are not supported by the vacuum. | async def test_attributes_without_supported_features(hass, mqtt_mock):
"""Test attributes which are not supported by the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
services = mqttvacuum.STRING_TO_SERVICE["turn_on"]
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
services, SER... | [
"async",
"def",
"test_attributes_without_supported_features",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"services",
"=",
"mqttvacuum",
".",
"STRING_TO_SERVICE",
"[",
"\"turn_on\"",
"]",
"config",
"[",
"mqttvacuum... | [
224,
0
] | [
248,
60
] | python | en | ['en', 'en', 'en'] | True |
test_status | (hass, mqtt_mock) | Test status updates from the vacuum. | Test status updates from the vacuum. | async def test_status(hass, mqtt_mock):
"""Test status updates from the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: co... | [
"async",
"def",
"test_status",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SERVICE_TO_STRIN... | [
251,
0
] | [
288,
56
] | python | en | ['en', 'la', 'en'] | True |
test_status_battery | (hass, mqtt_mock) | Test status updates from the vacuum. | Test status updates from the vacuum. | async def test_status_battery(hass, mqtt_mock):
"""Test status updates from the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DO... | [
"async",
"def",
"test_status_battery",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SERVICE_... | [
291,
0
] | [
306,
70
] | python | en | ['en', 'la', 'en'] | True |
test_status_cleaning | (hass, mqtt_mock) | Test status updates from the vacuum. | Test status updates from the vacuum. | async def test_status_cleaning(hass, mqtt_mock):
"""Test status updates from the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.D... | [
"async",
"def",
"test_status_cleaning",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SERVICE... | [
309,
0
] | [
324,
34
] | python | en | ['en', 'la', 'en'] | True |
test_status_docked | (hass, mqtt_mock) | Test status updates from the vacuum. | Test status updates from the vacuum. | async def test_status_docked(hass, mqtt_mock):
"""Test status updates from the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOM... | [
"async",
"def",
"test_status_docked",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SERVICE_T... | [
327,
0
] | [
342,
35
] | python | en | ['en', 'la', 'en'] | True |
test_status_charging | (hass, mqtt_mock) | Test status updates from the vacuum. | Test status updates from the vacuum. | async def test_status_charging(hass, mqtt_mock):
"""Test status updates from the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.D... | [
"async",
"def",
"test_status_charging",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SERVICE... | [
345,
0
] | [
360,
75
] | python | en | ['en', 'la', 'en'] | True |
test_status_fan_speed | (hass, mqtt_mock) | Test status updates from the vacuum. | Test status updates from the vacuum. | async def test_status_fan_speed(hass, mqtt_mock):
"""Test status updates from the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.... | [
"async",
"def",
"test_status_fan_speed",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SERVIC... | [
363,
0
] | [
378,
56
] | python | en | ['en', 'la', 'en'] | True |
test_status_fan_speed_list | (hass, mqtt_mock) | Test status updates from the vacuum. | Test status updates from the vacuum. | async def test_status_fan_speed_list(hass, mqtt_mock):
"""Test status updates from the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {va... | [
"async",
"def",
"test_status_fan_speed_list",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"S... | [
381,
0
] | [
392,
88
] | python | en | ['en', 'la', 'en'] | True |
test_status_no_fan_speed_list | (hass, mqtt_mock) | Test status updates from the vacuum.
If the vacuum doesn't support fan speed, fan speed list should be None.
| Test status updates from the vacuum. | async def test_status_no_fan_speed_list(hass, mqtt_mock):
"""Test status updates from the vacuum.
If the vacuum doesn't support fan speed, fan speed list should be None.
"""
config = deepcopy(DEFAULT_CONFIG)
services = ALL_SERVICES - mqttvacuum.SUPPORT_FAN_SPEED
config[mqttvacuum.CONF_SUPPORTED... | [
"async",
"def",
"test_status_no_fan_speed_list",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"services",
"=",
"ALL_SERVICES",
"-",
"mqttvacuum",
".",
"SUPPORT_FAN_SPEED",
"config",
"[",
"mqttvacuum",
".",
"CONF_S... | [
395,
0
] | [
410,
60
] | python | en | ['en', 'la', 'en'] | True |
test_status_error | (hass, mqtt_mock) | Test status updates from the vacuum. | Test status updates from the vacuum. | async def test_status_error(hass, mqtt_mock):
"""Test status updates from the vacuum."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMA... | [
"async",
"def",
"test_status_error",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SERVICE_TO... | [
413,
0
] | [
435,
57
] | python | en | ['en', 'la', 'en'] | True |
test_battery_template | (hass, mqtt_mock) | Test that you can use non-default templates for battery_level. | Test that you can use non-default templates for battery_level. | async def test_battery_template(hass, mqtt_mock):
"""Test that you can use non-default templates for battery_level."""
config = deepcopy(DEFAULT_CONFIG)
config.update(
{
mqttvacuum.CONF_SUPPORTED_FEATURES: services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)... | [
"async",
"def",
"test_battery_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
".",
"update",
"(",
"{",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
":",
"services_to_strings",
"(",
"ALL_SERVICES... | [
438,
0
] | [
457,
70
] | python | en | ['en', 'en', 'en'] | True |
test_status_invalid_json | (hass, mqtt_mock) | Test to make sure nothing breaks if the vacuum sends bad JSON. | Test to make sure nothing breaks if the vacuum sends bad JSON. | async def test_status_invalid_json(hass, mqtt_mock):
"""Test to make sure nothing breaks if the vacuum sends bad JSON."""
config = deepcopy(DEFAULT_CONFIG)
config[mqttvacuum.CONF_SUPPORTED_FEATURES] = services_to_strings(
ALL_SERVICES, SERVICE_TO_STRING
)
assert await async_setup_component(... | [
"async",
"def",
"test_status_invalid_json",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
"[",
"mqttvacuum",
".",
"CONF_SUPPORTED_FEATURES",
"]",
"=",
"services_to_strings",
"(",
"ALL_SERVICES",
",",
"SER... | [
460,
0
] | [
473,
57
] | python | en | ['en', 'en', 'en'] | True |
test_missing_battery_template | (hass, mqtt_mock) | Test to make sure missing template is not allowed. | Test to make sure missing template is not allowed. | async def test_missing_battery_template(hass, mqtt_mock):
"""Test to make sure missing template is not allowed."""
config = deepcopy(DEFAULT_CONFIG)
config.pop(mqttvacuum.CONF_BATTERY_LEVEL_TEMPLATE)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: config})
await hass.async_b... | [
"async",
"def",
"test_missing_battery_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
".",
"pop",
"(",
"mqttvacuum",
".",
"CONF_BATTERY_LEVEL_TEMPLATE",
")",
"assert",
"await",
"async_setup_compone... | [
476,
0
] | [
485,
24
] | python | en | ['en', 'en', 'en'] | True |
test_missing_charging_template | (hass, mqtt_mock) | Test to make sure missing template is not allowed. | Test to make sure missing template is not allowed. | async def test_missing_charging_template(hass, mqtt_mock):
"""Test to make sure missing template is not allowed."""
config = deepcopy(DEFAULT_CONFIG)
config.pop(mqttvacuum.CONF_CHARGING_TEMPLATE)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: config})
await hass.async_block... | [
"async",
"def",
"test_missing_charging_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
".",
"pop",
"(",
"mqttvacuum",
".",
"CONF_CHARGING_TEMPLATE",
")",
"assert",
"await",
"async_setup_component",... | [
488,
0
] | [
497,
24
] | python | en | ['en', 'en', 'en'] | True |
test_missing_cleaning_template | (hass, mqtt_mock) | Test to make sure missing template is not allowed. | Test to make sure missing template is not allowed. | async def test_missing_cleaning_template(hass, mqtt_mock):
"""Test to make sure missing template is not allowed."""
config = deepcopy(DEFAULT_CONFIG)
config.pop(mqttvacuum.CONF_CLEANING_TEMPLATE)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: config})
await hass.async_block... | [
"async",
"def",
"test_missing_cleaning_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
".",
"pop",
"(",
"mqttvacuum",
".",
"CONF_CLEANING_TEMPLATE",
")",
"assert",
"await",
"async_setup_component",... | [
500,
0
] | [
509,
24
] | python | en | ['en', 'en', 'en'] | True |
test_missing_docked_template | (hass, mqtt_mock) | Test to make sure missing template is not allowed. | Test to make sure missing template is not allowed. | async def test_missing_docked_template(hass, mqtt_mock):
"""Test to make sure missing template is not allowed."""
config = deepcopy(DEFAULT_CONFIG)
config.pop(mqttvacuum.CONF_DOCKED_TEMPLATE)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: config})
await hass.async_block_til... | [
"async",
"def",
"test_missing_docked_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
".",
"pop",
"(",
"mqttvacuum",
".",
"CONF_DOCKED_TEMPLATE",
")",
"assert",
"await",
"async_setup_component",
"... | [
512,
0
] | [
521,
24
] | python | en | ['en', 'en', 'en'] | True |
test_missing_error_template | (hass, mqtt_mock) | Test to make sure missing template is not allowed. | Test to make sure missing template is not allowed. | async def test_missing_error_template(hass, mqtt_mock):
"""Test to make sure missing template is not allowed."""
config = deepcopy(DEFAULT_CONFIG)
config.pop(mqttvacuum.CONF_ERROR_TEMPLATE)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: config})
await hass.async_block_till_... | [
"async",
"def",
"test_missing_error_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
".",
"pop",
"(",
"mqttvacuum",
".",
"CONF_ERROR_TEMPLATE",
")",
"assert",
"await",
"async_setup_component",
"("... | [
524,
0
] | [
533,
24
] | python | en | ['en', 'en', 'en'] | True |
test_missing_fan_speed_template | (hass, mqtt_mock) | Test to make sure missing template is not allowed. | Test to make sure missing template is not allowed. | async def test_missing_fan_speed_template(hass, mqtt_mock):
"""Test to make sure missing template is not allowed."""
config = deepcopy(DEFAULT_CONFIG)
config.pop(mqttvacuum.CONF_FAN_SPEED_TEMPLATE)
assert await async_setup_component(hass, vacuum.DOMAIN, {vacuum.DOMAIN: config})
await hass.async_blo... | [
"async",
"def",
"test_missing_fan_speed_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"deepcopy",
"(",
"DEFAULT_CONFIG",
")",
"config",
".",
"pop",
"(",
"mqttvacuum",
".",
"CONF_FAN_SPEED_TEMPLATE",
")",
"assert",
"await",
"async_setup_component... | [
536,
0
] | [
545,
24
] | 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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_when_connection_lost",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
548,
0
] | [
552,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_availability_without_topic",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
555,
0
] | [
559,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_default_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
562,
0
] | [
566,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_custom_availability_payload",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
569,
0
] | [
573,
5
] | 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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_via_mqtt_json_message",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
576,
0
] | [
580,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_setting_attribute_with_template",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
583,
0
] | [
587,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"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",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
... | [
590,
0
] | [
594,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"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",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
... | [
597,
0
] | [
601,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"await",
"help_test_discovery_update_attr",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
604,
0
] | [
608,
5
] | python | en | ['en', 'en', 'en'] | True |
test_unique_id | (hass, mqtt_mock) | Test unique id option only creates one vacuum per unique_id. | Test unique id option only creates one vacuum per unique_id. | async def test_unique_id(hass, mqtt_mock):
"""Test unique id option only creates one vacuum per unique_id."""
config = {
vacuum.DOMAIN: [
{
"platform": "mqtt",
"name": "Test 1",
"command_topic": "test_topic",
"unique_id": "TOTAL... | [
"async",
"def",
"test_unique_id",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"vacuum",
".",
"DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"Test 1\"",
",",
"\"command_topic\"",
":",
"\"test_topic\"",
",",
... | [
611,
0
] | [
629,
69
] | python | en | ['en', 'la', 'en'] | True |
test_discovery_removal_vacuum | (hass, mqtt_mock, caplog) | Test removal of discovered vacuum. | Test removal of discovered vacuum. | async def test_discovery_removal_vacuum(hass, mqtt_mock, caplog):
"""Test removal of discovered vacuum."""
data = json.dumps(DEFAULT_CONFIG_2[vacuum.DOMAIN])
await help_test_discovery_removal(hass, mqtt_mock, caplog, vacuum.DOMAIN, data) | [
"async",
"def",
"test_discovery_removal_vacuum",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
"DEFAULT_CONFIG_2",
"[",
"vacuum",
".",
"DOMAIN",
"]",
")",
"await",
"help_test_discovery_removal",
"(",
"hass",
",... | [
632,
0
] | [
635,
83
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_vacuum | (hass, mqtt_mock, caplog) | Test update of discovered vacuum. | Test update of discovered vacuum. | async def test_discovery_update_vacuum(hass, mqtt_mock, caplog):
"""Test update of discovered vacuum."""
data1 = '{ "name": "Beer",' ' "command_topic": "test_topic" }'
data2 = '{ "name": "Milk",' ' "command_topic": "test_topic" }'
await help_test_discovery_update(
hass, mqtt_mock, caplog, vacu... | [
"async",
"def",
"test_discovery_update_vacuum",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\",'",
"' \"command_topic\": \"test_topic\" }'",
"data2",
"=",
"'{ \"name\": \"Milk\",'",
"' \"command_topic\": \"test_topic\" }'",
"await... | [
638,
0
] | [
644,
5
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_update_unchanged_vacuum | (hass, mqtt_mock, caplog) | Test update of discovered vacuum. | Test update of discovered vacuum. | async def test_discovery_update_unchanged_vacuum(hass, mqtt_mock, caplog):
"""Test update of discovered vacuum."""
data1 = '{ "name": "Beer", "command_topic": "test_topic" }'
with patch(
"homeassistant.components.mqtt.vacuum.schema_legacy.MqttVacuum.discovery_update"
) as discovery_update:
... | [
"async",
"def",
"test_discovery_update_unchanged_vacuum",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\", \"command_topic\": \"test_topic\" }'",
"with",
"patch",
"(",
"\"homeassistant.components.mqtt.vacuum.schema_legacy.MqttVacuum.disc... | [
647,
0
] | [
655,
9
] | python | en | ['en', 'en', 'en'] | True |
test_discovery_broken | (hass, mqtt_mock, caplog) | Test handling of bad discovery message. | Test handling of bad discovery message. | async def test_discovery_broken(hass, mqtt_mock, caplog):
"""Test handling of bad discovery message."""
data1 = '{ "name": "Beer",' ' "command_topic": "test_topic#" }'
data2 = '{ "name": "Milk",' ' "command_topic": "test_topic" }'
await help_test_discovery_broken(
hass, mqtt_mock, caplog, vacu... | [
"async",
"def",
"test_discovery_broken",
"(",
"hass",
",",
"mqtt_mock",
",",
"caplog",
")",
":",
"data1",
"=",
"'{ \"name\": \"Beer\",'",
"' \"command_topic\": \"test_topic#\" }'",
"data2",
"=",
"'{ \"name\": \"Milk\",'",
"' \"command_topic\": \"test_topic\" }'",
"await",
"... | [
659,
0
] | [
665,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_device_info_with_connection | (hass, mqtt_mock) | Test MQTT vacuum device registry integration. | Test MQTT vacuum device registry integration. | async def test_entity_device_info_with_connection(hass, mqtt_mock):
"""Test MQTT vacuum device registry integration."""
await help_test_entity_device_info_with_connection(
hass, mqtt_mock, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_connection",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
668,
0
] | [
672,
5
] | python | en | ['en', 'sv', 'en'] | True |
test_entity_device_info_with_identifier | (hass, mqtt_mock) | Test MQTT vacuum device registry integration. | Test MQTT vacuum device registry integration. | async def test_entity_device_info_with_identifier(hass, mqtt_mock):
"""Test MQTT vacuum device registry integration."""
await help_test_entity_device_info_with_identifier(
hass, mqtt_mock, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_with_identifier",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
675,
0
] | [
679,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
682,
0
] | [
686,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_device_info_remove",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
689,
0
] | [
693,
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."""
config = {
vacuum.DOMAIN: {
"platform": "mqtt",
"name": "test",
"battery_level_topic": "test-topic",
"battery_level_templat... | [
"async",
"def",
"test_entity_id_update_subscriptions",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"vacuum",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"battery_level_topic\"",
":",
"\"test... | [
696,
0
] | [
710,
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, vacuum.DOMAIN, DEFAULT_CONFIG_2
) | [
"async",
"def",
"test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"await",
"help_test_entity_id_update_discovery_update",
"(",
"hass",
",",
"mqtt_mock",
",",
"vacuum",
".",
"DOMAIN",
",",
"DEFAULT_CONFIG_2",
")"
] | [
713,
0
] | [
717,
5
] | python | en | ['en', 'en', 'en'] | True |
test_entity_debug_info_message | (hass, mqtt_mock) | Test MQTT debug info. | Test MQTT debug info. | async def test_entity_debug_info_message(hass, mqtt_mock):
"""Test MQTT debug info."""
config = {
vacuum.DOMAIN: {
"platform": "mqtt",
"name": "test",
"battery_level_topic": "test-topic",
"battery_level_template": "{{ value_json.battery_level }}",
... | [
"async",
"def",
"test_entity_debug_info_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"config",
"=",
"{",
"vacuum",
".",
"DOMAIN",
":",
"{",
"\"platform\"",
":",
"\"mqtt\"",
",",
"\"name\"",
":",
"\"test\"",
",",
"\"battery_level_topic\"",
":",
"\"test-topi... | [
720,
0
] | [
734,
5
] | python | es | ['es', 'mt', 'it'] | False |
source_match | (state, source) | Check if the state matches the provided source. | Check if the state matches the provided source. | def source_match(state, source):
"""Check if the state matches the provided source."""
return state and state.attributes.get("source") == source | [
"def",
"source_match",
"(",
"state",
",",
"source",
")",
":",
"return",
"state",
"and",
"state",
".",
"attributes",
".",
"get",
"(",
"\"source\"",
")",
"==",
"source"
] | [
28,
0
] | [
30,
61
] | python | en | ['en', 'en', 'en'] | True |
async_attach_trigger | (hass, config, action, automation_info) | Listen for state changes based on configuration. | Listen for state changes based on configuration. | async def async_attach_trigger(hass, config, action, automation_info):
"""Listen for state changes based on configuration."""
source = config.get(CONF_SOURCE).lower()
zone_entity_id = config.get(CONF_ZONE)
trigger_event = config.get(CONF_EVENT)
job = HassJob(action)
@callback
def state_chan... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
",",
"config",
",",
"action",
",",
"automation_info",
")",
":",
"source",
"=",
"config",
".",
"get",
"(",
"CONF_SOURCE",
")",
".",
"lower",
"(",
")",
"zone_entity_id",
"=",
"config",
".",
"get",
"(",
"... | [
33,
0
] | [
80,
18
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
) | Set up the Minecraft Server binary sensor platform. | Set up the Minecraft Server binary sensor platform. | async def async_setup_entry(
hass: HomeAssistantType, config_entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the Minecraft Server binary sensor platform."""
server = hass.data[DOMAIN][config_entry.unique_id]
# Create entities list.
entities = [MinecraftServerStatusBinarySensor(server)]
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"server",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"unique_id... | [
13,
0
] | [
23,
38
] | python | en | ['en', 'pt', 'en'] | True |
MinecraftServerStatusBinarySensor.__init__ | (self, server: MinecraftServer) | Initialize status binary sensor. | Initialize status binary sensor. | def __init__(self, server: MinecraftServer) -> None:
"""Initialize status binary sensor."""
super().__init__(
server=server,
type_name=NAME_STATUS,
icon=ICON_STATUS,
device_class=DEVICE_CLASS_CONNECTIVITY,
)
self._is_on = False | [
"def",
"__init__",
"(",
"self",
",",
"server",
":",
"MinecraftServer",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"server",
"=",
"server",
",",
"type_name",
"=",
"NAME_STATUS",
",",
"icon",
"=",
"ICON_STATUS",
",",
"device_class",
"... | [
29,
4
] | [
37,
27
] | python | en | ['en', 'pl', 'en'] | True |
MinecraftServerStatusBinarySensor.is_on | (self) | Return binary state. | Return binary state. | def is_on(self) -> bool:
"""Return binary state."""
return self._is_on | [
"def",
"is_on",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_is_on"
] | [
40,
4
] | [
42,
26
] | python | en | ['en', 'ig', 'en'] | True |
MinecraftServerStatusBinarySensor.async_update | (self) | Update status. | Update status. | async def async_update(self) -> None:
"""Update status."""
self._is_on = self._server.online | [
"async",
"def",
"async_update",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_is_on",
"=",
"self",
".",
"_server",
".",
"online"
] | [
44,
4
] | [
46,
41
] | python | en | ['en', 'la', 'en'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up Z-Wave Sensor from Config Entry. | Set up Z-Wave Sensor from Config Entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up Z-Wave Sensor from Config Entry."""
@callback
def async_add_sensor(sensor):
"""Add Z-Wave Sensor."""
async_add_entities([sensor])
async_dispatcher_connect(hass, "zwave_new_sensor", async_add_sensor) | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"@",
"callback",
"def",
"async_add_sensor",
"(",
"sensor",
")",
":",
"\"\"\"Add Z-Wave Sensor.\"\"\"",
"async_add_entities",
"(",
"[",
"sensor",
"]",
")",
"... | [
9,
0
] | [
17,
72
] | python | en | ['en', 'da', 'en'] | True |
get_device | (node, values, **kwargs) | Create Z-Wave entity device. | Create Z-Wave entity device. | def get_device(node, values, **kwargs):
"""Create Z-Wave entity device."""
# Generic Device mappings
if values.primary.command_class == const.COMMAND_CLASS_BATTERY:
return ZWaveBatterySensor(values)
if node.has_command_class(const.COMMAND_CLASS_SENSOR_MULTILEVEL):
return ZWaveMultilevelS... | [
"def",
"get_device",
"(",
"node",
",",
"values",
",",
"*",
"*",
"kwargs",
")",
":",
"# Generic Device mappings",
"if",
"values",
".",
"primary",
".",
"command_class",
"==",
"const",
".",
"COMMAND_CLASS_BATTERY",
":",
"return",
"ZWaveBatterySensor",
"(",
"values"... | [
20,
0
] | [
36,
15
] | python | en | ['en', 'pl', 'en'] | True |
ZWaveSensor.__init__ | (self, values) | Initialize the sensor. | Initialize the sensor. | def __init__(self, values):
"""Initialize the sensor."""
ZWaveDeviceEntity.__init__(self, values, DOMAIN)
self.update_properties() | [
"def",
"__init__",
"(",
"self",
",",
"values",
")",
":",
"ZWaveDeviceEntity",
".",
"__init__",
"(",
"self",
",",
"values",
",",
"DOMAIN",
")",
"self",
".",
"update_properties",
"(",
")"
] | [
42,
4
] | [
45,
32
] | python | en | ['en', 'en', 'en'] | True |
ZWaveSensor.update_properties | (self) | Handle the data changes for node values. | Handle the data changes for node values. | def update_properties(self):
"""Handle the data changes for node values."""
self._state = self.values.primary.data
self._units = self.values.primary.units | [
"def",
"update_properties",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"self",
".",
"values",
".",
"primary",
".",
"data",
"self",
".",
"_units",
"=",
"self",
".",
"values",
".",
"primary",
".",
"units"
] | [
47,
4
] | [
50,
47
] | python | en | ['en', 'en', 'en'] | True |
ZWaveSensor.force_update | (self) | Return force_update. | Return force_update. | def force_update(self):
"""Return force_update."""
return True | [
"def",
"force_update",
"(",
"self",
")",
":",
"return",
"True"
] | [
53,
4
] | [
55,
19
] | python | en | ['en', 'co', 'en'] | False |
ZWaveSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
58,
4
] | [
60,
26
] | python | en | ['en', 'en', 'en'] | True |
ZWaveSensor.unit_of_measurement | (self) | Return the unit of measurement the value is expressed in. | Return the unit of measurement the value is expressed in. | def unit_of_measurement(self):
"""Return the unit of measurement the value is expressed in."""
return self._units | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_units"
] | [
63,
4
] | [
65,
26
] | python | en | ['en', 'en', 'en'] | True |
ZWaveMultilevelSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
if self._units in ("C", "F"):
return round(self._state, 1)
if isinstance(self._state, float):
return round(self._state, 2)
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"self",
".",
"_units",
"in",
"(",
"\"C\"",
",",
"\"F\"",
")",
":",
"return",
"round",
"(",
"self",
".",
"_state",
",",
"1",
")",
"if",
"isinstance",
"(",
"self",
".",
"_state",
",",
"float",
")",
":",
... | [
72,
4
] | [
79,
26
] | python | en | ['en', 'en', 'en'] | True |
ZWaveMultilevelSensor.unit_of_measurement | (self) | Return the unit the value is expressed in. | Return the unit the value is expressed in. | def unit_of_measurement(self):
"""Return the unit the value is expressed in."""
if self._units == "C":
return TEMP_CELSIUS
if self._units == "F":
return TEMP_FAHRENHEIT
return self._units | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"if",
"self",
".",
"_units",
"==",
"\"C\"",
":",
"return",
"TEMP_CELSIUS",
"if",
"self",
".",
"_units",
"==",
"\"F\"",
":",
"return",
"TEMP_FAHRENHEIT",
"return",
"self",
".",
"_units"
] | [
82,
4
] | [
88,
26
] | python | en | ['en', 'en', 'en'] | True |
ZWaveBatterySensor.device_class | (self) | Return the class of this device. | Return the class of this device. | def device_class(self):
"""Return the class of this device."""
return DEVICE_CLASS_BATTERY | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEVICE_CLASS_BATTERY"
] | [
108,
4
] | [
110,
35
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Ripple.com sensors. | Set up the Ripple.com sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Ripple.com sensors."""
address = config.get(CONF_ADDRESS)
name = config.get(CONF_NAME)
add_entities([RippleSensor(name, address)], True) | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"address",
"=",
"config",
".",
"get",
"(",
"CONF_ADDRESS",
")",
"name",
"=",
"config",
".",
"get",
"(",
"CONF_NAME",
")",
"add_entities"... | [
25,
0
] | [
30,
53
] | python | en | ['en', 'bg', 'en'] | True |
RippleSensor.__init__ | (self, name, address) | Initialize the sensor. | Initialize the sensor. | def __init__(self, name, address):
"""Initialize the sensor."""
self._name = name
self.address = address
self._state = None
self._unit_of_measurement = "XRP" | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"address",
")",
":",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"address",
"=",
"address",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_unit_of_measurement",
"=",
"\"XRP\""
] | [
36,
4
] | [
41,
41
] | python | en | ['en', 'en', 'en'] | True |
RippleSensor.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"
] | [
44,
4
] | [
46,
25
] | python | en | ['en', 'mi', 'en'] | True |
RippleSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
49,
4
] | [
51,
26
] | python | en | ['en', 'en', 'en'] | True |
RippleSensor.unit_of_measurement | (self) | Return the unit of measurement this sensor expresses itself in. | Return the unit of measurement this sensor expresses itself in. | def unit_of_measurement(self):
"""Return the unit of measurement this sensor expresses itself in."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
54,
4
] | [
56,
40
] | python | en | ['en', 'en', 'en'] | True |
RippleSensor.device_state_attributes | (self) | Return the state attributes of the sensor. | Return the state attributes of the sensor. | def device_state_attributes(self):
"""Return the state attributes of the sensor."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
"}"
] | [
59,
4
] | [
61,
46
] | python | en | ['en', 'en', 'en'] | True |
RippleSensor.update | (self) | Get the latest state of the sensor. | Get the latest state of the sensor. | def update(self):
"""Get the latest state of the sensor."""
balance = get_balance(self.address)
if balance is not None:
self._state = balance | [
"def",
"update",
"(",
"self",
")",
":",
"balance",
"=",
"get_balance",
"(",
"self",
".",
"address",
")",
"if",
"balance",
"is",
"not",
"None",
":",
"self",
".",
"_state",
"=",
"balance"
] | [
63,
4
] | [
68,
33
] | python | en | ['en', 'en', 'en'] | True |
_get_dyson_purecool_device | () | Return a valid device as provided by the Dyson web services. | Return a valid device as provided by the Dyson web services. | def _get_dyson_purecool_device():
"""Return a valid device as provided by the Dyson web services."""
device = mock.Mock(spec=DysonPureCool)
load_mock_device(device)
device.name = "Living room"
device.environmental_state.particulate_matter_25 = "0014"
device.environmental_state.particulate_matter... | [
"def",
"_get_dyson_purecool_device",
"(",
")",
":",
"device",
"=",
"mock",
".",
"Mock",
"(",
"spec",
"=",
"DysonPureCool",
")",
"load_mock_device",
"(",
"device",
")",
"device",
".",
"name",
"=",
"\"Living room\"",
"device",
".",
"environmental_state",
".",
"p... | [
23,
0
] | [
32,
17
] | python | en | ['en', 'en', 'en'] | True |
_get_config | () | Return a config dictionary. | Return a config dictionary. | def _get_config():
"""Return a config dictionary."""
return {
dyson_parent.DOMAIN: {
dyson_parent.CONF_USERNAME: "email",
dyson_parent.CONF_PASSWORD: "password",
dyson_parent.CONF_LANGUAGE: "GB",
dyson_parent.CONF_DEVICES: [
{"device_id": "... | [
"def",
"_get_config",
"(",
")",
":",
"return",
"{",
"dyson_parent",
".",
"DOMAIN",
":",
"{",
"dyson_parent",
".",
"CONF_USERNAME",
":",
"\"email\"",
",",
"dyson_parent",
".",
"CONF_PASSWORD",
":",
"\"password\"",
",",
"dyson_parent",
".",
"CONF_LANGUAGE",
":",
... | [
35,
0
] | [
46,
5
] | python | en | ['en', 'pt', 'en'] | True |
test_purecool_aiq_attributes | (devices, login, hass) | Test state attributes. | Test state attributes. | async def test_purecool_aiq_attributes(devices, login, hass):
"""Test state attributes."""
await async_setup_component(hass, dyson_parent.DOMAIN, _get_config())
await hass.async_block_till_done()
fan_state = hass.states.get("air_quality.living_room")
attributes = fan_state.attributes
assert fan... | [
"async",
"def",
"test_purecool_aiq_attributes",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson_parent",
".",
"DOMAIN",
",",
"_get_config",
"(",
")",
")",
"await",
"hass",
".",
"async_block_till_don... | [
54,
0
] | [
65,
43
] | python | en | ['en', 'en', 'en'] | True |
test_purecool_aiq_update_state | (devices, login, hass) | Test state update. | Test state update. | async def test_purecool_aiq_update_state(devices, login, hass):
"""Test state update."""
device = devices.return_value[0]
await async_setup_component(hass, dyson_parent.DOMAIN, _get_config())
await hass.async_block_till_done()
event = {
"msg": "ENVIRONMENTAL-CURRENT-SENSOR-DATA",
"ti... | [
"async",
"def",
"test_purecool_aiq_update_state",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"device",
"=",
"devices",
".",
"return_value",
"[",
"0",
"]",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson_parent",
".",
"DOMAIN",
",",
"_get_c... | [
73,
0
] | [
108,
43
] | python | en | ['en', 'co', 'en'] | True |
test_purecool_component_setup_only_once | (devices, login, hass) | Test if entities are created only once. | Test if entities are created only once. | async def test_purecool_component_setup_only_once(devices, login, hass):
"""Test if entities are created only once."""
config = _get_config()
await async_setup_component(hass, dyson_parent.DOMAIN, config)
await hass.async_block_till_done()
discovery.load_platform(hass, AIQ_DOMAIN, dyson_parent.DOMAI... | [
"async",
"def",
"test_purecool_component_setup_only_once",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"config",
"=",
"_get_config",
"(",
")",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson_parent",
".",
"DOMAIN",
",",
"config",
")",
"await"... | [
116,
0
] | [
124,
55
] | python | en | ['en', 'en', 'en'] | True |
test_purecool_aiq_without_discovery | (devices, login, hass) | Test if component correctly returns if discovery not set. | Test if component correctly returns if discovery not set. | async def test_purecool_aiq_without_discovery(devices, login, hass):
"""Test if component correctly returns if discovery not set."""
await async_setup_component(hass, dyson_parent.DOMAIN, _get_config())
await hass.async_block_till_done()
add_entities_mock = mock.MagicMock()
dyson.setup_platform(has... | [
"async",
"def",
"test_purecool_aiq_without_discovery",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson_parent",
".",
"DOMAIN",
",",
"_get_config",
"(",
")",
")",
"await",
"hass",
".",
"async_block_t... | [
132,
0
] | [
140,
44
] | python | en | ['en', 'en', 'en'] | True |
test_purecool_aiq_empty_environment_state | (devices, login, hass) | Test device with empty environmental state. | Test device with empty environmental state. | async def test_purecool_aiq_empty_environment_state(devices, login, hass):
"""Test device with empty environmental state."""
await async_setup_component(hass, dyson_parent.DOMAIN, _get_config())
await hass.async_block_till_done()
device = hass.data[dyson.DYSON_AIQ_DEVICES][0]
device._device.environm... | [
"async",
"def",
"test_purecool_aiq_empty_environment_state",
"(",
"devices",
",",
"login",
",",
"hass",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"dyson_parent",
".",
"DOMAIN",
",",
"_get_config",
"(",
")",
")",
"await",
"hass",
".",
"async_b... | [
148,
0
] | [
159,
52
] | 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.