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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ConfigFlow.async_step_homekit | (self, discovery_info) | Handle HomeKit discovery. | Handle HomeKit discovery. | async def async_step_homekit(self, discovery_info):
"""Handle HomeKit discovery."""
self._async_abort_entries_match()
properties = {
key.lower(): value for (key, value) in discovery_info["properties"].items()
}
await self.async_set_unique_id(properties["id"])
... | [
"async",
"def",
"async_step_homekit",
"(",
"self",
",",
"discovery_info",
")",
":",
"self",
".",
"_async_abort_entries_match",
"(",
")",
"properties",
"=",
"{",
"key",
".",
"lower",
"(",
")",
":",
"value",
"for",
"(",
"key",
",",
"value",
")",
"in",
"dis... | [
82,
4
] | [
89,
43
] | python | en | ['fr', 'xh', 'en'] | False |
ConfigFlow._username_already_configured | (self, user_input) | See if we already have a username matching user input configured. | See if we already have a username matching user input configured. | def _username_already_configured(self, user_input):
"""See if we already have a username matching user input configured."""
existing_username = {
entry.data[CONF_USERNAME] for entry in self._async_current_entries()
}
return user_input[CONF_USERNAME] in existing_username | [
"def",
"_username_already_configured",
"(",
"self",
",",
"user_input",
")",
":",
"existing_username",
"=",
"{",
"entry",
".",
"data",
"[",
"CONF_USERNAME",
"]",
"for",
"entry",
"in",
"self",
".",
"_async_current_entries",
"(",
")",
"}",
"return",
"user_input",
... | [
91,
4
] | [
96,
61
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_get_options_flow | (config_entry) | Get the options flow for this handler. | Get the options flow for this handler. | def async_get_options_flow(config_entry):
"""Get the options flow for this handler."""
return OptionsFlowHandler(config_entry) | [
"def",
"async_get_options_flow",
"(",
"config_entry",
")",
":",
"return",
"OptionsFlowHandler",
"(",
"config_entry",
")"
] | [
100,
4
] | [
102,
47
] | python | en | ['en', 'en', 'en'] | True |
OptionsFlowHandler.__init__ | (self, config_entry: config_entries.ConfigEntry) | Initialize options flow. | Initialize options flow. | def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize options flow."""
self.config_entry = config_entry | [
"def",
"__init__",
"(",
"self",
",",
"config_entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
"->",
"None",
":",
"self",
".",
"config_entry",
"=",
"config_entry"
] | [
108,
4
] | [
110,
40
] | python | en | ['en', 'en', 'en'] | True |
OptionsFlowHandler.async_step_init | (self, user_input=None) | Handle options flow. | Handle options flow. | async def async_step_init(self, user_input=None):
"""Handle options flow."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
data_schema = vol.Schema(
{
vol.Required(
CONF_FALLBACK, default=self.con... | [
"async",
"def",
"async_step_init",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"if",
"user_input",
"is",
"not",
"None",
":",
"return",
"self",
".",
"async_create_entry",
"(",
"title",
"=",
"\"\"",
",",
"data",
"=",
"user_input",
")",
"data_schem... | [
112,
4
] | [
124,
76
] | python | en | ['en', 'nl', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the sensors. | Set up the sensors. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the sensors."""
ibus_client = IBus(config[CONF_APP_ID], config[CONF_APP_KEY])
sensors = []
for line_stop in config.get(CONF_BUS_STOPS):
line = line_stop[CONF_LINE]
stop = line_stop[CONF_BUS_STOP]
if ... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"ibus_client",
"=",
"IBus",
"(",
"config",
"[",
"CONF_APP_ID",
"]",
",",
"config",
"[",
"CONF_APP_KEY",
"]",
")",
"sensors",
"=",
"[",
... | [
46,
0
] | [
61,
31
] | python | en | ['en', 'bg', 'en'] | True |
TMBSensor.__init__ | (self, ibus_client, stop, line, name) | Initialize the sensor. | Initialize the sensor. | def __init__(self, ibus_client, stop, line, name):
"""Initialize the sensor."""
self._ibus_client = ibus_client
self._stop = stop
self._line = line.upper()
self._name = name
self._unit = TIME_MINUTES
self._state = None | [
"def",
"__init__",
"(",
"self",
",",
"ibus_client",
",",
"stop",
",",
"line",
",",
"name",
")",
":",
"self",
".",
"_ibus_client",
"=",
"ibus_client",
"self",
".",
"_stop",
"=",
"stop",
"self",
".",
"_line",
"=",
"line",
".",
"upper",
"(",
")",
"self"... | [
67,
4
] | [
74,
26
] | python | en | ['en', 'en', 'en'] | True |
TMBSensor.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"
] | [
77,
4
] | [
79,
25
] | python | en | ['en', 'mi', 'en'] | True |
TMBSensor.icon | (self) | Return the icon for the frontend. | Return the icon for the frontend. | def icon(self):
"""Return the icon for the frontend."""
return ICON | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"ICON"
] | [
82,
4
] | [
84,
19
] | python | en | ['en', 'en', 'en'] | True |
TMBSensor.native_unit_of_measurement | (self) | Return the unit of measurement. | Return the unit of measurement. | def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self._unit | [
"def",
"native_unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit"
] | [
87,
4
] | [
89,
25
] | python | en | ['en', 'la', 'en'] | True |
TMBSensor.unique_id | (self) | Return a unique, HASS-friendly identifier for this entity. | Return a unique, HASS-friendly identifier for this entity. | def unique_id(self):
"""Return a unique, HASS-friendly identifier for this entity."""
return f"{self._stop}_{self._line}" | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"f\"{self._stop}_{self._line}\""
] | [
92,
4
] | [
94,
43
] | python | en | ['en', 'en', 'en'] | True |
TMBSensor.native_value | (self) | Return the next departure time. | Return the next departure time. | def native_value(self):
"""Return the next departure time."""
return self._state | [
"def",
"native_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
97,
4
] | [
99,
26
] | python | en | ['en', 'en', 'en'] | True |
TMBSensor.extra_state_attributes | (self) | Return the state attributes of the last update. | Return the state attributes of the last update. | def extra_state_attributes(self):
"""Return the state attributes of the last update."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_BUS_STOP: self._stop,
ATTR_LINE: self._line,
} | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"ATTR_ATTRIBUTION",
":",
"ATTRIBUTION",
",",
"ATTR_BUS_STOP",
":",
"self",
".",
"_stop",
",",
"ATTR_LINE",
":",
"self",
".",
"_line",
",",
"}"
] | [
102,
4
] | [
108,
9
] | python | en | ['en', 'en', 'en'] | True |
TMBSensor.update | (self) | Get the next bus information. | Get the next bus information. | def update(self):
"""Get the next bus information."""
try:
self._state = self._ibus_client.get_stop_forecast(self._stop, self._line)
except HTTPError:
_LOGGER.error(
"Unable to fetch data from TMB API. Please check your API keys are valid"
) | [
"def",
"update",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_state",
"=",
"self",
".",
"_ibus_client",
".",
"get_stop_forecast",
"(",
"self",
".",
"_stop",
",",
"self",
".",
"_line",
")",
"except",
"HTTPError",
":",
"_LOGGER",
".",
"error",
"(",
... | [
111,
4
] | [
118,
13
] | python | en | ['en', 'en', 'en'] | True |
setup | (hass, config) | Set up the Xiaomi component. | Set up the Xiaomi component. | def setup(hass, config):
"""Set up the Xiaomi component."""
def play_ringtone_service(call):
"""Service to play ringtone through Gateway."""
ring_id = call.data.get(ATTR_RINGTONE_ID)
gateway = call.data.get(ATTR_GW_MAC)
kwargs = {"mid": ring_id}
ring_vol = call.data.ge... | [
"def",
"setup",
"(",
"hass",
",",
"config",
")",
":",
"def",
"play_ringtone_service",
"(",
"call",
")",
":",
"\"\"\"Service to play ringtone through Gateway.\"\"\"",
"ring_id",
"=",
"call",
".",
"data",
".",
"get",
"(",
"ATTR_RINGTONE_ID",
")",
"gateway",
"=",
"... | [
68,
0
] | [
129,
15
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
) | Set up the xiaomi aqara components from a config entry. | Set up the xiaomi aqara components from a config entry. | async def async_setup_entry(
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
):
"""Set up the xiaomi aqara components from a config entry."""
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN].setdefault(GATEWAYS_KEY, {})
# Connect to Xiaomi Aqara Gateway
xiaomi_gateway = await hass... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"hass",
".",
"data",
"[",
... | [
132,
0
] | [
191,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
):
"""Unload a config entry."""
if entry.data[CONF_KEY] is not None:
platforms = GATEWAY_PLATFORMS
else:
platforms = GATEWAY_PLATFORMS_NO_KEY
unload_ok = await hass.config_entries.async_unload_... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"entry",
":",
"config_entries",
".",
"ConfigEntry",
")",
":",
"if",
"entry",
".",
"data",
"[",
"CONF_KEY",
"]",
"is",
"not",
"None",
":",
"platforms",
"=",
"GATEWAY_... | [
194,
0
] | [
214,
20
] | python | en | ['en', 'es', 'en'] | True |
_add_gateway_to_schema | (hass, schema) | Extend a voluptuous schema with a gateway validator. | Extend a voluptuous schema with a gateway validator. | def _add_gateway_to_schema(hass, schema):
"""Extend a voluptuous schema with a gateway validator."""
def gateway(sid):
"""Convert sid to a gateway."""
sid = str(sid).replace(":", "").lower()
for gateway in hass.data[DOMAIN][GATEWAYS_KEY].values():
if gateway.sid == sid:
... | [
"def",
"_add_gateway_to_schema",
"(",
"hass",
",",
"schema",
")",
":",
"def",
"gateway",
"(",
"sid",
")",
":",
"\"\"\"Convert sid to a gateway.\"\"\"",
"sid",
"=",
"str",
"(",
"sid",
")",
".",
"replace",
"(",
"\":\"",
",",
"\"\"",
")",
".",
"lower",
"(",
... | [
367,
0
] | [
389,
72
] | python | en | ['en', 'de', 'en'] | True |
XiaomiDevice.__init__ | (self, device, device_type, xiaomi_hub, config_entry) | Initialize the Xiaomi device. | Initialize the Xiaomi device. | def __init__(self, device, device_type, xiaomi_hub, config_entry):
"""Initialize the Xiaomi device."""
self._state = None
self._is_available = True
self._sid = device["sid"]
self._model = device["model"]
self._protocol = device["proto"]
self._name = f"{device_type... | [
"def",
"__init__",
"(",
"self",
",",
"device",
",",
"device_type",
",",
"xiaomi_hub",
",",
"config_entry",
")",
":",
"self",
".",
"_state",
"=",
"None",
"self",
".",
"_is_available",
"=",
"True",
"self",
".",
"_sid",
"=",
"device",
"[",
"\"sid\"",
"]",
... | [
220,
4
] | [
253,
39
] | python | en | ['en', 'en', 'en'] | True |
XiaomiDevice.async_added_to_hass | (self) | Start unavailability tracking. | Start unavailability tracking. | async def async_added_to_hass(self):
"""Start unavailability tracking."""
self._xiaomi_hub.callbacks[self._sid].append(self._add_push_data_job)
self._async_track_unavailable() | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"_xiaomi_hub",
".",
"callbacks",
"[",
"self",
".",
"_sid",
"]",
".",
"append",
"(",
"self",
".",
"_add_push_data_job",
")",
"self",
".",
"_async_track_unavailable",
"(",
")"
] | [
258,
4
] | [
261,
39
] | python | en | ['en', 'en', 'it'] | True |
XiaomiDevice.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
264,
4
] | [
266,
25
] | python | en | ['en', 'en', 'en'] | True |
XiaomiDevice.unique_id | (self) | Return a unique ID. | Return a unique ID. | def unique_id(self) -> str:
"""Return a unique ID."""
return self._unique_id | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_unique_id"
] | [
269,
4
] | [
271,
30
] | python | ca | ['fr', 'ca', 'en'] | False |
XiaomiDevice.device_id | (self) | Return the device id of the Xiaomi Aqara device. | Return the device id of the Xiaomi Aqara device. | def device_id(self):
"""Return the device id of the Xiaomi Aqara device."""
return self._device_id | [
"def",
"device_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_id"
] | [
274,
4
] | [
276,
30
] | python | en | ['en', 'yo', 'en'] | True |
XiaomiDevice.device_info | (self) | Return the device info of the Xiaomi Aqara device. | Return the device info of the Xiaomi Aqara device. | def device_info(self):
"""Return the device info of the Xiaomi Aqara device."""
if self._is_gateway:
device_info = {
"identifiers": {(DOMAIN, self._device_id)},
"model": self._model,
}
else:
device_info = {
"conn... | [
"def",
"device_info",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_gateway",
":",
"device_info",
"=",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"self",
".",
"_device_id",
")",
"}",
",",
"\"model\"",
":",
"self",
".",
"_model",
",",
"}",
... | [
279,
4
] | [
297,
26
] | python | en | ['en', 'yo', 'en'] | True |
XiaomiDevice.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return self._is_available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_available"
] | [
300,
4
] | [
302,
33
] | python | en | ['en', 'en', 'en'] | True |
XiaomiDevice.should_poll | (self) | Return the polling state. No polling needed. | Return the polling state. No polling needed. | def should_poll(self):
"""Return the polling state. No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
305,
4
] | [
307,
20
] | python | en | ['en', 'en', 'en'] | True |
XiaomiDevice.extra_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def extra_state_attributes(self):
"""Return the state attributes."""
return self._extra_state_attributes | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_extra_state_attributes"
] | [
310,
4
] | [
312,
43
] | python | en | ['en', 'en', 'en'] | True |
XiaomiDevice._async_set_unavailable | (self, now) | Set state to UNAVAILABLE. | Set state to UNAVAILABLE. | def _async_set_unavailable(self, now):
"""Set state to UNAVAILABLE."""
self._remove_unavailability_tracker = None
self._is_available = False
self.async_write_ha_state() | [
"def",
"_async_set_unavailable",
"(",
"self",
",",
"now",
")",
":",
"self",
".",
"_remove_unavailability_tracker",
"=",
"None",
"self",
".",
"_is_available",
"=",
"False",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
315,
4
] | [
319,
35
] | python | en | ['en', 'en', 'en'] | True |
XiaomiDevice.push_data | (self, data, raw_data) | Push from Hub. | Push from Hub. | def push_data(self, data, raw_data):
"""Push from Hub."""
_LOGGER.debug("PUSH >> %s: %s", self, data)
was_unavailable = self._async_track_unavailable()
is_data = self.parse_data(data, raw_data)
is_voltage = self.parse_voltage(data)
if is_data or is_voltage or was_unavaila... | [
"def",
"push_data",
"(",
"self",
",",
"data",
",",
"raw_data",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"PUSH >> %s: %s\"",
",",
"self",
",",
"data",
")",
"was_unavailable",
"=",
"self",
".",
"_async_track_unavailable",
"(",
")",
"is_data",
"=",
"self",
"... | [
334,
4
] | [
341,
39
] | python | en | ['en', 'uz', 'en'] | True |
XiaomiDevice.parse_voltage | (self, data) | Parse battery level data sent by gateway. | Parse battery level data sent by gateway. | def parse_voltage(self, data):
"""Parse battery level data sent by gateway."""
if "voltage" in data:
voltage_key = "voltage"
elif "battery_voltage" in data:
voltage_key = "battery_voltage"
else:
return False
max_volt = 3300
min_volt = ... | [
"def",
"parse_voltage",
"(",
"self",
",",
"data",
")",
":",
"if",
"\"voltage\"",
"in",
"data",
":",
"voltage_key",
"=",
"\"voltage\"",
"elif",
"\"battery_voltage\"",
"in",
"data",
":",
"voltage_key",
"=",
"\"battery_voltage\"",
"else",
":",
"return",
"False",
... | [
343,
4
] | [
360,
19
] | python | en | ['en', 'en', 'en'] | True |
XiaomiDevice.parse_data | (self, data, raw_data) | Parse data sent by gateway. | Parse data sent by gateway. | def parse_data(self, data, raw_data):
"""Parse data sent by gateway."""
raise NotImplementedError() | [
"def",
"parse_data",
"(",
"self",
",",
"data",
",",
"raw_data",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
362,
4
] | [
364,
35
] | python | en | ['en', 'de', 'en'] | True |
collect_args | (*insights_config_args, **insights_config_custom_kwargs) |
Instantiates InsightsConfig with a default logging_file argument.
|
Instantiates InsightsConfig with a default logging_file argument.
| def collect_args(*insights_config_args, **insights_config_custom_kwargs):
"""
Instantiates InsightsConfig with a default logging_file argument.
"""
all_insights_config_kwargs = {"logging_file": "/tmp/insights.log",
"remove_file": conf_remove_file,
... | [
"def",
"collect_args",
"(",
"*",
"insights_config_args",
",",
"*",
"*",
"insights_config_custom_kwargs",
")",
":",
"all_insights_config_kwargs",
"=",
"{",
"\"logging_file\"",
":",
"\"/tmp/insights.log\"",
",",
"\"remove_file\"",
":",
"conf_remove_file",
",",
"\"redaction_... | [
23,
0
] | [
33,
86
] | python | en | ['en', 'error', 'th'] | False |
patch_temp_conf_file | () |
Creates a valid temporary config file.
|
Creates a valid temporary config file.
| def patch_temp_conf_file():
"""
Creates a valid temporary config file.
"""
collection_rules_file = NamedTemporaryFile("w+t")
json_dump({"version": "1.2.3"}, collection_rules_file)
collection_rules_file.seek(0)
with patch("insights.client.collection_rules.constants.collection_rules_file", col... | [
"def",
"patch_temp_conf_file",
"(",
")",
":",
"collection_rules_file",
"=",
"NamedTemporaryFile",
"(",
"\"w+t\"",
")",
"json_dump",
"(",
"{",
"\"version\"",
":",
"\"1.2.3\"",
"}",
",",
"collection_rules_file",
")",
"collection_rules_file",
".",
"seek",
"(",
"0",
"... | [
37,
0
] | [
46,
33
] | python | en | ['en', 'error', 'th'] | False |
temp_conf_file | () |
Creates a valid temporary config file.
|
Creates a valid temporary config file.
| def temp_conf_file():
"""
Creates a valid temporary config file.
"""
collection_rules_file = NamedTemporaryFile()
json_dump({"version": "1.2.3"}, collection_rules_file)
collection_rules_file.seek(0)
return collection_rules_file | [
"def",
"temp_conf_file",
"(",
")",
":",
"collection_rules_file",
"=",
"NamedTemporaryFile",
"(",
")",
"json_dump",
"(",
"{",
"\"version\"",
":",
"\"1.2.3\"",
"}",
",",
"collection_rules_file",
")",
"collection_rules_file",
".",
"seek",
"(",
"0",
")",
"return",
"... | [
49,
0
] | [
56,
32
] | python | en | ['en', 'error', 'th'] | False |
patch_get_branch_info | () |
Sets a static response to get_branch_info method.
|
Sets a static response to get_branch_info method.
| def patch_get_branch_info():
"""
Sets a static response to get_branch_info method.
"""
def decorator(old_function):
patcher = patch("insights.client.client.get_branch_info")
return patcher(old_function)
return decorator | [
"def",
"patch_get_branch_info",
"(",
")",
":",
"def",
"decorator",
"(",
"old_function",
")",
":",
"patcher",
"=",
"patch",
"(",
"\"insights.client.client.get_branch_info\"",
")",
"return",
"patcher",
"(",
"old_function",
")",
"return",
"decorator"
] | [
59,
0
] | [
66,
20
] | python | en | ['en', 'error', 'th'] | False |
patch_get_conf_file | () |
Mocks InsightsUploadConf.get_conf_file so it returns a fixed configuration.
|
Mocks InsightsUploadConf.get_conf_file so it returns a fixed configuration.
| def patch_get_conf_file():
"""
Mocks InsightsUploadConf.get_conf_file so it returns a fixed configuration.
"""
def decorator(old_function):
patcher = patch("insights.client.client.InsightsUploadConf.get_conf_file")
return patcher(old_function)
return decorator | [
"def",
"patch_get_conf_file",
"(",
")",
":",
"def",
"decorator",
"(",
"old_function",
")",
":",
"patcher",
"=",
"patch",
"(",
"\"insights.client.client.InsightsUploadConf.get_conf_file\"",
")",
"return",
"patcher",
"(",
"old_function",
")",
"return",
"decorator"
] | [
69,
0
] | [
76,
20
] | python | en | ['en', 'error', 'th'] | False |
patch_get_rm_conf | () |
Mocks InsightsUploadConf.get_rm_conf so it returns a fixed configuration.
|
Mocks InsightsUploadConf.get_rm_conf so it returns a fixed configuration.
| def patch_get_rm_conf():
"""
Mocks InsightsUploadConf.get_rm_conf so it returns a fixed configuration.
"""
def decorator(old_function):
patcher = patch("insights.client.client.InsightsUploadConf.get_rm_conf")
return patcher(old_function)
return decorator | [
"def",
"patch_get_rm_conf",
"(",
")",
":",
"def",
"decorator",
"(",
"old_function",
")",
":",
"patcher",
"=",
"patch",
"(",
"\"insights.client.client.InsightsUploadConf.get_rm_conf\"",
")",
"return",
"patcher",
"(",
"old_function",
")",
"return",
"decorator"
] | [
79,
0
] | [
86,
20
] | python | en | ['en', 'error', 'th'] | False |
patch_data_collector | () |
Replaces DataCollector with a dummy mock.
|
Replaces DataCollector with a dummy mock.
| def patch_data_collector():
"""
Replaces DataCollector with a dummy mock.
"""
def decorator(old_function):
patcher = patch("insights.client.client.DataCollector")
return patcher(old_function)
return decorator | [
"def",
"patch_data_collector",
"(",
")",
":",
"def",
"decorator",
"(",
"old_function",
")",
":",
"patcher",
"=",
"patch",
"(",
"\"insights.client.client.DataCollector\"",
")",
"return",
"patcher",
"(",
"old_function",
")",
"return",
"decorator"
] | [
89,
0
] | [
96,
20
] | python | en | ['en', 'error', 'th'] | False |
patch_isfile | (remove_file_exists) |
Mocks os.path.isfile so it always claims that a file exists. If it‘s a remove conf file, the result depends on the
given value.
|
Mocks os.path.isfile so it always claims that a file exists. If it‘s a remove conf file, the result depends on the
given value.
| def patch_isfile(remove_file_exists):
"""
Mocks os.path.isfile so it always claims that a file exists. If it‘s a remove conf file, the result depends on the
given value.
"""
def decorator(old_function):
def decider(*args, **kwargs):
"""
Returns given value for remove_... | [
"def",
"patch_isfile",
"(",
"remove_file_exists",
")",
":",
"def",
"decorator",
"(",
"old_function",
")",
":",
"def",
"decider",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"\n Returns given value for remove_file and True for any other file.\n ... | [
99,
0
] | [
117,
20
] | python | en | ['en', 'error', 'th'] | False |
patch_raw_config_parser | () |
Mocks RawConfigParser, so it returns a fixed configuration of removed files.
|
Mocks RawConfigParser, so it returns a fixed configuration of removed files.
| def patch_raw_config_parser():
"""
Mocks RawConfigParser, so it returns a fixed configuration of removed files.
"""
def decorator(old_function):
files = ",".join(removed_files)
patcher = patch("insights.client.collection_rules.ConfigParser.RawConfigParser",
**{"re... | [
"def",
"patch_raw_config_parser",
"(",
")",
":",
"def",
"decorator",
"(",
"old_function",
")",
":",
"files",
"=",
"\",\"",
".",
"join",
"(",
"removed_files",
")",
"patcher",
"=",
"patch",
"(",
"\"insights.client.collection_rules.ConfigParser.RawConfigParser\"",
",",
... | [
120,
0
] | [
129,
20
] | python | en | ['en', 'error', 'th'] | False |
patch_validate_gpg_sig | (return_value) |
Mocks the InsightsUploadConf.validate_gpg_sig method so it returns the given validation result.
|
Mocks the InsightsUploadConf.validate_gpg_sig method so it returns the given validation result.
| def patch_validate_gpg_sig(return_value):
"""
Mocks the InsightsUploadConf.validate_gpg_sig method so it returns the given validation result.
"""
def decorator(old_function):
patcher = patch("insights.client.collection_rules.InsightsUploadConf.validate_gpg_sig",
return_va... | [
"def",
"patch_validate_gpg_sig",
"(",
"return_value",
")",
":",
"def",
"decorator",
"(",
"old_function",
")",
":",
"patcher",
"=",
"patch",
"(",
"\"insights.client.collection_rules.InsightsUploadConf.validate_gpg_sig\"",
",",
"return_value",
"=",
"return_value",
")",
"ret... | [
132,
0
] | [
140,
20
] | python | en | ['en', 'error', 'th'] | False |
patch_try_disk | (return_value) |
Mocks the InsightsUploadConf.try_disk method so it returns the given parsed file contents.
|
Mocks the InsightsUploadConf.try_disk method so it returns the given parsed file contents.
| def patch_try_disk(return_value):
"""
Mocks the InsightsUploadConf.try_disk method so it returns the given parsed file contents.
"""
def decorator(old_function):
patcher = patch("insights.client.collection_rules.InsightsUploadConf.try_disk", return_value=return_value)
return patcher(old_... | [
"def",
"patch_try_disk",
"(",
"return_value",
")",
":",
"def",
"decorator",
"(",
"old_function",
")",
":",
"patcher",
"=",
"patch",
"(",
"\"insights.client.collection_rules.InsightsUploadConf.try_disk\"",
",",
"return_value",
"=",
"return_value",
")",
"return",
"patcher... | [
143,
0
] | [
150,
20
] | python | en | ['en', 'error', 'th'] | False |
test_get_conf_file | (get_branch_info, get_conf_file, data_collector) |
If there is no config passed via stdin, it is loaded from a file instead.
|
If there is no config passed via stdin, it is loaded from a file instead.
| def test_get_conf_file(get_branch_info, get_conf_file, data_collector):
"""
If there is no config passed via stdin, it is loaded from a file instead.
"""
config, pconn = collect_args()
collect(config, pconn)
get_conf_file.assert_called_once_with() | [
"def",
"test_get_conf_file",
"(",
"get_branch_info",
",",
"get_conf_file",
",",
"data_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
")",
"collect",
"(",
"config",
",",
"pconn",
")",
"get_conf_file",
".",
"assert_called_once_with",
"(",
... | [
156,
0
] | [
163,
43
] | python | en | ['en', 'error', 'th'] | False |
test_get_conf_not_called_core_collection | (get_branch_info, get_conf_file, core_collector) |
Verify that uploader.json is not loaded when using core collection
|
Verify that uploader.json is not loaded when using core collection
| def test_get_conf_not_called_core_collection(get_branch_info, get_conf_file, core_collector):
"""
Verify that uploader.json is not loaded when using core collection
"""
config, pconn = collect_args(core_collect=True)
collect(config, pconn)
get_conf_file.assert_not_called() | [
"def",
"test_get_conf_not_called_core_collection",
"(",
"get_branch_info",
",",
"get_conf_file",
",",
"core_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
"core_collect",
"=",
"True",
")",
"collect",
"(",
"config",
",",
"pconn",
")",
"get_... | [
169,
0
] | [
176,
37
] | python | en | ['en', 'error', 'th'] | False |
test_get_rm_conf_file | (get_branch_info, get_conf_file, get_rm_conf, data_collector) |
Load configuration of files removed from collection when collection rules are loaded from a file.
|
Load configuration of files removed from collection when collection rules are loaded from a file.
| def test_get_rm_conf_file(get_branch_info, get_conf_file, get_rm_conf, data_collector):
"""
Load configuration of files removed from collection when collection rules are loaded from a file.
"""
config, pconn = collect_args()
collect(config, pconn)
get_rm_conf.assert_called_once_with() | [
"def",
"test_get_rm_conf_file",
"(",
"get_branch_info",
",",
"get_conf_file",
",",
"get_rm_conf",
",",
"data_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
")",
"collect",
"(",
"config",
",",
"pconn",
")",
"get_rm_conf",
".",
"assert_cal... | [
183,
0
] | [
190,
41
] | python | en | ['en', 'error', 'th'] | False |
test_data_collector_file | (get_branch_info, get_conf_file, get_rm_conf, data_collector, create_report) |
Configuration from a file is passed to the DataCollector along with removed files configuration.
|
Configuration from a file is passed to the DataCollector along with removed files configuration.
| def test_data_collector_file(get_branch_info, get_conf_file, get_rm_conf, data_collector, create_report):
"""
Configuration from a file is passed to the DataCollector along with removed files configuration.
"""
config, pconn = collect_args()
collect(config, pconn)
collection_rules = get_conf_fi... | [
"def",
"test_data_collector_file",
"(",
"get_branch_info",
",",
"get_conf_file",
",",
"get_rm_conf",
",",
"data_collector",
",",
"create_report",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
")",
"collect",
"(",
"config",
",",
"pconn",
")",
"colle... | [
198,
0
] | [
210,
87
] | python | en | ['en', 'error', 'th'] | False |
test_core_collector_file | (get_branch_info, get_conf_file, get_rm_conf, core_collector, create_report) |
CoreCollector is loaded with rm_conf and a None value for collection_rules
|
CoreCollector is loaded with rm_conf and a None value for collection_rules
| def test_core_collector_file(get_branch_info, get_conf_file, get_rm_conf, core_collector, create_report):
"""
CoreCollector is loaded with rm_conf and a None value for collection_rules
"""
config, pconn = collect_args(core_collect=True)
collect(config, pconn)
collection_rules = None
rm_conf... | [
"def",
"test_core_collector_file",
"(",
"get_branch_info",
",",
"get_conf_file",
",",
"get_rm_conf",
",",
"core_collector",
",",
"create_report",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
"core_collect",
"=",
"True",
")",
"collect",
"(",
"config"... | [
218,
0
] | [
230,
87
] | python | en | ['en', 'error', 'th'] | False |
test_correct_collector_loaded | (get_branch_info, get_conf_file, get_rm_conf, create_report, data_collector, core_collector) |
Verify that core collection is loaded for core_collect=True, and that
classic collection is loaded for core_collect=False
|
Verify that core collection is loaded for core_collect=True, and that
classic collection is loaded for core_collect=False
| def test_correct_collector_loaded(get_branch_info, get_conf_file, get_rm_conf, create_report, data_collector, core_collector):
'''
Verify that core collection is loaded for core_collect=True, and that
classic collection is loaded for core_collect=False
'''
config, pconn = collect_args(core_collect=F... | [
"def",
"test_correct_collector_loaded",
"(",
"get_branch_info",
",",
"get_conf_file",
",",
"get_rm_conf",
",",
"create_report",
",",
"data_collector",
",",
"core_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
"core_collect",
"=",
"False",
")... | [
239,
0
] | [
258,
62
] | python | en | ['en', 'error', 'th'] | False |
test_file_signature_ignored | (get_branch_info, validate_gpg_sig, data_collector) |
Signature of configuration from a file is not validated if validation is disabled.
|
Signature of configuration from a file is not validated if validation is disabled.
| def test_file_signature_ignored(get_branch_info, validate_gpg_sig, data_collector):
"""
Signature of configuration from a file is not validated if validation is disabled.
"""
config, pconn = collect_args(gpg=False)
with patch_temp_conf_file():
collect(config, pconn)
validate_gpg_sig.as... | [
"def",
"test_file_signature_ignored",
"(",
"get_branch_info",
",",
"validate_gpg_sig",
",",
"data_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
"gpg",
"=",
"False",
")",
"with",
"patch_temp_conf_file",
"(",
")",
":",
"collect",
"(",
"co... | [
265,
0
] | [
274,
40
] | python | en | ['en', 'error', 'th'] | False |
test_file_signature_valid | (get_branch_info, validate_gpg_sig, data_collector) |
Correct signature of configuration from a file is recognized.
|
Correct signature of configuration from a file is recognized.
| def test_file_signature_valid(get_branch_info, validate_gpg_sig, data_collector):
"""
Correct signature of configuration from a file is recognized.
"""
config, pconn = collect_args()
with patch_temp_conf_file():
collect(config, pconn)
validate_gpg_sig.assert_called_once() | [
"def",
"test_file_signature_valid",
"(",
"get_branch_info",
",",
"validate_gpg_sig",
",",
"data_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
")",
"with",
"patch_temp_conf_file",
"(",
")",
":",
"collect",
"(",
"config",
",",
"pconn",
")... | [
283,
0
] | [
291,
41
] | python | en | ['en', 'error', 'th'] | False |
test_file_signature_invalid | (get_branch_info, validate_gpg_sig, data_collector) |
Incorrect signature of configuration from a file skips that file.
|
Incorrect signature of configuration from a file skips that file.
| def test_file_signature_invalid(get_branch_info, validate_gpg_sig, data_collector):
"""
Incorrect signature of configuration from a file skips that file.
"""
config, pconn = collect_args()
with patch_temp_conf_file():
with raises(RuntimeError):
collect(config, pconn)
validat... | [
"def",
"test_file_signature_invalid",
"(",
"get_branch_info",
",",
"validate_gpg_sig",
",",
"data_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
")",
"with",
"patch_temp_conf_file",
"(",
")",
":",
"with",
"raises",
"(",
"RuntimeError",
")"... | [
299,
0
] | [
308,
36
] | python | en | ['en', 'error', 'th'] | False |
test_file_result | (get_branch_info, try_disk, raw_config_parser, data_collector, verify_permissions) |
Configuration from file is loaded from the "uploader.json" key.
|
Configuration from file is loaded from the "uploader.json" key.
| def test_file_result(get_branch_info, try_disk, raw_config_parser, data_collector, verify_permissions):
"""
Configuration from file is loaded from the "uploader.json" key.
"""
if six.PY3:
open_name = 'builtins.open'
else:
open_name = '__builtin__.open'
with patch(open_name, crea... | [
"def",
"test_file_result",
"(",
"get_branch_info",
",",
"try_disk",
",",
"raw_config_parser",
",",
"data_collector",
",",
"verify_permissions",
")",
":",
"if",
"six",
".",
"PY3",
":",
"open_name",
"=",
"'builtins.open'",
"else",
":",
"open_name",
"=",
"'__builtin_... | [
319,
0
] | [
344,
91
] | python | en | ['en', 'error', 'th'] | False |
test_file_no_version | (get_branch_info, try_disk, data_collector) |
Configuration from file is loaded from the "uploader.json" key.
|
Configuration from file is loaded from the "uploader.json" key.
| def test_file_no_version(get_branch_info, try_disk, data_collector):
"""
Configuration from file is loaded from the "uploader.json" key.
"""
config, pconn = collect_args()
with raises(ValueError):
collect(config, pconn)
data_collector.return_value.run_collection.assert_not_called()
... | [
"def",
"test_file_no_version",
"(",
"get_branch_info",
",",
"try_disk",
",",
"data_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
")",
"with",
"raises",
"(",
"ValueError",
")",
":",
"collect",
"(",
"config",
",",
"pconn",
")",
"data_... | [
351,
0
] | [
360,
56
] | python | en | ['en', 'error', 'th'] | False |
test_file_no_data | (get_branch_info, try_disk, data_collector) |
Configuration from file is loaded from the "uploader.json" key.
|
Configuration from file is loaded from the "uploader.json" key.
| def test_file_no_data(get_branch_info, try_disk, data_collector):
"""
Configuration from file is loaded from the "uploader.json" key.
"""
config, pconn = collect_args()
with raises(RuntimeError):
collect(config, pconn)
data_collector.return_value.run_collection.assert_not_called()
d... | [
"def",
"test_file_no_data",
"(",
"get_branch_info",
",",
"try_disk",
",",
"data_collector",
")",
":",
"config",
",",
"pconn",
"=",
"collect_args",
"(",
")",
"with",
"raises",
"(",
"RuntimeError",
")",
":",
"collect",
"(",
"config",
",",
"pconn",
")",
"data_c... | [
367,
0
] | [
376,
56
] | python | en | ['en', 'error', 'th'] | False |
KeeneticRouter.__init__ | (self, hass: HomeAssistant, config_entry: ConfigEntry) | Initialize the Client. | Initialize the Client. | def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
"""Initialize the Client."""
self.hass = hass
self.config_entry = config_entry
self._last_devices: dict[str, Device] = {}
self._router_info: RouterInfo | None = None
self._connection: TelnetConnec... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
",",
"config_entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"self",
".",
"hass",
"=",
"hass",
"self",
".",
"config_entry",
"=",
"config_entry",
"self",
".",
"_last_devices",
":",
"dict... | [
39,
4
] | [
50,
77
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.client | (self) | Read-only accessor for the client connection. | Read-only accessor for the client connection. | def client(self):
"""Read-only accessor for the client connection."""
return self._client | [
"def",
"client",
"(",
"self",
")",
":",
"return",
"self",
".",
"_client"
] | [
53,
4
] | [
55,
27
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.last_devices | (self) | Read-only accessor for last_devices. | Read-only accessor for last_devices. | def last_devices(self):
"""Read-only accessor for last_devices."""
return self._last_devices | [
"def",
"last_devices",
"(",
"self",
")",
":",
"return",
"self",
".",
"_last_devices"
] | [
58,
4
] | [
60,
33
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.host | (self) | Return the host of this hub. | Return the host of this hub. | def host(self):
"""Return the host of this hub."""
return self.config_entry.data[CONF_HOST] | [
"def",
"host",
"(",
"self",
")",
":",
"return",
"self",
".",
"config_entry",
".",
"data",
"[",
"CONF_HOST",
"]"
] | [
63,
4
] | [
65,
48
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.device_info | (self) | Return the host of this hub. | Return the host of this hub. | def device_info(self):
"""Return the host of this hub."""
return {
"identifiers": {(DOMAIN, f"router-{self.config_entry.entry_id}")},
"manufacturer": self.manufacturer,
"model": self.model,
"name": self.name,
"sw_version": self.firmware,
... | [
"def",
"device_info",
"(",
"self",
")",
":",
"return",
"{",
"\"identifiers\"",
":",
"{",
"(",
"DOMAIN",
",",
"f\"router-{self.config_entry.entry_id}\"",
")",
"}",
",",
"\"manufacturer\"",
":",
"self",
".",
"manufacturer",
",",
"\"model\"",
":",
"self",
".",
"m... | [
68,
4
] | [
76,
9
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.name | (self) | Return the name of the hub. | Return the name of the hub. | def name(self):
"""Return the name of the hub."""
return self._router_info.name if self._router_info else self.host | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_router_info",
".",
"name",
"if",
"self",
".",
"_router_info",
"else",
"self",
".",
"host"
] | [
79,
4
] | [
81,
73
] | python | en | ['en', 'ig', 'en'] | True |
KeeneticRouter.model | (self) | Return the model of the hub. | Return the model of the hub. | def model(self):
"""Return the model of the hub."""
return self._router_info.model if self._router_info else None | [
"def",
"model",
"(",
"self",
")",
":",
"return",
"self",
".",
"_router_info",
".",
"model",
"if",
"self",
".",
"_router_info",
"else",
"None"
] | [
84,
4
] | [
86,
69
] | python | en | ['en', 'no', 'en'] | True |
KeeneticRouter.firmware | (self) | Return the firmware of the hub. | Return the firmware of the hub. | def firmware(self):
"""Return the firmware of the hub."""
return self._router_info.fw_version if self._router_info else None | [
"def",
"firmware",
"(",
"self",
")",
":",
"return",
"self",
".",
"_router_info",
".",
"fw_version",
"if",
"self",
".",
"_router_info",
"else",
"None"
] | [
89,
4
] | [
91,
74
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.manufacturer | (self) | Return the firmware of the hub. | Return the firmware of the hub. | def manufacturer(self):
"""Return the firmware of the hub."""
return self._router_info.manufacturer if self._router_info else None | [
"def",
"manufacturer",
"(",
"self",
")",
":",
"return",
"self",
".",
"_router_info",
".",
"manufacturer",
"if",
"self",
".",
"_router_info",
"else",
"None"
] | [
94,
4
] | [
96,
76
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.available | (self) | Return if the hub is connected. | Return if the hub is connected. | def available(self):
"""Return if the hub is connected."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
99,
4
] | [
101,
30
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.consider_home_interval | (self) | Config entry option defining number of seconds from last seen to away. | Config entry option defining number of seconds from last seen to away. | def consider_home_interval(self):
"""Config entry option defining number of seconds from last seen to away."""
return timedelta(seconds=self.config_entry.options[CONF_CONSIDER_HOME]) | [
"def",
"consider_home_interval",
"(",
"self",
")",
":",
"return",
"timedelta",
"(",
"seconds",
"=",
"self",
".",
"config_entry",
".",
"options",
"[",
"CONF_CONSIDER_HOME",
"]",
")"
] | [
104,
4
] | [
106,
79
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.tracked_interfaces | (self) | Tracked interfaces. | Tracked interfaces. | def tracked_interfaces(self):
"""Tracked interfaces."""
return self._tracked_interfaces | [
"def",
"tracked_interfaces",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tracked_interfaces"
] | [
109,
4
] | [
111,
39
] | python | en | ['en', 'en', 'en'] | False |
KeeneticRouter.signal_update | (self) | Event specific per router entry to signal updates. | Event specific per router entry to signal updates. | def signal_update(self):
"""Event specific per router entry to signal updates."""
return f"keenetic-update-{self.config_entry.entry_id}" | [
"def",
"signal_update",
"(",
"self",
")",
":",
"return",
"f\"keenetic-update-{self.config_entry.entry_id}\""
] | [
114,
4
] | [
116,
62
] | python | en | ['en', 'en', 'it'] | True |
KeeneticRouter.request_update | (self) | Request an update. | Request an update. | async def request_update(self):
"""Request an update."""
if self._progress is not None:
await self._progress
return
self._progress = self.hass.async_create_task(self.async_update())
await self._progress
self._progress = None | [
"async",
"def",
"request_update",
"(",
"self",
")",
":",
"if",
"self",
".",
"_progress",
"is",
"not",
"None",
":",
"await",
"self",
".",
"_progress",
"return",
"self",
".",
"_progress",
"=",
"self",
".",
"hass",
".",
"async_create_task",
"(",
"self",
"."... | [
118,
4
] | [
127,
29
] | python | en | ['en', 'co', 'en'] | True |
KeeneticRouter.async_update | (self) | Update devices information. | Update devices information. | async def async_update(self):
"""Update devices information."""
await self.hass.async_add_executor_job(self._update_devices)
async_dispatcher_send(self.hass, self.signal_update) | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_update_devices",
")",
"async_dispatcher_send",
"(",
"self",
".",
"hass",
",",
"self",
".",
"signal_update",
")"
] | [
129,
4
] | [
132,
60
] | python | en | ['fr', 'en', 'en'] | True |
KeeneticRouter.async_setup | (self) | Set up the connection. | Set up the connection. | async def async_setup(self):
"""Set up the connection."""
self._connection = TelnetConnection(
self.config_entry.data[CONF_HOST],
self.config_entry.data[CONF_PORT],
self.config_entry.data[CONF_USERNAME],
self.config_entry.data[CONF_PASSWORD],
)
... | [
"async",
"def",
"async_setup",
"(",
"self",
")",
":",
"self",
".",
"_connection",
"=",
"TelnetConnection",
"(",
"self",
".",
"config_entry",
".",
"data",
"[",
"CONF_HOST",
"]",
",",
"self",
".",
"config_entry",
".",
"data",
"[",
"CONF_PORT",
"]",
",",
"s... | [
134,
4
] | [
157,
49
] | python | en | ['en', 'en', 'en'] | True |
KeeneticRouter.async_teardown | (self) | Teardown up the connection. | Teardown up the connection. | async def async_teardown(self):
"""Teardown up the connection."""
if self._cancel_periodic_update:
self._cancel_periodic_update()
self._connection.disconnect() | [
"async",
"def",
"async_teardown",
"(",
"self",
")",
":",
"if",
"self",
".",
"_cancel_periodic_update",
":",
"self",
".",
"_cancel_periodic_update",
"(",
")",
"self",
".",
"_connection",
".",
"disconnect",
"(",
")"
] | [
159,
4
] | [
163,
37
] | python | en | ['en', 'ga', 'en'] | True |
KeeneticRouter._update_devices | (self) | Get ARP from keenetic router. | Get ARP from keenetic router. | def _update_devices(self):
"""Get ARP from keenetic router."""
_LOGGER.debug("Fetching devices from router")
try:
_response = self._client.get_devices(
try_hotspot=self.config_entry.options[CONF_TRY_HOTSPOT],
include_arp=self.config_entry.options[CONF... | [
"def",
"_update_devices",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Fetching devices from router\"",
")",
"try",
":",
"_response",
"=",
"self",
".",
"_client",
".",
"get_devices",
"(",
"try_hotspot",
"=",
"self",
".",
"config_entry",
".",
"option... | [
173,
4
] | [
194,
35
] | python | en | ['en', 'en', 'en'] | True |
main | () | Run administrative tasks. | Run administrative tasks. | def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'today.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed a... | [
"def",
"main",
"(",
")",
":",
"os",
".",
"environ",
".",
"setdefault",
"(",
"'DJANGO_SETTINGS_MODULE'",
",",
"'today.settings'",
")",
"try",
":",
"from",
"django",
".",
"core",
".",
"management",
"import",
"execute_from_command_line",
"except",
"ImportError",
"a... | [
6,
0
] | [
17,
39
] | python | en | ['lv', 'gd', 'en'] | False |
test_connection_state_changes | (
harmony_client, mock_hc, hass, mock_write_config
) | Ensure connection changes are reflected in the switch states. | Ensure connection changes are reflected in the switch states. | async def test_connection_state_changes(
harmony_client, mock_hc, hass, mock_write_config
):
"""Ensure connection changes are reflected in the switch states."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "192.0.2.0", CONF_NAME: HUB_NAME}
)
entry.add_to_hass(hass)
await has... | [
"async",
"def",
"test_connection_state_changes",
"(",
"harmony_client",
",",
"mock_hc",
",",
"hass",
",",
"mock_write_config",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"\"192.0.2.0\"",
",",... | [
26,
0
] | [
79,
61
] | python | en | ['en', 'en', 'en'] | True |
test_switch_toggles | (mock_hc, hass, mock_write_config) | Ensure calls to the switch modify the harmony state. | Ensure calls to the switch modify the harmony state. | async def test_switch_toggles(mock_hc, hass, mock_write_config):
"""Ensure calls to the switch modify the harmony state."""
entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "192.0.2.0", CONF_NAME: HUB_NAME}
)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_... | [
"async",
"def",
"test_switch_toggles",
"(",
"mock_hc",
",",
"hass",
",",
"mock_write_config",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"\"192.0.2.0\"",
",",
"CONF_NAME",
":",
"HUB_NAME",
... | [
82,
0
] | [
120,
61
] | python | en | ['en', 'en', 'en'] | True |
add_statestream | (
hass,
base_topic=None,
publish_attributes=None,
publish_timestamps=None,
publish_include=None,
publish_exclude=None,
) | Add a mqtt_statestream component. | Add a mqtt_statestream component. | async def add_statestream(
hass,
base_topic=None,
publish_attributes=None,
publish_timestamps=None,
publish_include=None,
publish_exclude=None,
):
"""Add a mqtt_statestream component."""
config = {}
if base_topic:
config["base_topic"] = base_topic
if publish_attributes:
... | [
"async",
"def",
"add_statestream",
"(",
"hass",
",",
"base_topic",
"=",
"None",
",",
"publish_attributes",
"=",
"None",
",",
"publish_timestamps",
"=",
"None",
",",
"publish_include",
"=",
"None",
",",
"publish_exclude",
"=",
"None",
",",
")",
":",
"config",
... | [
10,
0
] | [
32,
5
] | python | co | ['en', 'co', 'it'] | False |
test_fails_with_no_base | (hass, mqtt_mock) | Setup should fail if no base_topic is set. | Setup should fail if no base_topic is set. | async def test_fails_with_no_base(hass, mqtt_mock):
"""Setup should fail if no base_topic is set."""
assert await add_statestream(hass) is False | [
"async",
"def",
"test_fails_with_no_base",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"add_statestream",
"(",
"hass",
")",
"is",
"False"
] | [
35,
0
] | [
37,
47
] | python | en | ['en', 'st', 'en'] | True |
test_setup_succeeds_without_attributes | (hass, mqtt_mock) | Test the success of the setup with a valid base_topic. | Test the success of the setup with a valid base_topic. | async def test_setup_succeeds_without_attributes(hass, mqtt_mock):
"""Test the success of the setup with a valid base_topic."""
assert await add_statestream(hass, base_topic="pub") | [
"async",
"def",
"test_setup_succeeds_without_attributes",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"add_statestream",
"(",
"hass",
",",
"base_topic",
"=",
"\"pub\"",
")"
] | [
40,
0
] | [
42,
56
] | python | en | ['en', 'en', 'en'] | True |
test_setup_succeeds_with_attributes | (hass, mqtt_mock) | Test setup with a valid base_topic and publish_attributes. | Test setup with a valid base_topic and publish_attributes. | async def test_setup_succeeds_with_attributes(hass, mqtt_mock):
"""Test setup with a valid base_topic and publish_attributes."""
assert await add_statestream(hass, base_topic="pub", publish_attributes=True) | [
"async",
"def",
"test_setup_succeeds_with_attributes",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"assert",
"await",
"add_statestream",
"(",
"hass",
",",
"base_topic",
"=",
"\"pub\"",
",",
"publish_attributes",
"=",
"True",
")"
] | [
45,
0
] | [
47,
81
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_sends_message | (hass, mqtt_mock) | Test the sending of a new message if event changed. | Test the sending of a new message if event changed. | async def test_state_changed_event_sends_message(hass, mqtt_mock):
"""Test the sending of a new message if event changed."""
e_id = "fake.entity"
base_topic = "pub"
# Add the statestream component for publishing state updates
assert await add_statestream(hass, base_topic=base_topic)
await hass.... | [
"async",
"def",
"test_state_changed_event_sends_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"e_id",
"=",
"\"fake.entity\"",
"base_topic",
"=",
"\"pub\"",
"# Add the statestream component for publishing state updates",
"assert",
"await",
"add_statestream",
"(",
"hass",
... | [
50,
0
] | [
70,
41
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_sends_message_and_timestamp | (hass, mqtt_mock) | Test the sending of a message and timestamps if event changed. | Test the sending of a message and timestamps if event changed. | async def test_state_changed_event_sends_message_and_timestamp(hass, mqtt_mock):
"""Test the sending of a message and timestamps if event changed."""
e_id = "another.entity"
base_topic = "pub"
# Add the statestream component for publishing state updates
assert await add_statestream(
hass, b... | [
"async",
"def",
"test_state_changed_event_sends_message_and_timestamp",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"e_id",
"=",
"\"another.entity\"",
"base_topic",
"=",
"\"pub\"",
"# Add the statestream component for publishing state updates",
"assert",
"await",
"add_statestream",
... | [
73,
0
] | [
101,
41
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_attr_sends_message | (hass, mqtt_mock) | Test the sending of a new message if attribute changed. | Test the sending of a new message if attribute changed. | async def test_state_changed_attr_sends_message(hass, mqtt_mock):
"""Test the sending of a new message if attribute changed."""
e_id = "fake.entity"
base_topic = "pub"
# Add the statestream component for publishing state updates
assert await add_statestream(hass, base_topic=base_topic, publish_attr... | [
"async",
"def",
"test_state_changed_attr_sends_message",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"e_id",
"=",
"\"fake.entity\"",
"base_topic",
"=",
"\"pub\"",
"# Add the statestream component for publishing state updates",
"assert",
"await",
"add_statestream",
"(",
"hass",
... | [
104,
0
] | [
133,
41
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_include_domain | (hass, mqtt_mock) | Test that filtering on included domain works as expected. | Test that filtering on included domain works as expected. | async def test_state_changed_event_include_domain(hass, mqtt_mock):
"""Test that filtering on included domain works as expected."""
base_topic = "pub"
incl = {"domains": ["fake"]}
excl = {}
# Add the statestream component for publishing state updates
# Set the filter to allow fake.* items
... | [
"async",
"def",
"test_state_changed_event_include_domain",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"\"domains\"",
":",
"[",
"\"fake\"",
"]",
"}",
"excl",
"=",
"{",
"}",
"# Add the statestream component for publishing ... | [
136,
0
] | [
169,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_include_entity | (hass, mqtt_mock) | Test that filtering on included entity works as expected. | Test that filtering on included entity works as expected. | async def test_state_changed_event_include_entity(hass, mqtt_mock):
"""Test that filtering on included entity works as expected."""
base_topic = "pub"
incl = {"entities": ["fake.entity"]}
excl = {}
# Add the statestream component for publishing state updates
# Set the filter to allow fake.* it... | [
"async",
"def",
"test_state_changed_event_include_entity",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"\"entities\"",
":",
"[",
"\"fake.entity\"",
"]",
"}",
"excl",
"=",
"{",
"}",
"# Add the statestream component for pub... | [
172,
0
] | [
205,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_exclude_domain | (hass, mqtt_mock) | Test that filtering on excluded domain works as expected. | Test that filtering on excluded domain works as expected. | async def test_state_changed_event_exclude_domain(hass, mqtt_mock):
"""Test that filtering on excluded domain works as expected."""
base_topic = "pub"
incl = {}
excl = {"domains": ["fake2"]}
# Add the statestream component for publishing state updates
# Set the filter to allow fake.* items
... | [
"async",
"def",
"test_state_changed_event_exclude_domain",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"}",
"excl",
"=",
"{",
"\"domains\"",
":",
"[",
"\"fake2\"",
"]",
"}",
"# Add the statestream component for publishing... | [
208,
0
] | [
241,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_exclude_entity | (hass, mqtt_mock) | Test that filtering on excluded entity works as expected. | Test that filtering on excluded entity works as expected. | async def test_state_changed_event_exclude_entity(hass, mqtt_mock):
"""Test that filtering on excluded entity works as expected."""
base_topic = "pub"
incl = {}
excl = {"entities": ["fake.entity2"]}
# Add the statestream component for publishing state updates
# Set the filter to allow fake.* i... | [
"async",
"def",
"test_state_changed_event_exclude_entity",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"}",
"excl",
"=",
"{",
"\"entities\"",
":",
"[",
"\"fake.entity2\"",
"]",
"}",
"# Add the statestream component for pu... | [
244,
0
] | [
277,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_exclude_domain_include_entity | (hass, mqtt_mock) | Test filtering with excluded domain and included entity. | Test filtering with excluded domain and included entity. | async def test_state_changed_event_exclude_domain_include_entity(hass, mqtt_mock):
"""Test filtering with excluded domain and included entity."""
base_topic = "pub"
incl = {"entities": ["fake.entity"]}
excl = {"domains": ["fake"]}
# Add the statestream component for publishing state updates
# ... | [
"async",
"def",
"test_state_changed_event_exclude_domain_include_entity",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"\"entities\"",
":",
"[",
"\"fake.entity\"",
"]",
"}",
"excl",
"=",
"{",
"\"domains\"",
":",
"[",
"... | [
280,
0
] | [
313,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_include_domain_exclude_entity | (hass, mqtt_mock) | Test filtering with included domain and excluded entity. | Test filtering with included domain and excluded entity. | async def test_state_changed_event_include_domain_exclude_entity(hass, mqtt_mock):
"""Test filtering with included domain and excluded entity."""
base_topic = "pub"
incl = {"domains": ["fake"]}
excl = {"entities": ["fake.entity2"]}
# Add the statestream component for publishing state updates
#... | [
"async",
"def",
"test_state_changed_event_include_domain_exclude_entity",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"\"domains\"",
":",
"[",
"\"fake\"",
"]",
"}",
"excl",
"=",
"{",
"\"entities\"",
":",
"[",
"\"fake.... | [
316,
0
] | [
349,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_include_globs | (hass, mqtt_mock) | Test that filtering on included glob works as expected. | Test that filtering on included glob works as expected. | async def test_state_changed_event_include_globs(hass, mqtt_mock):
"""Test that filtering on included glob works as expected."""
base_topic = "pub"
incl = {"entity_globs": ["*.included_*"]}
excl = {}
# Add the statestream component for publishing state updates
# Set the filter to allow *.inclu... | [
"async",
"def",
"test_state_changed_event_include_globs",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"\"entity_globs\"",
":",
"[",
"\"*.included_*\"",
"]",
"}",
"excl",
"=",
"{",
"}",
"# Add the statestream component for... | [
352,
0
] | [
387,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_exclude_globs | (hass, mqtt_mock) | Test that filtering on excluded globs works as expected. | Test that filtering on excluded globs works as expected. | async def test_state_changed_event_exclude_globs(hass, mqtt_mock):
"""Test that filtering on excluded globs works as expected."""
base_topic = "pub"
incl = {}
excl = {"entity_globs": ["*.excluded_*"]}
# Add the statestream component for publishing state updates
# Set the filter to allow *.excl... | [
"async",
"def",
"test_state_changed_event_exclude_globs",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"}",
"excl",
"=",
"{",
"\"entity_globs\"",
":",
"[",
"\"*.excluded_*\"",
"]",
"}",
"# Add the statestream component for... | [
390,
0
] | [
423,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_exclude_domain_globs_include_entity | (hass, mqtt_mock) | Test filtering with excluded domain and glob and included entity. | Test filtering with excluded domain and glob and included entity. | async def test_state_changed_event_exclude_domain_globs_include_entity(hass, mqtt_mock):
"""Test filtering with excluded domain and glob and included entity."""
base_topic = "pub"
incl = {"entities": ["fake.entity"]}
excl = {"domains": ["fake"], "entity_globs": ["*.excluded_*"]}
# Add the statestr... | [
"async",
"def",
"test_state_changed_event_exclude_domain_globs_include_entity",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"\"entities\"",
":",
"[",
"\"fake.entity\"",
"]",
"}",
"excl",
"=",
"{",
"\"domains\"",
":",
"[... | [
426,
0
] | [
479,
45
] | python | en | ['en', 'en', 'en'] | True |
test_state_changed_event_include_domain_globs_exclude_entity | (hass, mqtt_mock) | Test filtering with included domain and glob and excluded entity. | Test filtering with included domain and glob and excluded entity. | async def test_state_changed_event_include_domain_globs_exclude_entity(hass, mqtt_mock):
"""Test filtering with included domain and glob and excluded entity."""
base_topic = "pub"
incl = {"domains": ["fake"], "entity_globs": ["*.included_*"]}
excl = {"entities": ["fake.entity2"]}
# Add the statest... | [
"async",
"def",
"test_state_changed_event_include_domain_globs_exclude_entity",
"(",
"hass",
",",
"mqtt_mock",
")",
":",
"base_topic",
"=",
"\"pub\"",
"incl",
"=",
"{",
"\"domains\"",
":",
"[",
"\"fake\"",
"]",
",",
"\"entity_globs\"",
":",
"[",
"\"*.included_*\"",
... | [
482,
0
] | [
535,
45
] | python | en | ['en', 'en', 'en'] | True |
test_duplicate_error | (hass) | Test that errors are shown when duplicate entries are added. | Test that errors are shown when duplicate entries are added. | async def test_duplicate_error(hass):
"""Test that errors are shown when duplicate entries are added."""
geography_conf = {
CONF_API_KEY: "abcde12345",
CONF_LATITUDE: 51.528308,
CONF_LONGITUDE: -0.3817765,
}
MockConfigEntry(
domain=DOMAIN, unique_id="51.528308, -0.381776... | [
"async",
"def",
"test_duplicate_error",
"(",
"hass",
")",
":",
"geography_conf",
"=",
"{",
"CONF_API_KEY",
":",
"\"abcde12345\"",
",",
"CONF_LATITUDE",
":",
"51.528308",
",",
"CONF_LONGITUDE",
":",
"-",
"0.3817765",
",",
"}",
"MockConfigEntry",
"(",
"domain",
"=... | [
36,
0
] | [
74,
51
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_identifier_geography_api_key | (hass) | Test that an invalid API key throws an error. | Test that an invalid API key throws an error. | async def test_invalid_identifier_geography_api_key(hass):
"""Test that an invalid API key throws an error."""
with patch(
"pyairvisual.air_quality.AirQuality.nearest_city",
side_effect=InvalidKeyError,
):
result = await hass.config_entries.flow.async_init(
DOMAIN,
... | [
"async",
"def",
"test_invalid_identifier_geography_api_key",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"pyairvisual.air_quality.AirQuality.nearest_city\"",
",",
"side_effect",
"=",
"InvalidKeyError",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entri... | [
77,
0
] | [
98,
68
] | python | en | ['en', 'gd', 'en'] | True |
test_invalid_identifier_geography_name | (hass) | Test that an invalid location name throws an error. | Test that an invalid location name throws an error. | async def test_invalid_identifier_geography_name(hass):
"""Test that an invalid location name throws an error."""
with patch(
"pyairvisual.air_quality.AirQuality.city",
side_effect=NotFoundError,
):
result = await hass.config_entries.flow.async_init(
DOMAIN,
c... | [
"async",
"def",
"test_invalid_identifier_geography_name",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"pyairvisual.air_quality.AirQuality.city\"",
",",
"side_effect",
"=",
"NotFoundError",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
... | [
101,
0
] | [
123,
68
] | python | en | ['en', 'en', 'en'] | True |
test_invalid_identifier_geography_unknown | (hass) | Test that an unknown identifier issue throws an error. | Test that an unknown identifier issue throws an error. | async def test_invalid_identifier_geography_unknown(hass):
"""Test that an unknown identifier issue throws an error."""
with patch(
"pyairvisual.air_quality.AirQuality.city",
side_effect=AirVisualError,
):
result = await hass.config_entries.flow.async_init(
DOMAIN,
... | [
"async",
"def",
"test_invalid_identifier_geography_unknown",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"pyairvisual.air_quality.AirQuality.city\"",
",",
"side_effect",
"=",
"AirVisualError",
",",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".... | [
126,
0
] | [
148,
54
] | python | en | ['en', 'de', 'en'] | True |
test_invalid_identifier_node_pro | (hass) | Test that an invalid Node/Pro identifier shows an error. | Test that an invalid Node/Pro identifier shows an error. | async def test_invalid_identifier_node_pro(hass):
"""Test that an invalid Node/Pro identifier shows an error."""
node_pro_conf = {CONF_IP_ADDRESS: "192.168.1.100", CONF_PASSWORD: "my_password"}
with patch(
"pyairvisual.node.NodeSamba.async_connect",
side_effect=NodeProError,
):
... | [
"async",
"def",
"test_invalid_identifier_node_pro",
"(",
"hass",
")",
":",
"node_pro_conf",
"=",
"{",
"CONF_IP_ADDRESS",
":",
"\"192.168.1.100\"",
",",
"CONF_PASSWORD",
":",
"\"my_password\"",
"}",
"with",
"patch",
"(",
"\"pyairvisual.node.NodeSamba.async_connect\"",
",",... | [
151,
0
] | [
166,
70
] | python | en | ['en', 'lb', 'en'] | True |
test_migration | (hass) | Test migrating from version 1 to the current version. | Test migrating from version 1 to the current version. | async def test_migration(hass):
"""Test migrating from version 1 to the current version."""
conf = {
CONF_API_KEY: "abcde12345",
CONF_GEOGRAPHIES: [
{CONF_LATITUDE: 51.528308, CONF_LONGITUDE: -0.3817765},
{CONF_CITY: "Beijing", CONF_STATE: "Beijing", CONF_COUNTRY: "China"... | [
"async",
"def",
"test_migration",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_API_KEY",
":",
"\"abcde12345\"",
",",
"CONF_GEOGRAPHIES",
":",
"[",
"{",
"CONF_LATITUDE",
":",
"51.528308",
",",
"CONF_LONGITUDE",
":",
"-",
"0.3817765",
"}",
",",
"{",
"CONF_CI... | [
169,
0
] | [
213,
5
] | python | en | ['en', 'en', 'en'] | True |
test_options_flow | (hass) | Test config flow options. | Test config flow options. | async def test_options_flow(hass):
"""Test config flow options."""
geography_conf = {
CONF_API_KEY: "abcde12345",
CONF_LATITUDE: 51.528308,
CONF_LONGITUDE: -0.3817765,
}
config_entry = MockConfigEntry(
domain=DOMAIN,
unique_id="51.528308, -0.3817765",
dat... | [
"async",
"def",
"test_options_flow",
"(",
"hass",
")",
":",
"geography_conf",
"=",
"{",
"CONF_API_KEY",
":",
"\"abcde12345\"",
",",
"CONF_LATITUDE",
":",
"51.528308",
",",
"CONF_LONGITUDE",
":",
"-",
"0.3817765",
",",
"}",
"config_entry",
"=",
"MockConfigEntry",
... | [
216,
0
] | [
246,
64
] | python | en | ['en', 'fr', 'en'] | True |
test_step_geography_by_coords | (hass) | Test setting up a geopgraphy entry by latitude/longitude. | Test setting up a geopgraphy entry by latitude/longitude. | async def test_step_geography_by_coords(hass):
"""Test setting up a geopgraphy entry by latitude/longitude."""
conf = {
CONF_API_KEY: "abcde12345",
CONF_LATITUDE: 51.528308,
CONF_LONGITUDE: -0.3817765,
}
with patch(
"homeassistant.components.airvisual.async_setup_entry",... | [
"async",
"def",
"test_step_geography_by_coords",
"(",
"hass",
")",
":",
"conf",
"=",
"{",
"CONF_API_KEY",
":",
"\"abcde12345\"",
",",
"CONF_LATITUDE",
":",
"51.528308",
",",
"CONF_LONGITUDE",
":",
"-",
"0.3817765",
",",
"}",
"with",
"patch",
"(",
"\"homeassistan... | [
249,
0
] | [
276,
9
] | 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.